Skip to content

Team member StopError cause is dropped — TeamPayload has no Cause field #331

Closed

Description

@JAORMX

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:

  1. engine/agent/teamsupervisor.go driveOneTurn reads stop and usage off ev.Result but never ev.Result.Error.
  2. engine/agent/teamtool.go projects the member's EvResult to EvTeamMember forwarding only Text + Usage, dropping Error. session.TeamPayload has no Cause field, so the team.* event stream and the parent's durable .events.jsonl cannot 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.Error in the supervisor's per-turn drain (the same handleChildEvent/drainChildObserved chokepoint the supervisor shares).
  • Add Cause to session.TeamPayload, set on the member-end projection ONLY when Stop is StopError, harness/provider metadata only (gauntlet ACP: accept client-provided streaming-HTTP MCP servers #7), clamped through the same clampPreview discipline.
  • Thread it to the wire (proto Team.cause next free field) and surface it in mecatui's team roster/focus stopped (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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions