fix: prevent SSE connection drops from silently truncating responses#7831
Merged
fix: prevent SSE connection drops from silently truncating responses#7831
Conversation
When the SSE connection drops mid-stream, the client was retrying the POST request indefinitely, creating duplicate agent tasks on the backend. PR 7830 tried to cap retries at 1, but this created a worse problem: the stream would end without a terminal Finish/Error event, making the truncated response appear successful. Fix this by disabling SSE retries entirely (sseMaxRetryAttempts: 0) on all three /reply call sites. POST requests should never retry because they create work on the backend. When a connection drops, we now detect the premature stream end and show a toast notification rather than a full-page error, keeping the conversation visible while alerting the user the response may be incomplete. Co-Authored-By: Claude Haiku 4.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29a94cc4a9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
jh-block
added a commit
that referenced
this pull request
Mar 12, 2026
Pass the AbortSignal to streamFromResponse so it can distinguish between user-initiated aborts and genuine connection drops. Only show the toast when the signal was not aborted. Addresses code review feedback from PR #7831. Co-Authored-By: Claude Opus 4.6 <[email protected]>
lifeizhou-ap
approved these changes
Mar 12, 2026
Pass the AbortSignal to streamFromResponse so it can distinguish between user-initiated aborts and genuine connection drops. Only show the toast when the signal was not aborted. Addresses code review feedback from PR #7831. Co-Authored-By: Claude Opus 4.6 <[email protected]>
96e3bdd to
901fb4e
Compare
4 tasks
michaelneale
added a commit
that referenced
this pull request
Mar 15, 2026
* origin/main: Remove include from Cargo.toml in goose-mcp (#7838) Exit agent loop when tool call JSON fails to parse (#7840) chore: remove redundant husky prepare script (#7829) Add github actions workflow for unused deps (#7681) fix: prevent SSE connection drops from silently truncating responses (#7831) doc: Added notes in contribution guide for pnpm (#7833) add prefer-offline to pnpm config to skip unnecessary registry lookups (#7828) fix: remove dead read handler from DeveloperClient (#7821) fix: prevent SageMaker TGI from being marked configured when only Bedrock keys are set (#7284) fix: disable some computercontroller functionality when no $DISPLAY detected (#7824) test(acp): align provider and server test parity (#7822) fix(acp): register MCP extensions when resuming a session (#7806) # Conflicts: # ui/desktop/src/hooks/useChatStream.ts
lifeizhou-ap
added a commit
that referenced
this pull request
Mar 16, 2026
* main: (191 commits) fix: add tool_choice and parallel_tool_calls to chatgpt_codex provider (#7867) fix: tool confirmation handling for multiple requests (#7856) Remove dead OllamaSetup onboarding flow (#7861) fix: resolve tokio::sync::Mutex deadlock in recipe retry path (#7832) Upgrade Electron 40.6.0 → 41.0.0 (#7851) Only show up to 50 lines of source code (#7578) fix: stop writing without error when hitting broken pipe for goose session list (#7858) feat(acp): add session/set_mode handler (#7801) Keep messages in sync (#7850) More acp tools (#7843) fix: skip upgrade-insecure-requests CSP for external HTTP backends (#7714) fix(shell): prevent hang when command backgrounds a child process (#7689) Remove include from Cargo.toml in goose-mcp (#7838) Exit agent loop when tool call JSON fails to parse (#7840) chore: remove redundant husky prepare script (#7829) Add github actions workflow for unused deps (#7681) fix: prevent SSE connection drops from silently truncating responses (#7831) doc: Added notes in contribution guide for pnpm (#7833) add prefer-offline to pnpm config to skip unnecessary registry lookups (#7828) fix: remove dead read handler from DeveloperClient (#7821) ...
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
When the SSE stream connection drops mid-response, the client was retrying the POST request indefinitely, causing duplicate agent tasks on the backend. PR #7830 capped retries at 1, but created a worse problem: the stream would end without a terminal
FinishorErrorevent, making truncated responses appear successful.This fix disables SSE retries entirely (
sseMaxRetryAttempts: 0) on all three/replycall sites, since POST requests should never retry (they create work). When a connection drops, we now detect the premature stream end and show a toast notification instead of a full-page error, keeping the conversation visible while alerting the user the response may be incomplete.Type of Change
AI Assistance
Testing
Manual testing needed to verify:
Related Issues
Related to #7830
🤖 Generated with Claude Code