Repository navigation
Conversation
snimu
marked this pull request as ready for review
July 17, 2026 18:38
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
kevinjosethomas
added a commit
that referenced
this pull request
Jul 20, 2026
snimu
force-pushed
the
fix/subagent-stop-ux
branch
from
July 22, 2026 09:50
b2d202c to
29bc998
Compare
snimu
force-pushed
the
fix/subagent-stop-ux
branch
from
July 22, 2026 10:59
29bc998 to
45c04b9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 45c04b9. Configure here.
snimu
force-pushed
the
fix/subagent-stop-ux
branch
from
July 22, 2026 11:22
45c04b9 to
ae977bc
Compare
Contributor
Author
|
Closing as superseded. All four problems this PR addressed have since been solved (or made moot) on main by the subagent-subsystem rework:
Verified per-problem with file:line evidence on current main (details in the review notes). Thanks — the ideas here all made it into the architecture, just via different routes. |
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.

Problem
Stopping a subagent had four confusing or unreliable outcomes:
Subagent already finished);rlm(...)could remain blocked when child work ignored abort;What changes
Session lifecycle
Cancellation is idempotent while the run remains tracked. It rejects the public
rlm(...)waiter immediately, aborts the child, emits the authoritativecancelledupdate, keeps terminal activity clear, and does not let a late provider error replace the cancellation reason/status.Daemon cleanup
After acknowledging
cancel_rlm_child, the daemon asynchronously closes the matching hosted descendant runtime with reasonkilled. The response does not wait for shutdown, and the ancestor check prevents an unrelated session from being closed.Interactive UX
The TUI:
Stopping subagent...immediately;Subagent stoppedon success;Subagent is no longer runningwhen completion wins the race, without treating it as an error;Cancelledupdate without stale activity/recap;The UI does not maintain a second optimistic child-state machine.
AgentSessionremains authoritative for cancellation state, and later daemon roster refreshes may remove the transient cancelled row after runtime release.Scope and consolidation
This branch is one commit on current
mainand intentionally excludes the earlier kernel/process-group cleanup work.Tests follow the consolidation approach from #498, #499, and #500:
Validation
npm run checkNote
Make subagent cancellation explicit with immediate feedback and race-condition fixes
durationMs, and emits a terminal UI update before the child finishes unwinding.AgentSession.runRlmChildwhere result collection could overwrite a concurrent cancellation with adonestatus.stoppingChildAgentIdsset, and keeps cancelled snapshots visible unless explicitly deleted by the orchestrator.Macroscope summarized ae977bc.
Note
Medium Risk
Touches RLM child lifecycle, daemon session teardown, and promise rejection paths where races previously caused stuck waiters or wrong terminal status; behavior is well covered by new/extended tests.
Overview
Subagent stop now treats cancellation as authoritative end-to-end:
AgentSessionrejects the publicrlm.runwaiter immediately, emits a terminalcancelledupdate (with duration, no stale activity), idempotently acknowledges repeat cancels, and re-checks cancellation after usage collection so a late finish cannot flip status todone.Daemon
cancel_rlm_childstill returns{ cancelled: true }right away, then asynchronously closes the matching hosted descendant session (killed) using ancestor checks so unrelated sessions are not torn down.Interactive TUI shows immediate “Stopping subagent…”, coalesces duplicate stop input, reports success or “no longer running” without erroring on completion races, keeps user-cancelled rows visible (only orchestrator deletion tombstones are removed), and the child inspector shows Cancelled instead of stale recap/activity.
Reviewed by Cursor Bugbot for commit ae977bc. Bugbot is set up for automated code reviews on this repo. Configure here.