agent-orchestrator
agent-orchestrator copied to clipboard
Report the command and output of background tasks
PR #7550 shows background tasks in a tab above the chat composer, but the API reports only each task's description, kind, state and times. Two things the approved design needs are missing:
- The command (for example
npm run dev), shown in muted mono text next to the task's name. - The output. The planned follow-up opens a task in a Background tab beside Subagents and shows the shell's live output, with the newest lines at the bottom. Without output there is nothing to show there.
What the API needs
Add to BackgroundTaskResponse (backend/internal/httpd/controllers/dto.go) and to ports.ChatBackgroundTask:
command: the shell command line, when the task is a shell and the harness reports it separately from the description. Leave it empty rather than repeat the description.- A way to read output: either a recent output tail on each reading, or a separate endpoint such as
GET /api/v1/sessions/{sessionId}/background-tasks/{taskId}/outputthat returns the last N lines, so the list poll stays small. Like the other background-task reads, it must not start a controller or wake a hibernated session.
Where the data could come from (to confirm per harness)
- Claude Code: the
background_tasks_changedsnapshot carries only an id, type and description. The command is in the input of the Bash tool call that launched the task. The SDK reports anoutput_fileontask_notificationwhen a task ends. A live output path while it runs still needs finding, possibly through AO's runtime extension. - Codex:
thread/backgroundTerminals/listalready returnscommand, which AO currently uses as the description. Output may come fromitem/commandExecution/outputDeltanotifications for the exec item, buffered per process. - ACP harnesses and Unreal Agent: a command may be in the launching tool call's raw input, and output in its tool content where the harness reports it. Some harnesses will have neither, so both fields stay optional.
Done when
- A Claude Code or Codex shell task reports its command, and the composer tab shows it next to the name.
- The latest output of a running shell task can be read without waking the session, bounded in size, with control characters removed like the description.
- Harnesses that can't provide either leave the fields empty, and the UI hides what's missing instead of showing a placeholder.