You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes the last gap in the "subagent task as task dashboard" story: a
parent session can now interrupt a delegated child run without canceling
the whole parent run.
Core
- `SubagentStatus` gains a `Cancelled` variant. Late `SubagentEnd`
events from the cancelled child do not downgrade it back to
`Failed`.
- `InMemorySubagentTaskTracker` now also stores `CancellationToken`s
per task. `register_canceller` / `clear_canceller` / `cancel(id)`
bracket the in-flight token lifetime; `cancel` fires the token and
flips the snapshot status atomically.
- `TaskExecutor` gains `with_subagent_tracker(...)`. When set, each
task registers its token, then runs the child loop through
`AgentLoop::execute_with_session(... Some(&token))` so the
cancellation propagates into LLM streaming and tool execution.
- `register_task_with_mcp` grows an optional tracker parameter so the
session bootstrap path can share a single Arc with the executor and
the live `AgentSession`.
- `AgentSession::cancel_subagent_task(task_id)` exposes the operation
to callers.
SDKs
- Node: `Session.cancelSubagentTask(taskId): Promise<boolean>` via the
same get_runtime().spawn pattern used by other run-control methods.
- Python: `Session.cancel_subagent_task(task_id) -> bool` via the
py.allow_threads / tokio block_on pattern.
Tests
- Tracker-level unit tests for the four interesting cases: cancel fires
the token + flips status, cancel returns False on unknown ids, late
SubagentEnd doesn't downgrade Cancelled, and clear_canceller disarms
future cancel calls.
- Integration test in agent_api/tests.rs drives a synthetic subagent
lifecycle through `RuntimeEventSink`, registers a canceller, and
asserts the public `cancel_subagent_task` API + the Cancelled
terminal state survive a late SubagentEnd.
- Node + Python smoke tests assert cancelling an unknown task id
resolves to false / False.
0 commit comments