Skip to content

feat(agent): surface team member StopError cause on team.* events (#331) - #403

Merged
JAORMX merged 1 commit into
mainfrom
issue-331-team-cause
Aug 6, 2026
Merged

JAORMX merged 1 commit into
mainfrom
issue-331-team-cause

Conversation

@JAORMX

@JAORMX JAORMX commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #331. Mirrors the #319 SubagentPayload.Cause design onto the team member path — the third delegation family the #319 fix explicitly left out of scope.

A team member whose round ends in a run-level provider error (StopError) had its real cause captured by the loop on session.ResultPayload.Error and then dropped at the projection. Now:

  • session.TeamPayload.Cause carries the member run's per-round failure detail on EvTeamMember (InnerKind=EvResult) only when the round's Stop is StopError — harness/provider metadata, never member-authored output (gauntlet ACP: accept client-provided streaming-HTTP MCP servers #7, same footing as Stop/Usage).
  • Projected at the single emit site projectTeamEvent (engine/agent/teamtool.go) via the shared subagentCausePayload chokepoint (whitespace-collapsed, rune-clamped to maxSubagentCausePreview = 400). No second normalisation path.
  • Threaded end-to-end: proto Team.cause (field 19) → toProtoTeam → ACP teamMemberLine (<member> failed: <cause>) → mecatui TeamMsg.Cause → teamLane.cause → the team focus pane's failed: block.

Scoping decisions (from the architect's plan)

  • Client-only, not model-visible: writeTeamStatus (the lead's trusted synthesis section) is unchanged — threading a provider error string into that region is a separate model-visible change with its own risk surface.
  • The terminal EvTeamEnd disposition stays closed-enum (no cause on TeamMemberDisposition); a retried member's failed rounds each surface their own cause on the per-round result event.
  • No shared ChildActivity extraction: the ADR-0079 trip-wire fires at a 4th delegation family, ParallelPayload deliberately omits Cause, and the normalisation is already shared via the helper. The trip-wire comment is updated to record the current state.
  • mecatui: the cause renders in the focus pane only (the roster row already shows stopped — error; a verbose cause would break the roster width invariant — same fleet/focus split as A failed subagent's actual cause is dropped four times — the error shown is the child's last chat line #319). teamFailureLine wraps to the card text budget via the viewport width and is self-defensive (mirrors subagentFailureLine's guards).

Gates

  • task generate (proto regen) + task api:update (engine/api/session.txt) — done; session.TeamPayload.Cause classified Added (minor) per engine/COMPATIBILITY.md, with the engine/CHANGELOG.md entry.
  • task lint && task test — green (root + engine + provider modules + standalone proofs; api-compat gate passes).
  • task docs — llms.txt regenerated, strict link gate clean (0 broken/orphan/unreachable).
  • go run ./cmd/mecademo — still prints a full offline session.

Tests

New coverage at every seam, each failing if the cause is dropped at its layer: the real-supervisor-loop emit site (multi-line + 5000-rune adversarial error → collapsed, ≤401 runes, result-event-only), projectTeamEvent unit, the session reviewed-fields allow-list, the proto mapper, the ACP projector, the client msgs mapping, and the mecatui focus render (benched-on-error renders failed:; a done member and a non-error stop render nothing; last non-empty cause wins; the failure line wraps to the card budget).

Review

Ran the dev-pipeline panel (spec / standards / domain: secure-code, software-architect, code-duplication, library-reuse + a QA test-adequacy pass). Cross-confirmed findings fixed before opening: the viewport width/height mix-up in teamFailureLine, the helper's missing self-defensive guards, and the stale subagentCausePayload doc-comment (now names both delegation families).

Mirror the #319 SubagentPayload.Cause design onto TeamPayload: a team
member whose round ends in StopError now carries the loop's
ResultPayload.Error on its per-round EvTeamMember (InnerKind=EvResult),
normalised through the shared subagentCausePayload chokepoint
(whitespace-collapsed, rune-clamped to 400) at the single emit site
projectTeamEvent. Client-only (gauntlet #7 — harness/provider metadata,
never member-authored output); the terminal EvTeamEnd disposition stays
closed-enum and writeTeamStatus is unchanged. Threaded end-to-end:
proto Team.cause (field 19) -> toProtoTeam -> ACP teamMemberLine
("<member> failed: <cause>") -> mecatui TeamMsg/teamLane -> the team
focus pane's "failed:" block, rendered only for a member benched on
error (last non-empty cause wins; a recovered done member renders
nothing).

The ADR-0079 trip-wire comment records the current state: the shared
normaliser now crosses Subagent + Team, Parallel deliberately omits
Cause, and the 4th-family ChildActivity extraction bar stands.

Engine public surface: session.TeamPayload.Cause is Added (minor) per
COMPATIBILITY.md — api/session.txt regenerated, CHANGELOG entry added.

Co-Authored-By: mecatl <[email protected]>
@JAORMX
JAORMX merged commit 8cc1186 into main Aug 6, 2026
15 checks passed
@JAORMX
JAORMX deleted the issue-331-team-cause branch August 6, 2026 07:27
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.

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

1 participant