fix(agents): subagents no longer stay Running after they finish - #206
Merged
Conversation
Two ghost rows kept showing as running in the Agents panel and the agents-working row. A background shell command the harness moved to the background got a subagent row from its background flag alone. An agent resumed with SendMessage after a provider restart got an orphan row keyed by the resume call, while the adapter's single-completion guard swallowed its new run. A metadata patch with no lifecycle status now only updates a known row, on both the server roster and the web fold. The Claude adapter reports the background flag only for agent tasks, treats a settled task starting again under a different call as a resumed run, and restates spawn flags only on first sighting. When a turn completes on its own, its still-running foreground agents are settled with it; background agents keep running. The web fold re-opens a settled record from the task stream and files a resumed agent's replayed final report on its own row by task id, mirroring the server.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Agents panel and the "Agents working" row kept listing subagents as Running long after they had finished. On a live thread two ghost rows sat next to the one real agent: a background shell command that the harness had moved to the background, and an agent resumed with SendMessage after a provider restart. Both rows had no model and no token count, and nothing could ever settle them.
What went wrong:
What changed:
Tests: projection (flag-only patch creates no row; replayed report lands on the row by task id), ingestion (foreground agent settles on turn complete, background one keeps running), adapter (restart then resume emits a run of its own with no orphan metadata; backgrounded shell command gets no row), web session logic (backgrounded shell command is not an agent; a resume after restart stays one row through progress, completion, and the final report).