Skip to content

bug(debug): a Codex debug bundle can miss the latest prompt body #1336

Description

@Juliusolsson05

Found by review C of #1332 (#372). The behavior predates that PR.

Expected

A debug bundle for a Codex session carries the latest request body (the prompt that produced the behavior being reported), as Claude bundles do through latest-request-body.json (#1273).

Actual

The bundle's proxy section is the last 5 MiB of proxy-events.jsonl (plus .1 after a rotation, #1332). A /v1/responses request followed by more than 5 MiB of response chunks or /v1/models refreshes has its body_b64 before the tail, so the bundle holds recent chunks but no prompt body.

Evidence

temp/review-1332/report-c.md finding 1. Line by line over the live corpus:

  • Legacy format: in 40 of 65 Codex files with an inline body, the last body lies more than 5 MiB before EOF.
  • Projected to the current base64 format: 10 of 65.

Codex has no latest-request-body.json sidecar.

Direction

Mirror Claude: have codex-headless's EventsMirror keep the newest request body in a sidecar next to the events file (or re-emit it after each rotation). readLatestRequestBody in proxyEventsReader.ts already appends a sidecar.

Activity

  1. Juliusolsson05 commented on Sep 27, 2026

    @Juliusolsson05
    OwnerAuthor

    Closed attempt: #1399 (branch kept; reopenable). It made a Codex debug bundle fall back from resume-<providerSessionId> to shell-<sessionId>. Review a (P1) showed that no search order over those two directory keys is correct:

    • Resume first (as in fix(debug): a fresh session's debug bundle finds its own proxy run #1399): pane p1 starts fresh conversation T (shell-p1/R1); later pane p2 resumes T (resume-T/R2). Saving p1's bundle picks R2, which is p2's run and prompts.
    • Shell first: a cold-recovered pane keeps its local id and would pick its own stale fresh-run dir.
    • Newest of both: still picks p2's run in the case above.

    proxyEventsReader matches directory names only; match: 'exact' means the segment string, not pane or process provenance. The real fix is a launch-time proxy run identity recorded per session: #1405. The #1399 tests (an assembler-level stub of readProxyEvents) and its manifest fields (requestedSessionKey, matchedSessionSegment, proxyRunDir) are reusable. The package half, codex-headless#70 (the latest request body kept beside the run), is independent.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions