agent-orchestrator
agent-orchestrator copied to clipboard
Stop background tasks from the remaining chat harnesses
PR #7550 adds the background tasks tab above the chat composer. A running task gets a stop square only when its harness can stop it, and today that is Claude Code and Codex background terminals. Every other harness shows its tasks with no way to stop them from Orchestrator.
How it works for Claude Code
- AO's packaged Claude runtime registers
_ao/session/stop_background_task, which calls the Claude Agent SDK'sstopTask(taskId). It only accepts a task that is in the live background set (frontend/scripts/build-acp-runtime-helpers.mjs). claudeacpwires that call into the ACP driver'sStopBackgroundTaskhook. The runtime marks each live taskstoppable, and the daemon passes that through.POST /api/v1/sessions/{sessionId}/background-tasks/{taskId}/stopreturns 204 on success and 409BACKGROUND_TASK_NOT_STOPPABLEwhen the harness cannot stop the task.
How it works for Codex
codexappserverstops one background terminal with the app-server's experimentalthread/backgroundTerminals/terminate({threadId, processId}→{terminated}), which every supported Codex has (0.146.0 and later). Only terminals the latestthread/backgroundTerminals/listreturned are markedstoppable; Codex subagents are not.- Codex reports a killed terminal through
item/completedwith a non-zero exit, so the driver remembers the terminals it asked to stop and settles them as stopped, not failed.
What's missing
- Other ACP harnesses (OpenCode, Droid, Kimi, Pi, Cursor, Qwen, Copilot, Command Code, DeepSeek and the rest): their background tasks come from tool events, and ACP v1 has no request to stop one. Each one needs either a provider extension or ACP support.
- Unreal Agent: it reports tasks and has no stop path.
Done when
- Each harness that gains a stop control implements
ports.ChatBackgroundTaskStopperon its conversation, and reportsStoppable: trueonly on tasks it can actually stop. - The composer tab needs no change: the stop square appears as soon as the harness reports a task as stoppable.
- A harness that cannot stop a task keeps returning
ErrBackgroundTaskNotStoppable, so the UI never shows a control that does nothing.
Related PRs
- #8780 shows Codex subagents as a team: each launch, its child's steps, and its report. It adds no stop control, so Codex subagents still can't be stopped. That stays in scope here.
- #8782 shows OpenCode 1 and 2 subagents the same way. It adds no stop control either, so stopping an OpenCode task or subagent stays in scope here.