Repository navigation
fix: keep an input dequeued by a cancelled append session attempt - #162
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
sgbalogh
marked this pull request as ready for review
November 24, 2026 21:55
[Medium impact] Safe to merge; the fix closes the cancellation gap without changing batch order. SummaryThe fix keeps a batch that leaves the queue just before an append attempt is cancelled.
Reviews (1) · Last reviewed commit: "fix: keep an input dequeued by a cancell..." · Reviewed by Greptile |
…e test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
An append session could silently drop a batch when an attempt ended (terminal error, connection loss) and was retried.
_body_genwaits for the next input in a helper task (input_queue.get()). When the attempt ends, the body sender is cancelled. If the helper task had already taken an input off the queue but_body_genhad not yet added it toinflight_inputs(it awaits the helper tasks' cleanup in between), the input was in neither place and was never sent or resent.Effects of one dropped batch:
Fix: the wait moves into
_dequeue_input, which hands the input over throughsession_state.dequeued_input, set in afinally._body_gentakes it from there, in this attempt or the next one.Reproduced with one session submitting 400 batches/s for 10s against a server that ends the session with
rate_limitedabove 200 batches/s (16 attempts per run): before, 4 of 4 runs ended with 2-5 batches missing from the stream; after, 10 of 10 runs appended all 4,000 in order.Link to Devin session: https://app.devin.ai/sessions/e371e3cfedbd4e688000fe6c297d8e57
Open in Devin Desktop: https://app.devin.ai/desktop/session/e371e3cfedbd4e688000fe6c297d8e57?variant=devin
Requested by: @sgbalogh
🟢 Devin Review found nothing to fix · View findings