Repository navigation
fix: finish Messages rounds at message_stop - #290
Merged
franciscojavierarceo merged 1 commit intoSep 12, 2026
Merged
franciscojavierarceo merged 1 commit into
franciscojavierarceo merged 1 commit into
Conversation
Signed-off-by: Chuyue Wang <[email protected]>
StevenWang-CY
requested review from
bbrowning,
franciscojavierarceo,
haoshan98,
jiahuei,
leseb,
maralbahari,
noobHappylife,
qandrew and
tjtanaa
as code owners
September 12, 2026 15:49
franciscojavierarceo
approved these changes
Sep 12, 2026
This was referenced Sep 15, 2026
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
Executor-managed
/v1/messagesstreams suppress the upstreammessage_stopand keep waiting for HTTP EOF. If an upstream leaves the body open after its final event, the gateway withholds the final usage/stop and eventually emits a chunk-timeout error; with idle timeouts disabled, it hangs. A completed built-in tool round is similarly prevented from advancing. Anthropic definesmessage_stopas the final streaming event.Mark the existing per-round state complete at
message_stop, stop reading that round, and explicitly drop its upstream body before final delivery or tool execution. Preserve the single public message lifecycle, current clean-EOF compatibility, pre-terminal errors, client-tool ownership, and configured idle timeouts. The change is confined to the native Messages streaming loop; it adds no public API, configuration, dependency, schema, or persistent state.Test Plan
4497095, the identical final regression file produces seven intended completion failures and five passing controls. The patch passes all 12 tests, covering core and real HTTP completion, empty/token-limited messages, fragmented UTF-8/CRLF/no-space data, duplicate/trailing events, malformed/missing terminals, pre-terminal errors, mixed tool ownership, cancellation, and disconnect.message_stop. Verify one visible lifecycle, final text and usage, contiguous indexes, successful real local search, the complete assistant turn and signature plus paired tool result in the actual second upstream request, independent-request recovery, body release, and zero Messages database writes. A missing-body-drop mutant fails this test.b6ded3bfrom a clean worktree: formatting, locked workspace compile and Clippy across all targets/features, all pre-commit hooks, and 1,372 Rust tests pass (nine existing ignores). Run the eight PostgreSQL tests separately against an isolated database; all pass and the database stops cleanly.The existing cassette payloads are reused without changes; the harness supplies the open-body transport condition. No fresh live-model, GPU, cross-platform runtime, or performance validation is claimed.