fix(runner): keep the warm session when the client sends a minimal history#5490
fix(runner): keep the warm session when the client sends a minimal history#5490mmabrouk wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…story The keep-alive check fingerprints the prior conversation the client sent and compares it against what the previous turn stored. A last-message-only client sends no prior conversation, so the fingerprint is of an empty array and can never match. Every conversation was evicted to cold on every turn after the first. Measured on a three-turn run, turn 2 went from 1570ms to 4623ms while the suite still reported a pass, because a cold turn is still faster than the first. Skip the history comparison when the request carries only its own fresh user turn. The session id already binds the request to the conversation; a minimal-history client simply no longer asserts it, so there is nothing to compare. Requests that do send a history are still checked exactly as before, including the approval-resume path, which always sends the full history. Claude-Session: https://claude.ai/code/session_01KM69J7uHafgciiN5zfG7qR
2f4cc5e to
b652316
Compare
6db5a80 to
66e70b6
Compare
Railway Preview Environment
|
The problem
With last-message-only on, every conversation ran cold from turn 2 onward. The warm-session optimisation was silently switched off for exactly the workload it was built for.
The keep-alive check fingerprints the prior conversation the client sent and compares it to what the previous turn stored. A last-message-only client sends no prior conversation, so
priorConversation(request)is an empty array and its fingerprint can never match. The check therefore failed on every turn:Three evictions in a last-message-only run, zero in the baseline. The cost is a sandbox torn down and rebuilt on every turn:
The QA journey still reported PASS throughout, because it only checks that later turns beat the first one, and a cold turn still beats a cold turn that also had to create the sandbox.
This is the "cold evicted" state as distinct from plain cold: a warm sandbox existed and was thrown away.
The fix
Skip the history comparison when the request carries only its own fresh user turn, using the shared
carriesMinimalHistorypredicate from the PR below.The comparison exists to catch a client that rewound or edited the conversation under an existing session id. A minimal-history client makes no claim about the conversation at all, so there is nothing to verify; the session id already binds the request to it. Requests that do send a history are checked exactly as before, and so is the approval-resume path, which always sends the full history.
Before / after
Turn 2 of a three-turn conversation returns to 1834 ms, in line with the full-history baseline, and the run shows zero evictions.
Testing
New dispatch test asserts a minimal-history turn 2 keeps the live environment and triggers no cold re-acquire. Full runner unit suite green. Verified live: QA results.