Skip to content

fix: keep an input dequeued by a cancelled append session attempt - #162

Merged
sgbalogh merged 2 commits into
mainfrom
devin/1795554771-append-session-lost-input
Nov 24, 2026
Merged

sgbalogh merged 2 commits into
mainfrom
devin/1795554771-append-session-lost-input

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An append session could silently drop a batch when an attempt ended (terminal error, connection loss) and was retried.

_body_gen waits 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_gen had not yet added it to inflight_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:

  • the batch is never appended,
  • every later ticket resolves with the ack of the batch after it,
  • the last ticket never resolves, with nothing in flight and so no ack timeout.

Fix: the wait moves into _dequeue_input, which hands the input over through session_state.dequeued_input, set in a finally. _body_gen takes 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_limited above 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

Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@sgbalogh
sgbalogh marked this pull request as ready for review November 24, 2026 21:55
@sgbalogh
sgbalogh requested a review from a team as a code owner November 24, 2026 21:55

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] Safe to merge; the fix closes the cancellation gap without changing batch order.

Summary

The fix keeps a batch that leaves the queue just before an append attempt is cancelled.

  • Append sessions keep a batch when an 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>
@sgbalogh
sgbalogh merged commit 553eb17 into main Nov 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant