Skip to content

fix: Codex summarizer routing reads the transcript the host wrote, not its environment (#465) - #466

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/465
Aug 29, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/465

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #465

Under REMEMBER_SUMMARIZER=auto (the default), a default-configured Codex session still summarized via claude -p -- exactly the outcome #460 was filed to remove, and unfixed by #463's own env-signature repair. #464's fixture (CODEX_SESSION_ID/CODEX_THREAD_ID) was captured from a Codex tool shell; the summarizer runs in a different child, the SessionEnd hook process (pipeline/haiku.py <- scripts/save-session.sh <- scripts/session-end-hook.sh). A live env dump from inside a real SessionEnd hook (CLAUDE_CODE_* stripped, codex-cli 0.150.1) shows neither variable reaches that process -- only PLUGIN_ROOT/CLAUDE_PLUGIN_ROOT survive.

pipeline.haiku._choose_summarizer_provider() no longer asks the environment for a Codex signature under auto. It reads REMEMBER_TRANSCRIPT_PATH (already exported by every hook since #407) and sniffs the transcript's own first parseable line for a Codex- or Claude-Code-shaped envelope (pipeline.extract.sniff_file_envelope(), existing since #443) -- a fact the host wrote, not a promise it exported and could later withdraw. pipeline.host.detect_host() itself is unchanged and still directly tested (env-based host identification remains a correct, real fact about a process); it is simply no longer the mechanism this one call site uses.

Verified live and end to end: two default-configured (REMEMBER_SUMMARIZER unset) codex exec sessions against the branch installed into the live Codex plugin cache both logged [haiku] SKIP (provider: codex) -- position -> 16 -- the release condition (a default-configured Codex session logs provider: codex) is met. Both SKIPped on trivial content (the summarizer's own judgment threshold, unrelated to detection, see #461); a live non-SKIP (appended) transition on the Codex route was not forced in this session -- see the worktree note for the gap.

Self-review (Explore + oss:auditor, both run against the first commit) found two real issues, both fixed in the follow-up commit:

  • pipeline/host.py's module docstring still said the summarizer was "chosen by detect_host()", directly contradicting the updated AMBIGUOUS-comment block ~120 lines below it in the same file.
  • _choose_summarizer_provider() silently collapsed "genuinely Claude Code" and "transcript unreadable/unrecognised" into the same unlogged claude result; it now warns (via the existing _warn()) only on the genuine "could not sniff" branch, with a positive/negative test pair.

Below-bar, not filed: Explore also flagged that README.md:483 ("the summarizer, pipeline/haiku.py, is Claude-Code-coupled by design and not touched") is stale -- true since #460 shipped provider dispatch, predates this diff, and sits next to text this diff did edit. Judged below-bar rather than filed: it is a real inaccuracy but not reachable by anything scoped to #465's own footprint without turning into a general README audit unrelated to this issue.

Tests

  • New: tests/test_codex_hook_transcript_465.py -- positive control (real Codex transcript, zero Codex env signature present, resolves codex), negative control (CODEX_SESSION_ID alone, no transcript, resolves claude -- the exact Codex detection still fails in the hook process: the route works under an explicit override but auto resolves to claude #465 regression), no-transcript-at-all, unusable-transcript, explicit-override-wins, plus the follow-up commit's warn/no-warn pair.
  • Updated: tests/test_summarizer_routing_460.py (four tests' "Codex host" simulation switched from CODEX_SESSION_ID to REMEMBER_TRANSCRIPT_PATH pointing at the existing tests/fixtures/codex-rollout.jsonl fixture, since the env var alone no longer selects codex -- that is now itself a regression pin), tests/test_codex_signature_463.py (docstring only, noting detect_host() is unchanged and still correctly tested but no longer this call site's mechanism).
  • Full suite: 1878 passed, 43 skipped (platform-gated), before the follow-up commit; targeted re-runs (26 + 139 tests) green after it.
  • python3 .oss/assemble_changelog.py --check: ok.

Docs

README.md's REMEMBER_SUMMARIZER row updated to describe the transcript-based mechanism. changelog.d/465.fixed.md added.

Generated with Claude Code

fdaviddpt and others added 2 commits August 29, 2026 15:06
…t its environment (#465)

Under REMEMBER_SUMMARIZER=auto, a default-configured Codex session still
routed to `claude -p` -- #464's CODEX_SESSION_ID/CODEX_THREAD_ID fixture
was captured from a Codex tool shell, not the SessionEnd hook process that
actually spawns the summarizer, and a live capture from inside that hook
(env dumped, CLAUDE_CODE_* stripped, codex-cli 0.150.1) shows neither
variable survives into it. pipeline.haiku._choose_summarizer_provider()
now reads REMEMBER_TRANSCRIPT_PATH and sniffs the transcript's own first
line (pipeline.extract.sniff_file_envelope(), #443) instead -- what the
host wrote, not what it exported. Verified against a live, default-
configured `codex exec` session: SessionEnd now logs `provider: codex`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ed sniff failure

Explore (reviewer) found pipeline/host.py's module docstring still
described the summarizer as "chosen by detect_host()", directly
contradicting the AMBIGUOUS-comment update three commits' worth of prose
below it -- both now describe the real #465 mechanism.

oss:auditor found _choose_summarizer_provider() silently collapsed "the
transcript is genuinely Claude Code" and "the transcript could not be
sniffed" (unreadable, deleted mid-race, or an unrecognised shape) into the
same unlogged "claude" result -- indistinguishable to an operator
debugging a wrongly-billed session. It now warns (via the existing _warn())
only on the "could not sniff" branch, never on the ordinary "no transcript
at all" path, with positive/negative tests for both.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@fdaviddpt
fdaviddpt merged commit 5080cfc into main Aug 29, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/465 branch August 29, 2026 13:29
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.

Codex detection still fails in the hook process: the route works under an explicit override but auto resolves to claude

1 participant