Repository navigation
fix(mcpl): withdraw a batch-only turn whose batch is gone, rendering elsewhere, or queued for another agent #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nissa-seru
merged 9 commits into
anima-research:main
from
nissa-seru:fix/coalescing-batch-turn-content
Oct 18, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1c49cbd
fix(mcpl): a batch-only turn whose batch is gone, rendering elsewhere…
16b5c87
fix(mcpl): keep isUnreadPlacement as it was; isStoredUnreadPlacement …
c5e94b7
Merge main (d1b9d35c8) into fix/coalescing-batch-turn-content
7d00a52
fix(mcpl): a batch has one consumer, even when two residents' assembl…
ec241c7
fix(mcpl): a wake to read a queued render outlives withdrawals of its…
36940ce
fix(mcpl): the quiesce park keeps a reader's wake apart from its subj…
88edb1a
fix(mcpl): answer Greptile's review of #520: provider retries, shards…
be014f4
fix(mcpl): an ordinary wake for a render's queue agent; a turn's trig…
b553239
fix(mcpl): answer af-f103-f104-r4: a merged wake carries a subject on…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - `getActiveTurnTrigger` returns the trigger of a turn that a coalesced batch woke without the host-owned `coalescingSubject`, `coalescingBatch` and `coalescingBatchSubjects` while that turn is retried: an in-turn retry, a provider hold's release, a requeue behind an auxiliary call, or the tool-result guard's restart. Those fields identify a wake for withdrawal while it is unconsumed, and a retry belongs to a turn that has already passed its batch gate. A turn whose merged wakes don't all share one subject shows no `coalescingSubject` either. Its other fields, such as `reason`, `source`, `channelId` and `counterparty`, are as before. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - A turn woken only by deferred coalescing batches is withdrawn before inference in more of the cases where it used to call the model with nothing new to read: its batch was retracted or replaced after the wake was taken (the replacement or the retraction's notice wakes agents as any push does, by its own `triggerInference`), its batch was being rendered for another agent's assembly (the turn waits for that render, which the other agent's request reads), or the render was placed in another agent's deferred queue because that agent's turn was running. In that last case that agent is now woken for the render, as the batch's own wake would have woken it; before, nothing woke it for the render. When several agents are woken for one batch, the first assembly consumes it, and the others' turns already taken from the queue are withdrawn, as their still-queued wakes already were. A turn woken by a batch that a provider hold kept after its call failed is now retried with its own trigger when the hold ends, even if a newer batch of its subject arrived meanwhile. Before, the newer batch withdrew it, and the agent's next turn came from the newer batch's wake or, with nothing left held, from a fresh compile that names no channel or author. | ||
| - When one agent's queued wakes merge into one turn, the turn's trigger now carries a coalescing subject only when it is every merged wake's, so a withdrawal of that subject's wakes, such as a retraction's or a newer batch's, takes the merged wake only when that subject was its sole cause. Before, the merged trigger carried its first wake's subject, and such a withdrawal, landing while the merged wake was held or requeued before its turn started, also dropped the wake's other causes, such as an ordinary message. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a batch-only turn renders its batch, a retryable provider limit saves the original trigger and later returns it to the scheduler. That start uses
attempt = 0and still hascoalescingBatchSubjects, so this new gate assembles it again. Its batch is already gone,freeze()returns'declined', and the turn is withdrawn instead of retried. The agent can therefore stop without answering after the provider wait ends.Keep retained provider retries separate from fresh batch-only wakes.
Knowledge Base Used:
Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in
be014f40. Once a turn passes the batch gate,beginAgentTurngoes on with a copy of its trigger without the batch wake's marks (coalescingSubject,coalescingBatchandcoalescingBatchSubjects). A provider hold keeps that copy, and so does every other way a retry comes back, so on release the retry is an ordinary wake: the gate doesn't withdraw it, and no withdrawal of the subject's wakes reaches it. Two tests fail at36940ce4and pass here: "a batch-only turn whose call a provider's capacity limit held is retried when the hold ends, not withdrawn", and "a turn a provider hold kept is retried though another resident's request consumed a newer batch of its subject meanwhile".— Gideon-2613