Repository navigation
Merged
Conversation
… Codex session silently saved zero memory (#443) Codex writes {"timestamp", "ordinal", "type", "payload"} lines, with role and text one level inside `payload`; extract.py only knew Claude Code's {"type": "user"|"assistant", "message": {...}} shape. A real Codex session -- hooks firing, .remember/ created, a real prompt and reply -- extracted 0 exchanges, indistinguishable from a genuinely quiet one. pipeline/host.py now sniffs a transcript's envelope from its own first line and reads either shape; an envelope matching neither is reported as "unrecognised" (ExtractResult.envelope, surfaced to save-session.sh's log) rather than silently counted as zero. A trimmed, sanitised capture of the reproducing session is committed as tests/fixtures/codex-rollout.jsonl. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…st, refresh a stale docstring Self-review (Explore + oss:auditor) on the #443 commit found three real issues, addressed here: - pipeline/extract.py's `main()` --json branch built its dict from ExtractResult by hand and never picked up the new `envelope` field, so `python3 -m pipeline.extract --json` -- a documented, trusted-by-design entry point -- still could not tell a genuinely quiet session from one whose transcript this module could not parse at all. Added, with a red/green test (test_main_json_flag). - test_extract_messages_codex_rollout_positive_control_scaffolding_excluded asserted only that scaffolding text was ABSENT from the extracted output; it would have passed identically if extraction produced nothing at all. Now asserts the scaffolding IS present in the raw fixture (so trimming the fixture down would fail loud) and pins the exact two surviving messages. - pipeline/extract.py's module docstring still said "Claude Code session JSONL files" only; it now names both envelopes and points at sniff_file_envelope()/pipeline/host.py. A third finding (codex_exchange() has no per-turn de-duplication guard against a hypothetical future Codex emission of multiple item_completed events per logical turn) is below the bar to fix or file: no evidence in the fixture, the code, or the issue body that Codex actually does this -- reported in the PR body rather than acted on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pipeline/extract.pyonly recognised Claude Code's transcript envelope(
{"type": "user"|"assistant", "message": {...}}), so a real Codex session --hooks firing,
.remember/created, one real human prompt and one realassistant reply on the wire -- extracted
0 exchangesand saved nothing,with no signal to the user that anything had gone wrong.
Closes #443
What changed
pipeline/host.pygainedsniff_envelope()(identifies which host wrote atranscript line, from its shape --
"claude-code","codex", or"unrecognised") andcodex_exchange()(extracts(role, text)fromCodex's
event_msg/item_completedlines -- Codex's own record of what ahuman sent and what the agent's final answer was -- deliberately not from
the same text's duplicate under
response_itemrole: "user"/"assistant",which also covers session scaffolding: skill instructions, the
recommended-plugins list, this plugin's own REMEMBER buffer preamble).
pipeline/extract.pygainedsniff_file_envelope()(sniffs from thefile's own first parseable line, independent of any resume position) and
threads an
envelopeparameter throughextract_messages()/extract_session().ExtractResultgained anenvelopefield.pipeline/shell.pyandscripts/save-session.shsurface"unrecognised"as a distinct log line -- not folded into the same "0 exchanges" wording a
genuinely quiet session gets, which is the exact silent failure this issue
exists to prevent.
tests/fixtures/codex-rollout.jsonl.README.md's Codex section rewritten from "scaffolding, not yet verified"to name what is now observed against a live
codex-cli 0.150.1install(marketplace discovery, plugin install, three hooks firing, Read cwd and transcript_path from hook stdin instead of deriving them #407's
session-id keying, resolve-paths.sh cannot resolve a project root on any host that does not set CLAUDE_PROJECT_DIR #411's cwd fallback) and what is still open (user-prompt and post-tool hooks cannot resolve the project root on Codex, so per-turn capture silently no-ops #444, a
separate lane, referenced but not touched here).
changelog.d/443.fixed.mdadded, passespython3 .oss/assemble_changelog.py --check.Self-review follow-up (second commit)
Spawned an
Explorereviewer and theoss:auditoragainst the first commit.Findings and dispositions:
main()'s--jsonbranch never carried the newenvelopefield into its output, so
python3 -m pipeline.extract --json-- adocumented, trusted-by-design entry point -- still could not distinguish a
genuinely quiet session from an unparseable one. Added, with a red/green test.
that scaffolding text was absent from the output, which would pass
identically if extraction produced nothing at all. Now also asserts the
scaffolding is present in the raw fixture, and pins the exact surviving messages.
pipeline/extract.py's module docstring still said "Claude Codesession JSONL files" only.
codex_exchange()counts everyevent_msg/item_completedline naming aUserMessageorAgentMessageunconditionally, with no per-turn de-duplication guard. If a future Codex
release ever emits more than one
item_completedper logical turn (apartial phase plus a final one, say), exchanges would double-count. There
is no evidence in the fixture, the code, or the issue body that Codex
actually does this -- the single captured session shows exactly one of
each -- so this is a reachable-in-theory, not reachable-in-practice, class
argued down rather than filed.
Deliberately not fixed here (separate filing)
scripts/save-session.shalready advanced the saved read-position pastlines it could not successfully read (corrupt JSON, and now also an
unrecognised envelope) whenever
EXCHANGE_COUNTis 0 -- a pre-existing,general defect, not specific to Codex (the issue's own "position -> 15"
note flags it). Left alone; see the report for the filing detail.
Test plan
tests/test_extract.py-- new tests red before the fix (AttributeErroron
ExtractResult.envelope, missingsniff_envelope), green after.tests/test_shell.py,tests/test_save_session_gates.py-- new testsfor the
ENVELOPEshell-bridge variable and the distinct log line.pytest): 1815 passed, 43 skipped, 91.21% coverage.python3 .oss/assemble_changelog.py --check: ok.