Skip to content

fix(coding-agent): reconcile completed worker status - #1872

Closed
johnrichardrinehart wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
johnrichardrinehart:fix/stale-worker-status
Closed

johnrichardrinehart wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
johnrichardrinehart:fix/stale-worker-status

Conversation

@johnrichardrinehart

@johnrichardrinehart johnrichardrinehart commented Aug 28, 2026

Copy link
Copy Markdown

Problem

A completed resident RLM child can retain stale in-memory streaming or pending-tool state. rlm.list_subagents() then reports completed, while agent_message.list_agents() reports running and agent_observe reports an active tool stream.

Fix

Read the persisted per-child lifecycle record before creating resident agent summaries. A terminal lifecycle now overrides stale execution fields:

  • agent_message reports the child as inactive and not streaming.
  • agent_observe reports the child as idle, inactive, and not streaming.
  • The resident session remains available for transcript inspection and later messages.
  • Late messages cannot reactivate the reported lifecycle state.

Passive child behavior is unchanged.

Validation

  • npm run check
  • packages/coding-agent/test/daemon-mode.test.ts: 199 passed

Note

Fix completed resident subagents appearing active in AgentDaemon observe and message APIs

  • Completed or deleted RLM subagents were still shown as streaming/active because in-memory session flags were stale after the on-disk lifecycle already reached a terminal state.
  • Adds AgentDaemon.readResidentRlmLifecycleStatus to read the persisted subagent display entry and confirm the rlmChildId matches before trusting the status.
  • createAgentObserveSummary, createAgentObserveAgentSnapshot, createAgentObserveRecentMessages, createAgentMessageAgentSummary, and their callers now pass the persisted lifecycle status through; when it is completed or deleted, they force idle/inactive, clear isStreaming, isCompacting, unfinishedActionCount, and queuedCount.
  • Risk: summaries rely on the on-disk display entry being current; if readResidentRlmLifecycleStatus cannot find or match the entry it falls back to the prior in-memory classification, so a missing or stale file could still show a completed worker as active.

Macroscope summarized ad1364e.

Resident subagent summaries derive activity from live session fields. A child
can retain stale streaming or pending-tool state after its RLM lifecycle is
persisted as complete. Agent messaging and observation then disagree with the
RLM registry and the agents view.

Read the per-child lifecycle record before creating resident summaries. Treat
completed or deleted lifecycle states as terminal while preserving the live
session for transcript inspection and later messages.
@github-actions

Copy link
Copy Markdown

Hi @johnrichardrinehart, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/PrimeIntellect-ai/prime-agent/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Aug 28, 2026
@johnrichardrinehart

Copy link
Copy Markdown
Author

Moved the report and tested patch to the required intake path: #1873

VincentBailly pushed a commit to VincentBailly/prime-agent that referenced this pull request Sep 2, 2026
… section

Fork-local workaround. Do not merge upstream. Delete it once upstream
classifies finished agents correctly.

Finished agents stay in the agents-view Running section forever. The
supervisor ledger only re-publishes a roster row when the summarizer
verdict text changes, so a finished agent keeps activity "working"
(label "classifying") and a frozen rosterStatus "running". This guard
trusts "running" only when a hard busy signal still backs it.

Greppable marker sites (both carry the marker LOCAL PATCH(agents-view-done-in-running)):
  packages/coding-agent/src/modes/agents-view/agents-view-state.ts
  packages/coding-agent/test/agents-view-done-in-running.test.ts

Drop test, one command: delete the guard block in agents-view-state.ts, then run

  npx vitest --run packages/coding-agent/test/agents-view-done-in-running.test.ts

If it still passes without the guard, upstream fixed the bug: delete the
guard block AND the whole test file.

Upstream refs: PrimeIntellect-ai#1873, PrimeIntellect-ai#1872, PrimeIntellect-ai#1967.
Caused by 8d5722e / 1d2e91d.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant