Skip to content

fix(store): synthesize session ID when empty in claude_code, codex, and pi - #63

Open
Adityakk9031 wants to merge 3 commits into
skillsynchq:mainfrom
Adityakk9031:fix/empty-session-id-synthesis
Open

Adityakk9031 wants to merge 3 commits into
skillsynchq:mainfrom
Adityakk9031:fix/empty-session-id-synthesis

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

Summary

When continuing, translating, or saving transcripts without an explicit ID (such as via standard input with txcript continue - --with <harness> or when converting from a harness that doesn't carry an ID), ClaudeStore::save, CodexStore::save, pi::write_session (used by both Pi and Campfire), and local::materialize_artifacts_for_claude_code would panic/error with:

Malformed: session id "" is not usable as a file name

Other stores (Cursor, Fx, Grok, Antigravity) already safely synthesize a Uuid::new_v4() fallback when meta.id is empty before enforcing path safety checks via checked_id_component.

Changes

  • Claude Code: In ClaudeStore::save and local::materialize_artifacts_for_claude_code, generate a fresh UUID when meta.id is empty. Stamp the synthesized ID into the transcript so both the JSONL records and the filename share the exact same session identity for proper session resumption.
  • Codex: In CodexStore::save, synthesize a UUID when meta.id.is_empty(), stamping the ID into the transcript so the session_meta line inside the rollout matches the filename.
  • Pi / Campfire: In pi::write_session, synthesize a UUID when meta.id.is_empty() and patch the leading Record::Session header if present so the in-file ID matches the filename on disk.
  • Tests: Added regression unit tests for all three stores verifying that saving a transcript with an empty ID succeeds, writes a valid file named with the synthesized UUID, and preserves consistency.

@NishantJoshi00

Copy link
Copy Markdown
Collaborator

The generated ID doesn't survive save/load consistently for Claude and Codex. The reloaded ID differs from Saved.id. Can we stamp the ID into the native records too and test that it matches after reload?

@Adityakk9031

Copy link
Copy Markdown
Contributor Author

Updated to stamp synthesized session IDs directly into the native records/rollout lines when saving for Claude Code and Codex, and added assertions verifying that
eloaded.meta.id == saved.id across Claude Code, Codex, and Pi.

This branch has not been deployed

No deployments
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.

2 participants