Repository navigation
A model stream that breaks part way says the connection dropped, with Carry on - #2896
Open
davidmckayv wants to merge 1 commit into
Open
davidmckayv wants to merge 1 commit into
davidmckayv wants to merge 1 commit into
Conversation
… Carry on
When a provider's stream broke after the answer began (a reset socket part way through a tool
call's arguments), the LangGraph (TypeScript) engine ended the run with "The Bot stopped before it
finished answering. Try again.", and the LangGraph (Python) engine said OpenBot couldn't reach the
model, which had already answered part way. Both now end the run with "Connection dropped
(ECONNRESET) before <provider> finished answering.", coded so the server reads it as a dropped
connection: the person reads that the connection to their model dropped, with Carry on, and an
unattended task tries again by itself.
A Bot in Python that passes on httpx's or the OpenAI SDK's own words for the same ("Connection reset
by peer", "peer closed connection without sending complete message body", "Connection error.") now
gets the same notice in the app, with Carry on, instead of the raw words.
davidmckayv
marked this pull request as ready for review
December 3, 2026 20:52
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 3, 2026 20:52
This branch has not been deployed
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.
What this changes
Found on OpenBot Cloud (1.2.9, Desktop connected to Cloud). A Bot on GPT-6.1 Terra said "I'll make a short call deck…" and started a Google Slides call. About 44 seconds in, while it was still writing the deck into that call, OpenAI's stream broke: the model gateway logged the stream ended by the provider, and 4 ms later the engine's fetch threw
TypeError: terminated, caused byread ECONNRESET. The Slides action never ran. The person read "The Bot stopped before it finished answering. Try again.", with no Carry on. That told them nothing about what happened.The cause was a single upstream reset, the only one in about 1,260 Responses streams on Cloud that day. Providers drop streams like this now and then, and OpenAI's own Codex client retries them. What was ours is what the person read. OpenBot already has the right ending for this ("The connection to OpenAI dropped. Ask the Bot to carry on." with Carry on, and an unattended task tries again by itself). The engines just never said the connection had dropped:
terminated,ECONNRESET,UND_ERR_SOCKET, "other side closed") now ends the run withConnection dropped (ECONNRESET) before <provider> finished answering., codeOPENBOT_MODEL_REFUSED, categoryunknown. It used to end with the genericRUN_FAILEDline. The category is notserver_erroron purpose: behind the sign-in proxy that category would decide, and the person would be told the provider is having problems. The engine now logs the error itself for a dropped connection, rather than "refused".APIConnectionError("Connection error.")around httpx'sReadErrorfor a stream reset while it reads. The engine took that for a model it couldn't reach, and told the person to check the model's address, even though the model had already answered part way. A connection that broke while reading (ReadError,RemoteProtocolError,WriteError) is now a dropped connection, never "couldn't reach".The Claude Agent SDK engine already said this in Claude Code's words ("API Error: Connection dropped (ECONNRESET)"), and connected Bots that pass on Node's fetch words already got the notice.
Where it runs
Boundary and audit
API and database
api/, no app's requests, no database change and norelease-policy.json.Changelog
Chat and Bots.
Proof
Red before, green after. The new tests were run against main's source, then against this branch:
/v1/responses(the exact Cloud path: a line, aGOOGLESLIDES_CREATE_SLIDES_MARKDOWNcall with a 40-slide deck in its arguments, then a TCP reset), and the next run answersOPENBOT_MODEL_UNREACHABLE("couldn't reach the AI model")stopped-turn.test.ts)The resets are real: the test provider writes the stream up to the call's arguments and then resets the TCP connection (
resetAndDestroy,SO_LINGER 0), so the engine readsECONNRESETthrough the real SDKs, as it did on Cloud. The test gateway now breaks its answer when the provider's stream breaks, as the real gateway does. Withpipealone, the engine waited forever.Whole suites: TS engine 114 pass (3 live-only skipped), typecheck clean. Python engine 259 pass. The 2 that fail (
test_chatgpt_token_provider_atomic_writer_*, file mounts) fail the same way on main on this Mac. Appstopped-turn11 pass.End to end, Chrome (Chromium) and Safari (WebKit). This ran on a throwaway box with the real product: the server, the LangGraph (TypeScript) engine and the web app, each built from the OpenBot ref under test, with a local Intelligence. The model was reached through aimock. For one marked message, aimock streams a line and a
GOOGLESLIDES_CREATE_SLIDES_MARKDOWNcall in OpenAI's own Responses format, then destroys the socket in the middle of the call's arguments. Every other request goes to the real OpenAI. Steps: a new Bot, send the message, read the notice, reload, press Carry on.