Repository navigation
fix(devin-cli): do not write to a cancelled stream when the client disconnects - #16607
Merged
diegosouzapw merged 3 commits intoOct 15, 2026
Conversation
…sconnects The devin-cli executor streams from a spawned devin acp child. When the client disconnects, the response body is cancelled and the abort signal kills the child, whose close handler then called controller.enqueue() and controller.close() on a cancelled stream. That throws ERR_INVALID_STATE inside a ChildProcess listener, an uncaught exception that takes down the server and every other stream in flight. Define cancel() to mark the consumer gone and stop the child, and guard enqueue/close.
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Oct 15, 2026
5c60bd8
into
cheaper-inference:release/v3.8.52
46 of 60 checks passed
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
closehandler callscontroller.enqueue()/controller.close()on a cancelled stream. That throwsERR_INVALID_STATEinside aChildProcesslistener, an uncaught exception that can take down the server and every other stream in flight.ReadableStreamhas nocancel(); the abort listener only kills the child, and the child'sclosehandler then writes to a controller whose consumer is gone.Related Issues
devin-climatches only fix(devin): surface CLI auth and include auto-routing #15446, fix(authz): let remote dashboards validate provider keys #16449, fix(sse): derive the auto-combo noauth pool from emulated tool calling #16436 and fix(authz): let a tunnel-served dashboard verify and add provider API keys #16023, which touch other files).Target Branch
release/v3.8.xbranch (the highest openrelease/v*), notmainProof Of Fix (required)
tests/unit/devin-cli-client-disconnect.test.ts(node as the fakeacpCLI, the same trick asdevin-cli-fallback-spawn-local-only-15159.test.ts)Tests Added Or Updated
tests/unit/devin-cli-client-disconnect.test.ts: the client cancels the body and aborts the signal mid-stream; the test asserts that nouncaughtExceptionfires.Coverage Notes
cancel()and the guardedenqueue/closeindevin-cli.ts; the neighbouring devin unit tests keep passing.Scope
devin-cli.ts, the test and the changelog fragment)Validation
check:ai-attribution,check:changelog-integrityandcheck:file-sizepassnpm run lint(the repository-wide run is left to CI; eslint reports oneno-unused-varsonProviderCredentialsindevin-cli.tsthat is already on the base)Reviewer Notes