Repository navigation
fix(transcript): accept --timeout after the verb and floor reads at 120 s - #316
Merged
Merged
Conversation
…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>
Owner
Author
|
Round 0 (requirements & deletion): requirement questioned: the non-positive Ledger: |
…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>
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):
|
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.
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 withcontext deadline exceeded. The read was bounded by the store default (DefaultTimeout = 20), andtranscript ... --timeout Nwas 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.Serversets onlyReadHeaderTimeout(noWriteTimeout), and the transcript handler runs no request deadline, so nothing server-side cuts a longer read off. No server change is needed.Change
transcripttakes--timeout SECONDSafter the verb, likememo-check(the shared parser arm already existed; the verb's flag table lacked it).max(timeout, 120), the same shape asaudit-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.--timeoutis refused at exit 2 before any request (asmemo-checkrefuses it) instead of being silently raised to the floor.Tests
internal/client/transcript_timeout_test.go:TestTheTranscriptVerbAcceptsTimeoutAfterTheVerbdoes not accept "--timeout")TestATranscriptReadOutlivesASmallerTimeout(1.5 s listener,--timeout 1)TestATranscriptReadIsBoundedByTheFloorOrALargerTimeoutThe floor test records the bound the verb hands the HTTP client: 120 for no flag,
7and global3; 377 and 401 when larger; no request for0or-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):
bounds passed [20], want [120]) and the slow-listener test (exit 3)--timeoutdropped from the flag table: the acceptance test (exit 2) and the floor testbounds passed [120], want [377])exit 0 (want 2) ... requests 1)go test ./internal/client/...green.🤖 Generated with Claude Code