Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(agents): distinguish crashed children from finished ones in waitForAgent

2 months ago

cb1ef38
Authored
mweinbach7/26/2026, 4:47:06 PM
`readyAgentIds` means "stopped running", not "succeeded" — StatusBus counts
`errored` as terminal. Callers that conflated the two read a failed child's
partial transcript as if it were a result.

Observed in production: a four-way fan-out where every child exceeded the
model's context window still returned timedOut:false with all four ready, and
the parent summarized four crashed agents' partial output as findings.

Adds `erroredAgentIds` alongside `readyAgentIds` through StatusBus, the wait
result, the agent_wait_result event and its schemas, and states the distinction
in the waitForAgent tool description so a model cannot miss it. Additive, so
existing callers are unaffected.

`closed` is deliberately not counted as an error — that is a lifecycle outcome
the parent chose, not a failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk98XjGKJrKp5ynbiNFMFu

Parent4abf664

8 files changed
  • apps/desktop/src/lib/wsProtocol.ts+1−0
  • src/server/agents/StatusBus.ts+20−2
  • src/server/agents/types.ts+6−0
  • src/server/jsonrpc/schema.agents.ts+1−0
  • src/server/protocol.ts+2−0
  • src/server/session/SessionAdminManager.ts+1−0
  • src/tools/persistentAgents.ts+2−1
  • test/workflows/waitErrored.test.ts+85
−0