Skip to content

fix(transcript): accept --timeout after the verb and floor reads at 120 s - #316

Merged
ZacxDev merged 3 commits into
mainfrom
fix/transcript-read-timeout
Nov 12, 2026
Merged

ZacxDev merged 3 commits into
mainfrom
fix/transcript-read-timeout

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Problem

cairn transcript skeleton --session <id> for a very large stored session (hundreds of streams, tens of thousands of tool calls) failed for every credential after 20 s with context deadline exceeded. The read was bounded by the store default (DefaultTimeout = 20), and transcript ... --timeout N was refused as an unknown flag; only the global position (cairn --timeout N transcript ...) could raise it.

Measurement

With the bound raised, five reads of that session took 20.3 s to 21.4 s end to end, 5,857,324 bytes each. A curl of the client listener put the first byte at 20.9 s of a 21.4 s total, so the time goes into the server building the skeleton, not the transfer.

Server bound: the client listener's http.Server sets only ReadHeaderTimeout (no WriteTimeout), and the transcript handler runs no request deadline, so nothing server-side cuts a longer read off. No server change is needed.

Change

  • transcript takes --timeout SECONDS after the verb, like memo-check (the shared parser arm already existed; the verb's flag table lacked it).
  • Transcript reads are made with max(timeout, 120), the same shape as audit-refs' max(opts.Timeout, 30). 120 s is the ~21 s measurement with more than 5x headroom. An explicit larger value in either position wins.
  • A non-positive --timeout is refused at exit 2 before any request (as memo-check refuses it) instead of being silently raised to the floor.
  • Help text, the README verb row and a CHANGELOG index row updated.

Tests

internal/client/transcript_timeout_test.go:

test origin/main this branch
TestTheTranscriptVerbAcceptsTimeoutAfterTheVerb red (exit 2, does not accept "--timeout") green
TestATranscriptReadOutlivesASmallerTimeout (1.5 s listener, --timeout 1) red (exit 3, client deadline) green
TestATranscriptReadIsBoundedByTheFloorOrALargerTimeout n/a (new symbols) green

The floor test records the bound the verb hands the HTTP client: 120 for no flag, 7 and global 3; 377 and 401 when larger; no request for 0 or -5. None of the asked values can equal the floor or the store default.

Mutation sweep (each one red on a specific assertion, unmutated control green):

  • floor removed: the floor test (bounds passed [20], want [120]) and the slow-listener test (exit 3)
  • --timeout dropped from the flag table: the acceptance test (exit 2) and the floor test
  • the verb passing the floor literally, or the helper returning it: the floor test (bounds passed [120], want [377])
  • the non-positive refusal removed: the floor test (exit 0 (want 2) ... requests 1)

go test ./internal/client/... green.

🤖 Generated with Claude Code

ZacxDev and others added 2 commits November 12, 2026 10:09
…20 s

`cairn transcript skeleton` for a very large stored session (hundreds of
streams, tens of thousands of tool calls) failed for every credential with
"context deadline exceeded" after 20 s: the read was bounded by the store
default (`DefaultTimeout = 20`), and `transcript ... --timeout N` was refused
as an unknown flag. Only the global position (`cairn --timeout N transcript`)
could raise it, and nothing pointed there.

Measured against that session with the bound raised: five reads took
20.3 s to 21.4 s end to end, 5,857,324 bytes each. A curl of the
client listener put the first byte at 20.9 s of a 21.4 s total, so the time is
the server building the skeleton, not the transfer. The listener has no
WriteTimeout and the handler no request deadline (`http.Server` sets only
`ReadHeaderTimeout`), so nothing server-side cuts a longer read off; no
server change is needed.

- `transcript` takes `--timeout SECONDS` after the verb, like `memo-check`
  (the shared parser arm already existed; the verb's flag table lacked it).
- Transcript reads are made with `max(timeout, 120)`, the `audit-refs`
  `max(opts.Timeout, 30)` shape. 120 s is the ~21 s measurement with more
  than 5x headroom (3x would be ~63 s; 120 s is the stated minimum). An
  explicit larger value in either position wins.
- A non-positive `--timeout` is refused at exit 2 before any request, as
  `memo-check` refuses it, rather than being silently raised to the floor.
- Help text and the README verb row say so.

Tests (internal/client/transcript_timeout_test.go):
- TestTheTranscriptVerbAcceptsTimeoutAfterTheVerb and
  TestATranscriptReadOutlivesASmallerTimeout are red at origin/main (exit 2
  "does not accept \"--timeout\""; exit 3 on the client deadline) and green
  here.
- TestATranscriptReadIsBoundedByTheFloorOrALargerTimeout records the bound
  the verb hands the client: 120 for no flag / 7 / global 3, 377 and 401
  when larger, and no request for 0 or -5. Mutants killed: floor removed,
  --timeout dropped from the flag table, the verb or the helper hardcoding
  the floor, the non-positive refusal removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…loor (#316)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev

ZacxDev commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Round 0 (requirements & deletion): requirement questioned: the non-positive --timeout refusal. Kept. No open premises.

Ledger: round 0 · requirements: 5 (unattributed: 2) · deletion candidates: 2

D1 — the non-positive --timeout refusal in Transcript: once the 120 s floor exists it is not needed to stop an unbounded wait (max(0,120)=120); kept only for UnboundedTimeoutReason consistency. Recommend keep.
D2 — accepting --timeout after the transcript verb: the floor alone fixes the 20 s failure and the global position already raises above 120. Recommend keep (cheap, matches memo-check).

…ell bound

Round 1 audit follow-ups (no 🔴):

- 🟡 A 120 s floor equals a coding agent's usual 2-minute shell-command
  bound, so an unreachable listener ended in the harness killing the call
  instead of the client's own "nothing was read" diagnosis. 90 s still gives
  about 4x headroom over the measured ~21 s read of a very large session.
- 🟢 CHANGELOG said "a larger value in either position wins". Both positions
  set one field, so the last one given counts. Reworded, and the const comment
  says the same.

go test ./internal/client/...: ok. leakscan: clean.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ZacxDev

ZacxDev commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Round 1 (full nine-axis audit of 725fc60): no 🔴, so the ladder ends here. Red-at-base was confirmed and all listed mutants were re-verified, plus three of the auditor's own.

Fixed in 2467a70 (not re-audited, per the stop rule):

  • 🟡 The 120 s floor equalled an agent's 2-minute shell bound, so it is lowered to 90 s.
  • 🟢 The CHANGELOG "either position wins" wording is corrected to last-wins.
1. TranscriptTimeoutFloor 120 -> 90, with tests, README and CHANGELOG updated to match
2. CHANGELOG and const comment state that with both --timeout positions the last one counts

@ZacxDev
ZacxDev marked this pull request as ready for review November 12, 2026 16:46
@ZacxDev
ZacxDev merged commit 1c529c5 into main Nov 12, 2026
29 checks passed
@ZacxDev
ZacxDev deleted the fix/transcript-read-timeout branch November 12, 2026 16:46
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.

1 participant