agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

[Feature]: Show and stop background tasks in Terminal UI sessions and the ao CLI

Open Annieeeee11 opened this issue 2 weeks ago • 1 comments

Context

Background tasks are coming to Chat sessions:

  • PR #7550 adds a tab above the chat composer. It shows running shells with their elapsed time, and Claude Code tasks can be stopped from it.
  • A follow-up PR will open a task in a Background tab beside Subagents, with its live output.
  • #8322 (stop for other harnesses), #8326 (elapsed time after a restart) and #8327 (command and output data) cover the gaps found along the way.

All of that is Chat mode only. Someone working in a Terminal UI session, or from the ao CLI, still can't see or stop background work.

What's missing

1. Terminal UI sessions. When a session runs the agent's own CLI in Orchestrator's terminal, background work is invisible. The daemon reports a Terminal UI session as unavailable, and the renderer only asks for chat sessions (supportsLocalBackgroundTasks). Switching a session from Chat to Terminal also hides tasks that are still running.

2. The ao CLI. There is no command to list or stop a session's background tasks. Orchestrator agents and scripts can't check for a dev server that's still running before they ao session kill a session, and someone working in a terminal has to open the app to see one.

Proposal

  • Terminal UI sessions: report background tasks with the same reading the chat tab uses, and show them in the session's UI. One lead for Claude Code: its Stop hook input carries background_tasks, the in-flight background work of the session, and Orchestrator already runs ao hooks for Claude Code. Other CLIs need their own source, or stay unavailable.
  • ao CLI, on the existing endpoints:
    • ao session tasks <session-id> lists running and recently failed tasks with their state and elapsed time, plus a --json output for agents.
    • ao session tasks stop <session-id> <task-id> stops a task where the harness supports it, and says so plainly where it doesn't.
    • Optionally, ao session ls shows a running-task count per session.

Open questions

  • Which part matters first: Terminal UI sessions, or the ao commands?
  • Should actions that end running background work warn first? For example terminating the session, exiting the agent, or switching between Chat and Terminal.
  • Is a Terminal UI session's reading allowed to be partial, as Codex's is in Chat?

Done when

  • A Terminal UI session with a running background shell shows it, at least for Claude Code.
  • ao session tasks lists the same tasks the chat tab shows, and ao session tasks stop stops a Claude Code task.

Annieeeee11 avatar Nov 13 '26 13:11 Annieeeee11

Can I work on this?

bhushan4work avatar Nov 15 '26 13:11 bhushan4work