Skip to content

PostToolUse still cannot save on Codex: the session id is taken from the transcript basename, which #459 stopped controlling #468

Closed

Description

@fdaviddpt

Found by the round-1 release audit gating v0.24.0. Row fails-to-preserve — ships behind an issue rather than blocking, but it falsifies a claim this release makes about itself.

Symptom

Per-tool-call capture is still inert on Codex, after #459 was supposed to fix exactly that. Every PostToolUse forks save-session.sh, which exits 1 into an autonomous log.

Location

scripts/post-tool-hook.sh:552-553:

SESSION_ID="${TRANSCRIPT##*/}"
SESSION_ID="${SESSION_ID%.jsonl}"

then scripts/save-session.sh:191:

if ! [[ "$SESSION_ID" =~ ^[a-f0-9-]+$ ]]; then
    log "save" "ERROR: invalid session ID: ..."
    exit 1

Mechanism

Deriving the id from the basename was correct while TRANSCRIPT was always $SESSION_DIR/<session_id>.jsonl — Claude Code's layout. #459 changed TRANSCRIPT to whatever transcript_path arrives on stdin, which on Codex is rollout-<date>-<uuid>.jsonl, and discarded the STDIN_SESSION_ID it had already extracted and validated four lines earlier.

Exercised against a real filename from the live store, with a positive control:

REJECT: rollout-2026-08-29T14-51-09-01a04d92-ea74-7253-92f7-bd7918847ffb
ACCEPT: 01a04d92-ea74-7253-92f7-bd7918847ffb

r, o, l, u, t and T are all outside [a-f0-9-].

SessionEnd is unaffected because it passes the stdin UUID directly — which is why a Codex session still gets captured at teardown and looks fine. What is lost is incremental capture: a crash, a kill, or any end that is not a clean SessionEnd loses the whole session.

pipeline/extract.py:514-517 documents this precise hazard — "A host may name the file anything (Codex's rollout-<date>-<uuid>); if that leaks into the resume key…" — and fixes the Python side. The shell side that actually chooses the id was not updated. The fix and its rationale existed in the same delta as the defect.

Why this matters beyond its row

I verified Codex end to end before the audit and reported it working. That verification watched SessionEnd, which works. It never checked whether the per-tool-call path saved, only that the misleading warning had gone. The warning going away was read as the path working.

What would settle it

Prefer STDIN_SESSION_ID at post-tool-hook.sh:552 when it is set, falling back to the basename only when stdin offered nothing — the same precedence #407 established for the transcript path itself.

The test is a Codex-shaped PostToolUse payload asserting a save is attempted and accepted, not merely that no warning is logged. Pair it with the control that distinguishes those two: the previous fix passed because it asserted the absence of a message.

Activity

  1. added
    bug
    priority:high
    on Aug 29, 2026
  2. self-assigned this
    on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority:high

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions