Skip to content

fix(runner): keep the warm session when the client sends a minimal history#5490

Open
mmabrouk wants to merge 1 commit into
fix/sessions-no-duplicate-promptfrom
fix/sessions-keep-warm-session
Open

fix(runner): keep the warm session when the client sends a minimal history#5490
mmabrouk wants to merge 1 commit into
fix/sessions-no-duplicate-promptfrom
fix/sessions-keep-warm-session

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

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:

[keepalive] mismatch (history) key=...; evict + cold
[keepalive] mismatch (history) key=...; evict + cold

Three evictions in a last-message-only run, zero in the baseline. The cost is a sandbox torn down and rebuilt on every turn:

Baseline (full history) Last-message-only
Turn 2 1570 ms 4623 ms
Turn 3 1399 ms 4252 ms

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 carriesMinimalHistory predicate 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.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. Backend labels Jul 24, 2026
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 24, 2026 10:11pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c974a79-6379-4f1d-bafc-a06cc70c55ce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sessions-keep-warm-session

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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
@mmabrouk
mmabrouk force-pushed the fix/sessions-no-duplicate-prompt branch from 2f4cc5e to b652316 Compare July 24, 2026 22:10
@mmabrouk
mmabrouk force-pushed the fix/sessions-keep-warm-session branch from 6db5a80 to 66e70b6 Compare July 24, 2026 22:10
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Image tag pr-5490-19d8a02
Status Failed
Logs View workflow run
Updated at 2026-07-24T22:29:35.670Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant