Repository navigation
feat(daemon): manage a session's background jobs from /tasks - #1729
Conversation
A daemon chat refused /tasks, saying it starts no A2A tasks of its own. The view also lists shells and subagents, and in a daemon chat all of them run in the thread's worker, so the chat had no way to see or stop them. The worker now answers list_tasks and cancel_task from its job supervisor, and the view loads from it in a daemon chat. Details work the same way, and a subagent's transcript already came from the worker's storage.
Opening /tasks during a run and closing it wiped the run's status, so the chat looked stopped while the agent kept working. A shortcut announced itself over the status and restarted its timer, a panel set its own text under the panel where nobody can see it, and closing the panel cleared the line. Later chunks did not bring the status back, since they only update it when the chat status changes. While a run is busy, a shortcut no longer announces itself. A status without a spinner no longer replaces the run's when it is blank or arrives under a panel. The task view's own message is gone, since it could never be seen. The /tasks menu also stayed on screen after closing the panel. A keystroke's update is delivered asynchronously and could land after Enter sent the text, so an update for text the input no longer holds is now dropped.
Co-authored-by: Eden Reich <[email protected]>
|
@infer can you run |
|
Model: Todos(agent has not posted a plan yet) Pull Request✅ Infer Result: SuccessDone. Model: Tokens: 211,350 in · 1,643 out · 212,993 total (8 requests) Tool calls: 7 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
|
🎉 This PR is included in version 0.246.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
/tasksnow works in a daemon chat. It used to refuse witha daemon chat starts no A2A tasks of its own, but the view also lists shells and subagents, and in a daemon chat all of them run in the thread's worker. The chat had no way to see or stop them.The worker now answers two new panel frames from its job supervisor, and the view loads from them in a daemon chat. An in-process chat behaves as before.
Closes #1731, since
/tasksnow works during a daemon chat's run and closing it would otherwise cost the run its status.Changes
internal/presentation/headless/panel_tasks.go(new):list_tasksanswers with the worker's jobs andcancel_taskstops one. An A2A task is also cancelled on its agent, the way the in-process view does it.internal/sessions/registry.go: both frames route like the other panel requests. The thread's own worker answers, which matters here because the jobs live in that process.internal/presentation/tui/daemonthread/tasks.go(new): the client, followingArtifacts.tui.WorkerJobsis the contract the view takes.GetWorkerJobsreturns nil for an in-process chat.TaskView: it loads from the worker in a daemon chat. Its running counts come from the loaded rows there, since rendering cannot ask the worker. A finished A2A row no longer offers cancel, which matters now that such a row can have no retained record.FeatureTasksand the refusal are gone.docs/browser-extension-protocol.mddocuments both frames, and the daemon, shortcuts and task docs are updated.A run keeps its status across a panel
Opening
/tasksduring a run and closing it wiped the run's status, so the chat looked stopped while the agent kept working. Three things overwrote it, which is more than #1731 named:Executing <name>...over the status and restarted its timer. While a run is busy it no longer does.StatusViewnow ignores a status without a spinner that arrives under a panel during a run, and the task view's own message is gone.StatusViewnow ignores that blank status during a run. A direct tool with no chat session still clears it.The
/tasksmenu also stayed on screen after closing the panel. A keystroke's update could land after Enter sent the text, so an update for text the input no longer holds is now dropped.Limits
/tasks, because a daemon chat gets no local job change event. This is marked with aponytail:comment.Failed, the same as in an in-process chat.Verification
TestChatDaemonListsAndStopsTheWorkersJobsandTestChatDaemonShowsAFinishedJobsOutputfail onmainand pass here.TestChatDaemonShowsASubagentsTranscriptcovers a subagent's stats and transcript, and I did not run it againstmain.go test -race ./...andtask precommit:runpassed on the first commit, and the full e2e suite on that commit too.TestChatTUIKeepsARunsStatusAfterClosingAPanel(/tasksand/theme) andTestChatDaemonKeepsARunsStatusAfterClosingTasksfail without it and pass with it, along with a unit table covering what the guard keeps and what it still lets through./tasks,/tools,/agents,/conversations,/artifacts,/explorerand/themeclosed with Esc, and/modelclosed by picking a model. Each showed the run's status afterwards.go test -race ./...and e2e run of the status fix was interrupted, so CI is the full check for that commit. The changed packages and the daemon and status e2e tests pass locally.Not exercised end to end: an A2A task in a daemon chat, which only has unit tests, and a session teleported to a remote workspace. The frames take the same route as
list_artifactsthere, but no test drives it.Downstream