🤖 fix: allow interrupt during stream startup#1536
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df524048ba
ℹ️ 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".
df52404 to
22cac8f
Compare
|
@codex review Addressed the startup-interrupt race by honoring already-aborted signals before atomic stream creation, plus a unit test that aborts during temp-dir creation to ensure we never emit stream-start / start streaming. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfe9be15f0
ℹ️ 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".
|
@codex review Refactored stream startup abort handling to be race-free by construction:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fe42157f1
ℹ️ 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".
0fe4215 to
85620d8
Compare
|
@codex review Addressed the mock-mode startup abort edge case:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e08c9e76c9
ℹ️ 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".
|
@codex review Also addressed the real-stream pre-start abort case in AIService:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3395287fc8
ℹ️ 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".
|
@codex review Handled the "abort during StreamManager startup" case:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 302889138e
ℹ️ 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".
What
Allow interrupt (Esc / Ctrl+C) to cancel a message while the UI is still in "Starting..." (i.e., before
stream-start).Why
Previously, interrupts were gated on
canInterrupt/StreamManager.isStreaming()(active StreamManager stream). If a send was blocked during init/runtime setup, there was no active stream to stop, so the UI could get stuck in "Starting..." with no way to cancel.Also, cancelling during this pre-start window could leave an empty assistant placeholder persisted in
chat.jsonl.How
Frontend:
pendingStreamStartTimeas interruptible for keybind interception.pendingStreamStartTimeonstream-abort(abort can arrive beforestream-start).Backend:
linkAbortSignal()helper for consistent abort-signal bridging.AIServiceand allowstopStream()to abort startup work before StreamManager registers a stream.stream-abortwhen cancelling during pending-start so the renderer can exit the "Starting..." UI immediately.HistoryService.deleteMessage()removes the placeholder without truncating subsequent history.StreamManager.startStream()to use a derivedAbortController+ structured cleanup (temp dir, unlink abort listener).stream-startafter an interrupt without a corresponding abort/end.Tests
make static-checktests/ipc/interruptStream.starting.test.ts(requiresTEST_INTEGRATION=1+ANTHROPIC_API_KEY)src/node/services/historyService.test.ts(deleteMessage)src/node/services/mock/mockAiStreamPlayer.test.ts(placeholder cleanup on abort)Generated with
mux• Model:openai:gpt-5.2• Thinking:xhigh• Cost:$46.85