Repository navigation
Description
Summary
Found during the fix-verification audit of PR #320 (issues #318/#319). The same "cause dropped" defect class #319 fixed for Subagent/Parallel exists on the team member path, which #319 explicitly left out of scope.
A team member whose round ends in a run-level provider error (StopError) has its real cause captured by the loop on session.ResultPayload.Error — and then dropped at two points:
engine/agent/teamsupervisor.godriveOneTurnreadsstopandusageoffev.Resultbut neverev.Result.Error.engine/agent/teamtool.goprojects the member'sEvResulttoEvTeamMemberforwarding onlyText+Usage, droppingError.session.TeamPayloadhas noCausefield, so theteam.*event stream and the parent's durable.events.jsonlcannot retain the cause.
The lead's synthesis learns only writeTeamStatus's stopped (error) enum — not WHY the member's provider call failed. For a member that stalls on a transient provider error mid-run, the operator cannot tell stream-idle-stall from a permanent 4xx from an exhausted retry budget, despite each implying a different response.
This is the third delegation family (team.*, coordinating roster) — #319 fixed subagent.* (flat fleet) and parallel.* (fan-out group); team.* is the remaining one.
Proposed fix
Mirror the #319 SubagentPayload.Cause design on TeamPayload:
- Read
ev.Result.Errorin the supervisor's per-turn drain (the samehandleChildEvent/drainChildObservedchokepoint the supervisor shares). - Add
Causetosession.TeamPayload, set on the member-end projection ONLY whenStopisStopError, harness/provider metadata only (gauntlet ACP: accept client-provided streaming-HTTP MCP servers #7), clamped through the sameclampPreviewdiscipline. - Thread it to the wire (proto
Team.causenext free field) and surface it in mecatui's team roster/focusstopped (error)row, so a member failure is as explicable as a subagent failure.
Gates: touches the engine public surface (task api:update + engine/CHANGELOG.md, Added = minor) and the proto (task generate).
Related: #318, #319, PR #320. The ADR-0079 doc-comment in session/event.go records a "4th delegation family" trip-wire for extracting a shared ChildActivity value object — if TeamPayload grows Cause here, that is a third payload carrying it, which may be the point to extract the shared shape.
Activity
feat(agent): surface team member StopError cause on team.* events (#331…