Repository navigation
Converge delegation observability: bounded previews for Subagent/Parallel (ADR 0079) - #327
Merged
Merged
Conversation
Acceptance plan for issue #323: converge the delegation observability surface on two tiers — bounded previews for Subagent/Parallel, Team-unique structures stay Team-only. Co-Authored-By: mecatl <[email protected]>
…gress Co-Authored-By: mecatl <[email protected]>
Add Text/Detail/InnerKind to SubagentPayload and ParallelPayload, mirroring TeamPayload's bounded-preview shape per ADR 0079: Text is a clamped preview of child message text, Detail a clamped preview of a child tool call's args or tool result body, InnerKind discriminates the projected inner event kind. Redaction doc-comments rewritten from metadata-only to the bounded-preview contract (clampPreview scrub + rune cap, permission.ask never forwarded, client-only — gauntlet #7 unchanged); TRIP-WIRE comment updated to note the now-shared preview fields. Fields are declared but not yet populated (task 02 wires the chokepoint). task api:check drift is expected; the api snapshots and CHANGELOG note are reconciled on the accumulator. Pins AC1.1 via TestDelegationObservability_Scenario1_PayloadsCarryPreviewFields. Co-Authored-By: Claude Opus 4.8 <[email protected]>
ADR 0079: drainChildObserved now projects clampPreview-bounded previews (tool.call args / tool.result body -> Detail, message.delta / result text -> Text, tagged by InnerKind) for all three delegation families; the Parallel branchTool re-tag copies them. The permission.ask drop and gauntlet-#7 conversation isolation are unchanged. Sentinel tests re-shaped from 'no content fields' to 'content fields provably bounded + scrubbed': canary suites assert no VERBATIM carriage, Subagent gains the structural sentinel Parallel had. Co-Authored-By: mecatl <[email protected]>
Add text/detail/inner_kind to the proto Subagent (14-16) and Parallel (22-24) messages and copy them verbatim in toProtoSubagent/toProtoParallel, mirroring toProtoTeam's Text/Detail/InnerKind shape (inner_kind a STRING passthrough). The HTTP/SSE relay reuses toProto, so both wire surfaces carry the ADR 0079 bounded previews already clamped upstream in engine/agent. Mapper table tests assert the new fields round-trip for both preview shapes (tool Detail / message Text). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…am trace) Thread the ADR-0079 bounded previews through the mecatui client + conversation model, and converge the Subagent/Parallel renderers on the Team trace format. - client: add Text/Detail/InnerKind to SubagentMsg/ParallelMsg and populate them in the subagentMsg/parallelMsg translators. - conversation: replace the name+isError subToolChip with the shared teamTrace shape (kind/text/name/detail/isError) across the subagent inline card, the fleet lane, and the parallel branch lane; one routeTraceEvent projection routes the inner kinds (tool.call/tool.result/message.delta) into chips with bounded previews + coalesced capped message lines for all three families. - renderers: the collapsed Subagent card now names the live current tool (`subagent · <tool> · ↑in ↓out · N tools · ctrl+t trace`, no ticker — AC3.1); the expanded card, the Subagent focus, and the Parallel group focus render the Team-format interleaved trace (glyph chips with bounded previews + capped message lines), double-truncated by the TUI caps (maxTraceDetailLen=80, maxTraceMessageLen=200) on top of the engine clamp (AC3.2/AC3.3). The parallel group focus renders each branch's trace below its roster line, height-bounded. - honesty notes: every "args/results hidden" string becomes the accurate "bounded previews" framing (AC3.4); a source-level sweep fails on any re-introduction. - Team-unique structures (task board, findings ledger, dispositions, mutating cue, context meter) stay Team-only (AC3.5). The prior collapsed-card assertion (the tool name must NOT appear) is deliberately inverted per ADR 0079. Goldens refreshed via task test:golden. Pins: - TestDelegationObservability_Scenario3_CollapsedCardShowsCurrentTool (AC3.1) - TestDelegationObservability_Scenario3_ExpandedCardShowsBoundedPreviews (AC3.2) - TestDelegationObservability_Scenario3_ParallelViewsShowBoundedPreviews (AC3.3) - TestDelegationObservability_Scenario3_HonestyNoteIsBoundedPreviews (AC3.4) - TestDelegationObservability_Scenario3_TeamUniqueStructuresStayTeamOnly (AC3.5) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The living docs described Subagent and Parallel observability as metadata-only, with Team the only family forwarding bounded previews. ADR 0079 converged all three families on tier-1 bounded previews (clamped + control-byte-scrubbed, client-only) through the shared drainChildObserved chokepoint; the task board, findings ledger, dispositions, mutating cue, and context meter stay Team-unique. - docs/architecture/domain-model.md: delegation-families note rewritten to the two-tier model; event table rows updated. - docs/design/IMPLEMENTATION-NOTES.md: parallel.* section + the log redaction-boundary + team structural-guard notes updated; TRIP-WIRE kept intact. - docs/architecture/subagents-and-teams.md, parallelism.md, docs/tui.md, docs/usage/grpc-api.md: same stale phrasing replaced. - AGENTS.md: the three-families gotcha states the bounded-preview contract; the rest of the gotcha is unchanged. - user-docs: short bounded-previews note on the delegation page plus a mecatui card note (operator-visible TUI behavior). llms.txt regeneration and task docs are left to the orchestrator's aggregate gate. Co-Authored-By: mecatl <[email protected]>
…ning Co-Authored-By: mecatl <[email protected]>
Co-Authored-By: mecatl <[email protected]>
Co-Authored-By: mecatl <[email protected]>
The ADR-0079 projection widening cost +62 allocs/op on background_subagents (perf gate 1.02x). Recover 40% of it: clampPreview is now a single-pass strings.Builder walk (zero-alloc on a clean short string; the rune cap is enforced as it fills, so an overlong input allocates only the cap-sized prefix, never the full scrubbed copy), and drainChildObserved skips the payload alloc for events it will drop (turn.start, hooks, compaction, asks). The residual +33/op is the intrinsic cost of the feature (4 projected events x payload+send per child, the same per-event cost Team already pays) — recorded as accepted in ADR 0079. Co-Authored-By: mecatl <[email protected]>
The path-escape-posture Scenario 5 tests (landed on main in #322) read the child's ok/error outcome from subagent.tool events keyed on ToolName alone. ADR 0079's widened projection also emits tool.call previews (IsError=false) and message/result text previews for the same tool, so the outcome must be read from the tool.RESULT projection (InnerKind == EvToolResult). Co-Authored-By: mecatl <[email protected]>
JAORMX
force-pushed
the
acc/delegation-observability-convergence
branch
from
July 30, 2026 11:15
3f36e0c to
a4371ae
Compare
…pped The rebase's --theirs resolution on docs/acceptance/README.md took our side and dropped main's path-escape-posture index entry (making that plan unreachable — the matlatl gate). Restore both entries and our plan's landed status; regenerate llms.txt per the don't-hand-merge rule. Co-Authored-By: mecatl <[email protected]>
The delegation-observability widening tripped the perf gate (background_subagents 1482 vs 1449 baseline, ratio 1.0228 > 1.02). A kimi-k3 architect+perf team found the real cause: clampPreview (made single-pass in da52a81) is too complex to inline (gc cost 271 > budget 80), so its strings.Builder escaped to heap on EVERY call — even on the clean path that returns the input verbatim (~15/op of recoverable waste, carried by BOTH delegation families). Fix: an inlinable isCleanASCII byte loop short-circuits the common ASCII-short path to a zero-alloc verbatim return; the rune-aware slow path is unchanged. Result: 1507/op, ratio 1.012 — under the gate. The residual +20/op is the irreducible feature cost (4 projected events x payload+send per child, the same per-event cost Team pays); ADR 0079's perf section updated to match. Co-Authored-By: mecatl <[email protected]>
JAORMX
added a commit
that referenced
this pull request
Aug 1, 2026
Four follow-ups from rebasing onto the delegation-observability-convergence merge (main's #327): - Subagent.cause moves to proto field 17 (14–16 are ADR 0079's inner_kind/text/detail) — regenerated harness.pb.go via task generate. - The ADR-0079 structural sentinel allow-list gains Cause with its gauntlet-#7 justification (engine/agent/delegation_observability_test.go). - The focus pane's bounded-previews honesty note is width-wrapped like the failure line (indentWrap over cardTextWidth) — unwrapped it set the card to 96 cols and overflowed an 80-col viewport, caught by TestSubagentFocusPaneWithLongCauseFitsViewport. - docs/adr/0077-resume-a-failed-subagent.md cited the direct-write ADR as 0041; on main that number is output-economy and the direct-write record is ADR 0077 — two links retargeted (matlatl strict). Co-Authored-By: Claude Code <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #323.
Converges the three delegation observability families on two tiers per ADR 0079:
SubagentPayloadandParallelPayloadgain the sameText/Detail/InnerKindfieldsTeamPayloadalready carried, populated by the singledrainChildObservedchokepoint via the existingclampPreview(control-byte scrub + 200-rune cap). The TUI shows the live current-tool name on a collapsed Subagent card, and Team-style bounded previews on the expanded trace and focus panes. The honesty note changes from "args/results hidden" to "bounded previews".Gauntlet #7 is unchanged: previews are client-only (event stream + durable log), clamped, and scrubbed; nothing child-authored enters the parent
Conversation. The permission.ask drop discipline is total, as before. The sentinel tests changed shape with the invariant — from "no content fields" to "content fields provably bounded + scrubbed" — with the behavioral canary suites (no VERBATIM carriage) as the primary guard.What landed (acceptance plan:
docs/acceptance/delegation-observability-convergence.md, 15 ACs,landed)54f00bc669890345cfa459850d717564bf8bdc43Plus orchestrator reconciliation: api snapshot + CHANGELOG (Added = minor),
llms.txtregen, plan flip tolanded.Verification
task test— green (both modules, incl.internal/apicheckaftertask api:update).task lint— green on the main checkout shape (the nested-worktree forbidigo../../cmd/false positive is a pre-existing worktree artifact, reproduced on main; CI runs at repo root).task docs— matlatl strict gate green (0 broken/orphan/unreachable).task ac-trace-strict— green: all 15 ACs'verify:proofs resolve.task test:golden— refreshed Subagent/Parallel goldens, re-run clean.go run ./cmd/mecademo— full offline session.Panel review (inline, orchestrator mode)
PANEL: ship_blockers=0
branchToolre-tag copies all three new fields (engine/agent/parallel.go:632-634), and the TUI cap constants were renamed to the sharedmaxTrace*form (maxTeamNameWidthcorrectly stays Team-only).secure-code-reviewer: no findings — single chokepoint, total permission.ask drop, client-only discipline, ANSI-scrub at the engine boundary, double-truncation defense-in-depth in the TUI.code-duplication-reviewer+library-reuse-reviewer: no duplication in the renderers (converged on the sharedrenderTrace/routeTraceEvent);shrink:-class polish only (inline canary scan could call the extractedassertNoVerbatimCanary; a vacuous loop indelegation_payloads_test.go; two alias consts inconversation.go). None are ship-blockers; noted for a future cleanup pass.Co-Authored-By: mecatl [email protected]