The relay's runs keep the cache lifetime of the session they go on from
(savedSession.cachePrefix). Three of the four places that make a
savedSession left it out: branch (a fork's turn), retryBranch (a turn
sent again while its run is busy) and branchAt (the turn after the
interactive mode's side question). cachePrefix.runTTL() reads an empty
ttl as an hour, so each such run was started with
CLAUDE_CODE_PROMPT_CACHE_TTL=1h under a 5m pick, and wrote 1h cache
entries. Each now carries its run's cachePrefix, as shelve did.
Tests: the fork, busy-retry and side question harnesses log each run's
CLAUDE_CODE_PROMPT_CACHE_TTL; with promptCacheTtl 5m picked
(pickFiveMinutes), everyRunKept5m requires every resumed run to have 5m.
Run (on mote, at this commit, base 2dac9b84e = origin/main just fetched):
- go test -count=1 -run of the side question, busy retry, fork and
TestClaudeRunKeepsTheUsersCacheTTL tests ./internal/gateway: ok
- go test -count=1 -timeout 45m ./... through suite.lock: every package
ok (88), exit 0
- gofmt -l internal/: nothing
- go vet ./internal/gateway, GOOS=linux go vet -tags nogui, GOOS=windows
go vet: ok
Broken by hand: the three cachePrefix carries taken out, the busy-retry
test (print and interactive), the fork test (print and interactive) and
the side question test each fail "a branch's run, want a 5m cache as its
parent's".
Not tried: a real Claude subscription, and linkaww's Mac -> Docker
magpie chain. The second half of the report (a 5m pick and an unmarked
side call, and no pick at all) is the next commit.
Reported-by: linkaww on Discord