Repository navigation
Conversation
Forks dropped prompt_cache_key since #182844, so on OpenAI routes Advisor reviews missed the cache on 46 of 205 team reviews and rewrote the full forked context. Connection custody never depended on the key: forks use their own WebSocket and leave the parent's continuation untouched. Send the running attempt's exact key, or the session's default sessionId:boundaryCount key for completed sessions. cacheRetention none still suppresses the key. Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR preserves the running parent's prompt-cache key for session forks and derives the default session key for completed-session forks. Example: Fork completed OpenAI session fork-openai at boundary count 0.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR restores fork cache metadata through existing owners, with one documentation correction needed and no introduced runtime defect found. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAdvisor and plugin side questions use the existing fork path to reconstruct live or persisted conversation context, send a tool-free provider request, and return text and usage. flowchart TD
A[Advisor or plugin side question] --> B[Session read authority]
B --> C[Live attempt or persisted transcript]
C --> D[Fork context and cache key]
D --> E[Independent provider request]
E --> F[Text and usage]
Technical reviewBest possible solution: Preserve the existing fork isolation while restoring cache metadata, and describe its routing or accounting role according to the model. Do we have a high-confidence way to reproduce the issue? Current main explicitly deletes prompt_cache_key, and the author reports matching regressions failing on main; that establishes metadata omission, but not its causal contribution to the reported cache misses. Is this the best way to solve the issue? The implementation reuses the existing attempt and session-boundary owners, preserves independent requests, and needs no persistent state; its claimed routing benefit should be qualified by model. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ecbad2efa1d7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +23, Tests 0, Docs +3. Total +26 across 12 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 12:01 PM ET / 17:01 UTC. |
Co-authored-by: obviyus <[email protected]>
|
Closing. On GPT-5.6+ OpenAI routes cached prefixes automatically and prompt_cache_key only separates cache accounting (docs/reference/prompt-caching.md), so restoring it for forks is not an established fix for the observed Advisor cache misses. #182844's omission stands. We'll measure misses with the cacheWrite logging from #196704 before proposing anything here. |
What Problem This Solves
Session forks (Advisor reviews,
/btw,forkSession) stopped sendingprompt_cache_keyin #182844. Normal turns send it.On the team Gateway (
openai/gpt-6.1-sol), 46 of 205 Advisor reviews today reportedcacheRead=0. Each one is a fork of a conversation of about 20k–200k tokens, so a miss re-processes the whole context. On Anthropic, Peanutto missed on 2 of 166 reviews.What restoring the key does and does not promise: on models before GPT-5.6 the key helps OpenAI route to the cached prefix. On GPT-5.6 and later, including the team route, it separates cache accounting and OpenAI routes automatically (prompt caching); earlier live observations saw new sessions start cold with or without a shared key. So this change restores the parent's cache identity for forks, but it is not an established fix for the team route's misses. Whether it changes that miss rate is unmeasured.
Why The Key Was Safe To Restore
#182844 removed the key because a rebuilt fork doesn't share the parent's complete request preparation. Isolation doesn't depend on the key:
independentResponsesRequest. The ChatGPT WebSocket path then acquires a socket with no session id, so a fork never consumes or replaces the parent's cached continuation.llm-idle-timeout.codex-ws-chain.test.tsshows this with the key now sent: the fork uses its own socket ([2, 1]sends per socket), the parent's next request still continues fromresp_native_1, and the fork carries noprevious_response_id.Change
promptCacheKey(new optionalpromptCacheKeyon the live fork-context snapshot).resolveSessionBoundaryPromptCacheKey(<sessionId>:<compaction boundary count>), the same derivation normal turns use.session-fork.tsno longer deletesprompt_cache_keyfrom the payload.src/sessions/session-fork-context.types.ts, and the tool-schema projection moves torun/session-fork-tools.ts.docs/plugins/sdk-runtime.mddescribes the new behavior and its limit.Known Gaps
finalization:<runId>) is not recorded after the run ends. A fork of a completed session falls back to the default key. Forks of a running parent get the exact key.cacheWriteto Advisor's usage log, so the team miss rate can be compared once the team Gateway runs a release with both changes.Evidence
cacheRetention: "none"still suppresses the key. I ran the real OpenAI Responses fork test temporarily withcacheRetention: "none": both the parent and the fork, including a fork of a running parent, sent noprompt_cache_key. The tests use"short", and that change wasn't committed.replay.prompt_cache_key === original.prompt_cache_key. Onmainthey fail (undefined).pnpm tsgo:coreandpnpm tsgo:core:testpass; oxlint is clean; the test-lines and line-cap ratchets pass.