Skip to content

[fix] A live-route repair no longer clears every other eviction check - #6372

Open
mmabrouk wants to merge 2 commits into
feat/credential-preflightfrom
fix/live-route-scoped-repair
Open

[fix] A live-route repair no longer clears every other eviction check#6372
mmabrouk wants to merge 2 commits into
feat/credential-preflightfrom
fix/live-route-scoped-repair

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Found by the cold/warm code audit that followed #6364. The coordinator computed the eviction reason with an else-if chain (config first), and a successful live model route then set mismatch = undefined wholesale. The repair answered one question and cleared the answers to all of them. Proven with a test harness, warm reuse (acquire == 1) in every case:

  • a model switch riding an edited transcript continued warm on a native conversation that still held the unedited turn, so the model answered text the user had deleted;
  • riding a rotated credential with no delivery port, the turn ran on the old baked key, silently if the old key still worked;
  • riding an expiring mount lease, the turn ran under a mount about to lose its credentials;
  • riding a stale tail, the tail check was skipped.

The claude live route has been exposed since step 6 shipped. #6364 makes the route fire for pi_core too, so this fix belongs in the same stack.

Changes

Before: one mismatch value from an else-if chain; a successful repair cleared it entirely.

After: the ordered checks live in one firstMismatch() function; each repair door (the live config route, the credential delivery route) marks its own reason repaired and asks again. The remaining reasons keep their order and their semantics. A model switch with a deliverable rotation chains both repairs and stays warm; any unrepaired reason still evicts.

One accepted cost: when a model switch rides a bad pairing, the in-place apply happens before the other mismatch is discovered, on an environment that is then destroyed. A wasted setModel on a doomed sandbox is harmless; the warm reuse was not.

Tests

  • Four new cases pin the bad pairings (edited transcript, undeliverable rotation, stale tail rebuild; deliverable rotation plus model switch chains and stays warm, with the delivery and the apply both asserted).
  • Full runner suite green (157 files / 2579 tests), typecheck clean.

Stacked on #6370.

https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 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 Aug 31, 2026 2:57pm

Request Review

@dosubot dosubot Bot added the bug label Aug 29, 2026
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

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

🗂️ Base branches to auto review (1)
  • release/.*

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: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b99da493-a20f-4ca0-b854-3ddb5569f529

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

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.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

📘 Docs preview

Status ✅ Ready
Preview https://pr-6372-agenta-docs-preview.mahmoud-637.workers.dev/docs
Inspect Actions run
Commit 1deffd79f4a7f6d690ac47e7338724616932c3f3

This comment updates in place on every push.

Found by a code audit of the cold/warm flows (follow-up to #6364). The
coordinator computed the eviction reason with an else-if chain and the
live model route then set mismatch = undefined wholesale, so a repair of
the CONFIG question also cleared every question the chain never reached:

- a model switch riding an EDITED transcript continued warm on a native
  conversation still holding the unedited turn;
- riding a ROTATED credential with no delivery port, it ran on the old
  baked key (silently, if the old key still worked);
- riding an EXPIRING mount lease, it let the turn die under the mount;
- riding a stale tail, it ran a turn the tail check should have evicted.

The claude live route has been exposed since step 6 shipped; #6364 makes
the route fire for pi_core too, widening the surface, so this belongs in
the same stack.

Each repair door now marks ITS reason repaired and re-asks the ordered
checks. A model switch with a deliverable rotation chains both repairs
and stays warm (pinned); the four bad pairings rebuild (pinned).

Claude-Session: https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt
Finding 1 is fixed in this branch; findings 2-8 are queued with their
cheapest standing check named, so the record survives the session that
produced it.

Claude-Session: https://claude.ai/code/session_014s6jqKCsVKsNMmnrJVJkZt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant