Repository navigation
Conversation
A Main request that overflows records its source failure and leaves the attempt open; the driver then writes ModelInterrupted from the failed stream, and only an interrupted attempt may take ContextOverflow recovery. When that interruption is not written (the publish loses a revision race and returns Ok(false), or the driver retires before writing it), reconcile sees an open attempt with no live model work and assesses it first. The assessment records ContextOverflow, fold rejects it with "context overflow requires an original interrupted model attempt", and the Run fails instead of compacting. A captured source failure proves the stream ended, so there is nothing left to observe. Reconcile now interrupts such an attempt before assessing it, the same order the live driver uses. Refs apache#7111 Generated-by: Claude Code
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #7143, which GitHub closed when
rust-previewwas deleted after the switch tomain. Rebased ontomain(73f2333), wherecargo nextest run -p maka-agent-engine -E 'test(/reconcile::/)'passes (20 tests, including the new one). The other results below are fromrust-preview.Summary
Refs #7111 (the race reported in this comment, not the summary failure the issue is about).
A Main request that overflows records
ModelSourceFailureCapturedand leaves the attempt open. The driver then writesModelInterruptedfrom the failed stream, andfoldacceptsContextOverflowrecovery only on an interrupted attempt. If that interruption is never written, reconcile finds an open attempt with no live model work and runs the restart path, which assesses first. The native adapter assesses the captured overflow asContextOverflow,foldrejects it, and the Run fails instead of compacting:The interruption can go missing in two ways, both found by reading the code:
Engine::publishreturnsOk(false)onRevisionConflict, and nothing retries it.retiringbranch removes the model work without writing the interruption, and the next driver starts from durable state.A captured source failure proves the stream ended, so there is nothing left to observe. Reconcile now interrupts such an attempt before assessing it, the same order the live driver uses. The normal path is unchanged: the completion handler still writes the interruption with the real error text before reconcile runs again.
Verification
reconcile::tests::an_overflow_whose_interruption_was_not_recorded_still_recoversbuilds that state (overflow captured, no interruption, no live work) and applies reconcile's actions throughfold. Without the fix it panics withInvalidTransition("context overflow requires an original interrupted model attempt"); with the fix the attempt ends as a compactable overflow.ModelInterruptedpublish for overflow errors (simulatingOk(false)) and rancontext_overflow_after_partial_output_compacts_and_continues:Error: Elapsed(()), the same failure as in bug(agent): a conversation fails on every turn once the summary after a context overflow fails #7111;cargo nextest run -p maka-agent-engine --lib: 34 passed.cargo nextest run -p maka-agent-native --lib: 204 passed, two runs.cargo clippy -p maka-agent-engine --all-targetsandcargo fmt --all -- --checkare clean.I could not trigger the race without the temporary patch on
cc879c1cd(macOS, 15 cores): 36 parallel runs of the test alone, onenextestrun and six full-suite runs (one process per test, 15 at a time) were all clean for this test.cell_notifications_deduplicate_child_knowledge_per_step_cut, also noted in #7111, failed in 5 of those 6 full-suite runs; this PR does not change it.AI use
Tool(s) and scope: Claude Code traced the failure, wrote the fix and the test, and ran the reproductions above.
Checklist
Does this PR entail a change in behavior?