RunanywhereAI / RunanywhereAI/wally
Reject incomplete upstream SSE instead of emitting message_stop
@sanchitmonga22 is already working on this.
Since Sep 12, 2026.
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 86
- Avg merge
- 6h 53m
- Merged PRs (30d)
- 50
Description
Overview
Impact: High. Priority: P1. Estimated effort: Small/Medium.
An upstream HTTP200 event stream that ends cleanly after partial output, without a finish reason or [DONE], becomes a successful Anthropic end_turn / message_stop. The editor can accept a truncated answer or partial tool arguments as a normal completion.
Current state and reproduction
Audited main 093cd44806ec64b2c79b42b557b4856259d2ea58:
[DONE]is ignored instead of recorded.- Any successful HTTP completion invokes StreamClose.
- Missing finish reason defaults to successful end_turn.
Hermetic loopback test compiled unchanged messages.cpp, translate.cpp, and loopback_auth.cpp with repo-pinned cpp-httplib0.46.1/nlohmann3.11.3; only output/state-directory functions stubbed. Mock upstream returned HTTP200, content-type text/event-stream, exactly this body and a clean HTTP end:
data: {"id":"x","choices":[{"delta":{"content":"partial"},"finish_reason":null}]}
Authenticated downstream /v1/messages requested stream:true. Actual output assertion:
TRUNCATED_WITHOUT_DONE status=200 success_stop=1 error=0
success_stop checks event: message_stop; error checks event: error. This is clean HTTP EOF with an incomplete inference protocol, not a TCP read failure. No real API/production traffic used.
Proposed solution and implementation
- Track protocol terminal state independently of HTTP transport success.
- Require the documented upstream terminal condition before emitting a successful Anthropic close.
- Surface incomplete streams as typed errors, retaining partial output only as partial output.
- Do not flush incomplete buffered tool arguments as executable tool use.
- Add tests for empty EOF, partial text EOF, partial tool JSON EOF, missing/malformed terminal frame, and normal finish/usage/DONE ordering.
Success criteria
A clean transport EOF before valid inference termination never creates a successful message_stop or executable incomplete tool call. Valid completed streams still produce exactly one message_stop and final usage. Public API fault injection remains deferred until API access is supplied.
Related: #82 modifies this stream transport. This issue adds no release-blocker label; release triage is deferred.
Implementation handoff (2026-09-13)
PR #104 implements this issue; it remains open for acceptance. Merge order: #82 -> #103 -> #104. Current PR104 base is codex/issue83-stream-overload; after PR103 merges, rebase only PR104's commits and retarget to main. Siddhesh owns the merge. Full validation, rationale, limitations and remaining packaged/live checks are in PR104 and the implementation report.
Implementation and merge status
Implemented in PR #104 at ea4eb4ac2bec2f8eb596e760fd1df9a300c73417; final independent published-head review found no unresolved blocking findings. See the final review comment for exact tests and remaining platform/live acceptance. Keep this issue open.
Merge owner: @Siddhesh2377. Sequence: #82 → #103 → #104, ultimately main. Rebase and retarget dependent PRs after prerequisites merge, then rerun checks. Nothing has been deployed by this implementation work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.