🤖 fix: cascade interrupt descendants without deleting workspaces#2539
🤖 fix: cascade interrupt descendants without deleting workspaces#2539
Conversation
Switch cascading parent hard interrupts from destructive termination to non-destructive interruption for descendant agent task workspaces. - stop descendant streams and reject pending waiters - mark descendant tasks as interrupted instead of removing workspaces - keep descendant workspace metadata/session available for inspection - update schemas/tool status enums to include interrupted - make waitForAgentReport fail fast for interrupted tasks --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e2a403c19
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address Codex feedback for non-destructive interrupt cascades by restoring interrupted descendant task workspaces to running on successful sendMessage/resumeStream. This ensures stream-end finalization runs normally for resumed tasks so agent_report handling and task_await completion continue to work. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5a80e3fc7
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Only restore interrupted descendant task status to running when resumeStream reports started=true. If started=false (session still busy), retain interrupted state so task_await keeps fail-fast semantics. Adds regression tests for started=true and started=false resume behavior. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8836ea637
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Guard markInterruptedTaskRunning with a pre-check so it exits before editConfig unless the workspace is actually an interrupted descendant agent task. This keeps send/resume hot paths from triggering unnecessary config writes for normal workspaces. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 608b7c2493
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Move interrupted descendant task transition to running before calling AgentSession send/resume methods, and rollback to interrupted when send/ resume fails or resume starts no stream. This preserves fail-fast interrupted semantics while allowing resumed tasks to finalize through stream-end/report handling. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a6a6b611b
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
For interrupted descendant tasks, transition to running before queue checks so queued retries don't bypass lifecycle restoration. Also restore interrupted status on thrown send/resume failures to avoid leaving tasks in phantom running state when no stream actually resumes. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f805d68741
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Keep interrupted tasks from being auto-queued while still busy to avoid flipping to running before a new stream can actually start. Also retain rollback coverage for send/resume throw paths and add regression tests for interrupted busy-task behavior. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a60495cc2e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- block busy interrupted resume attempts up-front in resumeStream - preserve queued taskPrompt when cascading interrupts mark descendants interrupted - add regression tests for busy interrupted send/resume handling and queued prompt preservation --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d55909727
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ions Keep taskPrompt intact when transitioning interrupted tasks to running so failed/no-op resume attempts can restore interrupted state without losing the original queued task intent. --- _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.65`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.65 -->
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
mux/src/node/services/taskService.ts
Lines 1205 to 1207 in 129448c
When terminateAllDescendantAgentTasks aborts each descendant via aiService.stopStream(...) but now keeps the workspace instead of removing it, any queued messages in that descendant session can still be auto-flushed on stream end (AgentSession calls sendQueuedMessages() in stream-end cleanup). In that case, a supposedly interrupted descendant can immediately start a new turn and continue spending tokens, which breaks the hard-interrupt cascade semantics. This occurs specifically when a child task had pending queued input at the time the parent was hard-interrupted.
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review\nPlease take another look at the queued-message interrupt path fix. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78a0a890e2
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review\nAddressed the repeated-interrupt queued prompt preservation issue. Please re-review. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Switch parent hard-interrupt cascade behavior from destructive termination to non-destructive interruption for descendant agent task workspaces.
Background
We recently added cascading interrupts from parent workspaces to descendants. The initial implementation removed descendant workspaces entirely, which made interruption destructive and prevented users from inspecting child workspace state after a stop.
Implementation
WorkspaceService.interruptStream, but update behavior/logging to treat descendants as interrupted.TaskService.terminateAllDescendantAgentTasksto:abandonPartial: true)Parent workspace interruptedtaskStatus: "interrupted"interrupted.waitForAgentReportfail fast withTask interruptedfor interrupted tasks.handleStreamEndto no-op interrupted tasks.Validation
bun test src/node/services/taskService.test.ts -t "terminateAllDescendantAgentTasks|waitForAgentReport rejects interrupted"bun test src/node/services/workspaceService.test.ts -t "interruptStream"bun test src/node/services/tools/task_list.test.ts src/node/services/tools/task_await.test.tsmake typecheckmake static-checkRisks
interrupted).Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$0.65