Skip to content

Add Command Code session support#603

Open
aaronflorey wants to merge 3 commits into
kenn-io:mainfrom
aaronflorey:add-command-code-support
Open

Add Command Code session support#603
aaronflorey wants to merge 3 commits into
kenn-io:mainfrom
aaronflorey:add-command-code-support

Conversation

@aaronflorey

Copy link
Copy Markdown
Contributor

Summary

  • add a Command Code file-based parser and transcript discovery for ~/.commandcode/projects
  • register the new agent and wire it into sync processing
  • add parser and registry tests for Command Code sessions

Testing

  • mise exec -- go test ./internal/parser ./internal/sync

@roborev-ci

roborev-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (352af76)

High/Medium issues remain: Command Code parsing is registered, but the sync engine does not yet process or incrementally classify Command Code session files.

High

  • internal/sync/engine.go:2886 - processFile never dispatches parser.AgentCommandCode, so discovered Command Code files fall through to unknown agent type: commandcode and cannot be synced.
    • Fix: Add case parser.AgentCommandCode: res = e.processCommandCode(file, info) and cover it with an engine-level sync/dispatch test.

Medium

  • internal/sync/engine.go:842 - classifyOnePath has no Command Code path classifier, so fsnotify-driven SyncPaths ignores changes under .commandcode/projects even after the agent is registered.
    • Fix: Add a Command Code classifier for <projectsDir>/<slugified-cwd>/<session-id>.jsonl, excluding checkpoint/prompt sidecars, plus a classify test.

Panel: ci_default_security | Synthesis: codex, 10s | Members: codex_default (codex/default, done, 3m24s), codex_security (codex/security, done, 54s) | Total: 4m28s

@roborev-ci

roborev-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (7e366c2)

Summary verdict: two medium sync/persistence issues remain; no high or critical findings were reported.

Medium

  • Location: internal/parser/commandcode.go:266
    Problem: DisplayName is populated from .meta.json, but the sync path never copies ParsedSession.DisplayName into db.Session. toDBSession only copies FirstMessage, so Command Code titles are dropped after SyncPaths/sync and never reach the UI.
    Fix: Copy non-empty pw.sess.DisplayName into s.DisplayName during toDBSession. UpsertSession already preserves existing display names on conflict, so this can remain insert-only.

  • Location: internal/sync/engine.go:863
    Problem: Command Code depends on a sibling <session>.meta.json for title and fallback cwd/project data, but sync dispatch only classifies <session>.jsonl, and processCommandCode skips based only on the JSONL file’s size/mtime. If the meta file is written after the transcript or later changes due to a rename, the watcher ignores it and full sync skips the unchanged JSONL, leaving stale or missing metadata.
    Fix: Classify .meta.json changes by remapping them to the matching .jsonl, and use combined JSONL+meta file info or another sidecar-aware invalidation path for shouldSkipByPath.


Panel: ci_default_security | Synthesis: codex, 10s | Members: codex_default (codex/default, done, 4m30s), codex_security (codex/security, done, 1m55s) | Total: 6m35s

@roborev-ci

roborev-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown

roborev: Combined Review (4347c90)

Medium-severity issues found; no High or Critical findings.

Medium

  • internal/db/sessions.go:960 - display_name backfills whenever the stored value is NULL, which makes an explicit user clear non-sticky. RenameSession(id, nil) clears the title, but the next sync of a Command Code session with metadata restores excluded.display_name, so users can no longer clear parser-provided titles.

    • Fix: Distinguish “never populated” from “user cleared” before backfilling, for example with an explicit metadata flag/sentinel or by limiting this backfill to rows that have not had display-name user management applied.
  • internal/sync/engine.go:2254 - Command Code’s .meta.json mtime is only considered inside processCommandCode; SyncAllSince filters discovered files using discoveredFileMtime, which still stats only the .jsonl. If a metadata file arrives or changes while the watcher is not running, the unchanged transcript is filtered out before it can be reparsed, leaving display_name, cwd, and project metadata stale until a full sync.

    • Fix: Make the Command Code effective mtime available to pre-filtering paths, and also use it from SourceMtime so fallback polling sees sidecar-only changes.

Panel: ci_default_security | Synthesis: codex, 12s | Members: codex_default (codex/default, done, 5m51s), codex_security (codex/security, done, 1m50s) | Total: 7m53s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant