Skip to content

feat(crew-log): a subagents fold, and a panel section that draws it - #15078

Merged
bolichen97 merged 1 commit into
mainfrom
feat/subagents-fold
Oct 1, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/subagents-fold

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let a reader see, in one place, which subagents a session dispatched and what each one cost.

A session's crew log already records every child it dispatched -- subagent/spawned,
subagent/steered, subagent/completed, subagent/failed -- and, since #14966, what each
one cost. Nothing folds those into an answer. They fall into timeline, whose value is a
200-entry window shared with every other entry type, so on any session that ran a few turns
the subagent entries have already aged out of it. Asking "which children did this session
dispatch, how did each end, and what did they cost" means reading the raw log.

Why it matters

Subagent spend is a real number a user is charged for, and today it is only visible on a
live card, fed from runtime memory over a WebSocket frame. Close the tab and the answer is
gone; reopen the session tomorrow and there is nowhere to read what its children cost. The
crew log has the bytes, so the answer should be derivable from the record rather than only
observable while the work is running.

It also removes one of the copies. The same number lives in the runtime accumulator, the
terminal tombstone, the persistence record, the WS frame and its replay, and the browser
store, and keeping those agreeing is where subagent numbers go wrong. A fold is derived
from the log, so it cannot disagree with the record without the record itself being wrong.

Not a goal

  • Changing what the subagent card in the conversation reads. The card still takes its
    terminal numbers from the subagent_done frame; repointing it at this fold is a separate
    change to a WebSocket contract, and deliberately not bundled here.
  • Adding a push. The fold is carried by the EXISTING growth push: _publish
    (src/kiro_crew/dashboard/handlers/crew_log.py:1918) folds
    projections.PROJECTION_NAMES, so the panel gets this fold over the socket the same way
    it gets the other six, with no new frame and no change to that code. A push of its own
    is what is not a goal.
  • Anything about the eager path. This fold is lazy, for the reason in "What changed".
  • Dollar conversion, and native-harness subagents (those bill through their parent turn,
    which turn/completed already covers).

What changed (motivation → approach → change)

Base main. #14975 merged, so this is not stacked.

The approach is the one src/kiro_crew/crew_log/projection.py already uses for tools: pair
an opener to its closer by id, bound the rows, keep totals exact where rows are capped. src/kiro_crew/mcp_crew_log.py and src/kiro_crew/validation.py both gain the name, pinned
by a test. docs/feature-map/README.md and
docs/reference/crew-log/reading-from-an-agent.md move to six folds.

Six rules make the result trustworthy. The spec
(docs/system-specs/modules/crew-log-projection.md) carries the reasoning:

  • totals.spawned counts every dispatch, by_id only retained rows, with omitted
    counting every dispatch that got no row -- past the cap, unusable id, or a repeated id -- so
    spawned == len(by_id) + omitted really is checkable. The cap REFUSES a new dispatch rather
    than evicting a row, so the retained rows are the EARLIEST and the copy says so.
  • A closer with no row still bills via totals.closed_unmatched; the empty state keys on
    both, since closers alone still cost.
  • running has two floors, and says when it is only a floor. spawned - closed survives
    the cap; the open rows are the other floor. With both at once it can still be short, so
    running_exact is false and both surfaces say "at least".
  • Absent is never zero, for BOTH measurements. No charge leaves credits null, no
    duration leaves ms null; credits_reported / ms_reported make a zero total legible.
  • A charge is screened on the RESULT. _credit_charge is the module's one shape screen,
    shared with _bill_credits: it rejects bool and an integer too large for float, whose
    OverflowError would crash every later read. Sign, NaN and infinity screen on the total.
  • The row, the state AND the render retain only what something reads. scope, spawn time,
    turn and steer count are gone, subagent/steered is out of affects, and no open id list
    or limit survives -- a lister filters by_id for an absent outcome.

The fold is lazy, and that is the eager path's constraint. Import asserts
EAGER_FOLD_NAMES <= SLOT_PROJECTION_NAMES, which a session-keyed fold cannot satisfy. Pinned
by a test.

In website/src/pages/chat/CrewLogPanel.tsx, CREW_LOG_FOLDS gains 'subagents' and
SubagentsBody draws a five-column table plus a dispatched count, its first column headed
subagent because Status already uses agent for the assistant. Strings land in all 13
catalogues. Six more rules there:

  • Every reason goes through ErrorNotice, one container: the only closer carrying a
    reason passes info.error, so it is an error wherever the outcome landed. The outcome
    still owns the pill.
  • The reconciliation line splits by whether a reader can get there, in ONE sentence per
    case rather than a base plus an addition.
  • The credits header states its relationship to the session total: a child's charge is
    inside Usage's credits, not added on top.
  • Outcome wording is a literal key map.
  • A truncated name is recoverable from the cell's own title.
  • The panel is reached through a lazy import(), so all six sections leave the eager
    chunk. Measured below.

Rows are ordered by seq_spawned: JSON revives a digit-like agent id first.

Backwards compatibility

Compatible: this adds a fold and a panel section. No entry type, emitter or route changes,
and no existing fold's stored state changes -- a new fold lands at the base savepoint
version with no bump, because _resume_one matches a savepoint file to a fold by NAME and
no file on disk claims to be this one, so nothing existing is retired.

Bundle Size Gate caught this section pushing the App chunk 2,318 B past its 1978 KB budget.
No budget was raised. CrewLogTab is now reached through a lazy import() in both consumers --
pages/chat/ActivityViewer.tsx and pages/members/MembersPage.tsx -- each wrapped in
ErrorBoundary + Suspense with a ContentSkeleton fallback, the shape CapabilitiesPage
already uses for its templates tab and DeveloperPage for the memory graph.

Measured, three builds: main alone builds App at 2,024,034 B (1,438 B under the budget, so main
had not drifted); this branch eager built 2,027,790 B, 2,318 B over; this branch with the boundary
builds 2,005,959 B, 19,513 B UNDER the untouched budget, plus a 22,166 B CrewLogPanel chunk
fetched when a reader opens the tab. check-bundle-size.mjs is byte-identical to main. All six
sections leave the first load, so the eager shell is smaller than before this PR.

No cost or duration aggregate in this fold. usage already folds one from these same closers --
CREDIT_SOURCES carries subagent, so credits_by_source.subagent is {credits, reported}
over exactly this population -- so a second spelling here would be two things to keep in step.
A summed duration had no such owner, but no reader either, and the rule stated for a row holds for
the totals: a field kept against a reader that does not exist is state paid for on every copy and
every savepoint write. Both figures ride per child on the row that closed. The cost is narrow and
real -- for a child whose dispatch left no row, the outcome counters and closed_unmatched record
that it ran and how it ended, and how long it took is kept nowhere. state_version moves one step
per change to what the fold stores, retiring its own savepoints and leaving every sibling's
standing.

The unmatched-closer sentence is a PLURAL key, registered in website/src/i18n/pluralKeys.json
so i18next picks the form: this line routinely renders at exactly 1, because one lost
subagent/spawned append is one child, and a formatted count would always select other.
Each catalogue carries the forms its own language needs -- one,other for de/hi/bn,
many,one,other for es/fr/it/pt, all four for ru, other alone for ja/ko/zh-CN.

Every string this section draws is a new key in website/src/i18n/locales/en.manual.json and
the eleven translated catalogues beside it; website/src/i18n/locales/en-XA.json is generated
by npm run i18n:pseudo rather than written.

The child table is drawn only when it has a row. spawned at 0 with a closer billed is a real
state -- the escape above it deliberately does not return the empty-state copy, because that
would deny a cost the totals hold -- and it leaves by_id empty, so an ungated table would be a
thead over an empty tbody. The section shows its tile alone there instead.

One frame grows without its shape changing. _publish folds
projections.PROJECTION_NAMES, so a projection-growth push now carries a seventh entry --
the same envelope, one more name in it. A client reading the folds it knows by name is
unaffected; there is no new frame type and no change to the push code.

Tests

test/test_crew_log_projection_subagents.py, 30 cases, each watched red first:

  • a finished child lands outcome, duration and cost on its own row, and leaves open
  • a stopped child counts as stopped, never as failed
  • steers land on their child's row; a steer for an unknown id is counted, invents no row
  • past OPEN_RETAIN_LIMIT, a further dispatch is counted in omitted and not retained
  • a closer with no row bills its outcome, ms and credits and raises closed_unmatched
  • totals.spawned == len(by_id) + omitted on a session past the cap
  • an unreported charge leaves the row null and credits_reported at 0
  • a planted non-numeric charge (True, "2.0", None, dict, list) is refused, driven at
    the fold because the writer's declaration already rejects those
  • rows render in dispatch order; the copier leaves the handed state untouched
  • the fold is lazy and absent from EAGER_FOLD_NAMES
  • an integer past the float range closes its child and drops only the unusable charge,
    rather than raising out of the fold
  • a charge is screened against the total it would JOIN, so two finite charges that overflow
    on the way up are refused and the total stays finite
  • NaN, each infinity and a negative are refused by that same result rule
  • running stays exact past the retention cap, where open cannot, and floors at 0 when a
    log holds more closers than openers
  • a row carries only the fields something reads (asserted as an exact key set)
  • GET /api/sessions/{id}/crew-log/projection/subagents serves it on the existing route

One of these is a regression test for a real defect the savepoint suite caught during
development: the step reached its closer branch by falling through the two above it, and
advance/fold call step for every entry in the file rather than only the ones affects
names -- so every turn/completed in the log was billed as a child that closed. The test
drives five unrelated entry types through the step and requires the rendered value to equal
a fresh one.

test/test_crew_log_checkpoint.py gains the fold's state pin, which is what obliges a
version bump if its stored meaning ever changes.

Frontend: website/src/test/CrewLogPanel.test.tsx gains the fold to its bundle plus a table
snapshot, and twelve cases -- the three credits/elapsed states told apart, no credits total
invented when nothing reported one, both halves of the reconciliation split, "at least" drawn
in both places when running_exact is false and nowhere when it is true, the empty state
drawing its own copy rather than a header over an empty body, the credits header carrying its
relationship to the session total, a truncated name recoverable from its title, and rows
staying in dispatch order when an agent id is spelled as digits. src/i18n/deadKeys.test.ts
is what the literal key map answers to: an assembled key left all four outcome words
referenced nowhere.

Manual verification

website/scripts/capture-crew-log-panel.mjs, the existing harness for this panel, gains the
fold to its fixture and seven scenarios, which assert before they photograph: the table's row
count, dispatch order, that the running child draws neither a zero duration nor a zero charge,
that a failure's row carries role="alert" and a stop's does not, all three reconciliation
sentences with the frames that make each one true, the hedge appearing in both places when the
count is a floor and in neither when it is not, and that the empty state renders no table at
all.

Bundle Size Gate caught this section pushing the App chunk 2,318 B past its 1978 KB budget.
No budget was raised. The panel is now reached through a lazy import() in both consumers --
ActivityViewer.tsx for the chat route's activity sidebar and MembersPage.tsx -- each wrapped
in ErrorBoundary + Suspense with a ContentSkeleton fallback, the shape CapabilitiesPage
already uses for its templates tab and DeveloperPage for the memory graph. A stale chunk after
a deploy therefore rejects into a local boundary instead of the app-shell error screen.

Measured, three builds: main alone builds App at 2,024,034 B (1,438 B under the budget, so main
had not drifted); this branch eager built 2,027,790 B, 2,318 B over; this branch with the lazy
boundary builds 2,005,959 B, which is 19,513 B UNDER the untouched budget, plus a 22,166 B
CrewLogPanel chunk fetched when a reader opens the tab. check-bundle-size.mjs is byte-identical
to main. The boundary moves all six fold sections off the first load, not just this one, so the
eager shell is smaller than before this PR.

The table's width was measured rather than eyeballed, at panel widths 360, 430 and 520:
scrollWidth == clientWidth at all three, no cell's right edge past the panel's content
box. The only truncation is the model column's own max-w, the same posture the tools
fold takes for a long tool name, and the full value is now on the cell's title.

Screenshots / video

The fold open, showing the three states -- a reported charge, a child that reported none, and
a child still running. The credits header carries the dotted underline that says a child's
charge is inside the session total:

subagents fold

Past the retention cap: the header counts all 14 dispatches while the table holds 3 rows, and
the line below says this list cannot show the rest and why.

subagents fold past its cap

The other side of that split -- 17 children retained, 12 drawn, none dropped. Every unlisted
child is still in the projection, so the line points at the agent instead of closing.

more rows than the table draws

Both at once, the only state where both sentences are true: 17 retained and 2 the record kept
no row for.

trimmed and dropped together

running reported as a floor rather than the answer: the collapsed header and the footer
clause both say "at least", because a dispatch dropped past the cap plus a closer that
matched no row leaves the count short by an amount the fold cannot name.

running reported as a floor

Two reasons under different outcomes, both on the error surface. The stopped row is an
operator's stop whose kill then failed: neutral outcome, real reap failure in the reason.

a failure beside a stop

No subagents dispatched, which is what the section shows on first expand for most
sessions: its own copy, not an empty table.

no subagents dispatched

Only closers reached the log: a child whose subagent/spawned append was abandoned in a
write/dropped marker still gets closed, so spawned stays 0 while ms and credits are
billed against a child that genuinely ran. Neither neighbouring state is honest here -- the
empty-state copy would deny that cost, and the child table would be a header row over an
empty body -- so the section drops its tile AND its collapsed-header summary, both of which
would state a 0 the sentence contradicts, and the sentence
stands alone: the singular form this state produces most often, saying why the count would be
zero and where the credits went.

only closers reached the log

The section with every fold collapsed, dark and light

dark
light

Related Issues

no linked issue: this is a new feature, and the repo's policy is that a feature carries its
context in the PR rather than in a tracking issue (only problems and bugs get issues). The
issue-shaped numbers above are pull requests, all three now merged -- #14975 was the base this
was stacked on, #14966 and #14515 are predecessors -- so none of them closes on merge.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@chenmingwei23
chenmingwei23 requested a review from a team as a code owner September 29, 2026 18:08
@chenmingwei23
chenmingwei23 requested review from cruisercohen and removed request for a team September 29, 2026 18:08
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Intent: Make "which subagents did this session dispatch, how did each end, and what did each cost" answerable from the crew log itself, by one fold read, so the answer survives the tab that watched the work.
Not a goal: Repointing the subagent card in the conversation at this fold (that changes a WebSocket contract and is a separate stage); pushing this fold over a socket; making it eager; dollar conversion; native-harness subagents, which bill through their parent turn.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of b7364da97a71fc35a3fad474e3b78ab567b4c594 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] b7364da

Description read

[DESCRIPTION-READ] 33ecac292159994edec7a644804c8edf5b3c839a10aff679477e772fe19d6b6f

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of b7364da97a71fc35a3fad474e3b78ab567b4c594 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Each published row echoes agent_id under a by_id key that already says it — zero consumers, against the fold's own "only what something reads" rule.

Not justified as shipped

  • Item 7 — zero consumers: _subagents_render publishes agent_id inside every row while keying by_id by the same value; grep for agent_id in website/src/pages/chat/CrewLogPanel.tsx finds 0 reads (the panel uses the Object.entries key throughout), and the spec's own retained-field list — "seq_spawned …, agent, model, outcome, ms, credits and reason" — omits it.
    Subtraction: in _subagents_render, iterate state["by_id"].items() and drop agent_id from the published row; the key carries it.
    Clears when: the field is removed from the render, or a counted non-test consumer of row.agent_id is named.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a reader see, durably, which subagents a session dispatched and what each cost — an ADDITION.

  1. A session's crew log now answers "which children ran, how each ended, what each cost" from the record, not just the live card — justified
  2. The Crew log panel gains a Subagents section (table, header counts, reconciliation sentences, 13 locales) — justified
  3. Agents can read the same fold via crew_log_projection — justified
  4. The Crew log tab now loads on first open instead of in the app shell, in both hosts — justified
  5. A fold section with no header summary now shows none (quiet header for the closers-only state) — justified
  6. Credit-charge shape screening now has one spelling, shared by usage and subagents — justified
  7. Each published row repeats agent_id beside its own key — zero consumers (0 reads counted in the SPA; tests and fixtures excluded)
  8. Feature map, agent-reading reference and projection spec move to six folds — justified

[FIRST-PRINCIPLES-REVIEWED] b7364da

Description read

[DESCRIPTION-READ] e4cc4267cde9bc96bd83836611977940f40d1105dcf042111fcb21b502740e18

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of b7364da97a71fc35a3fad474e3b78ab567b4c594 and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- docs/system-specs/modules/crew-log-projection.md:273 -- Two finite charges can overflow usage, so “over exactly this population” is false -> Fix: qualify the aggregate as covering only accepted charges.
[GPT-REVIEWED] b7364da

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b7364da97a71fc35a3fad474e3b78ab567b4c594: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of b7364da97a71fc35a3fad474e3b78ab567b4c594 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

The new reconciliation fine print is machine-speak, and its inert "Ask the agent for the full list" mimics the clickable Ask-the-agent link one row above.

Watch

  • Phrase collision: subagents_undetailed renders "Ask the agent for the full list." as plain muted text while ErrorNotice's "✨ Ask the agent" is a link on the same section — reader: "I'd want to click it and can't." Hits every capped session, every render. Make the sentence the askAgent hand-off, or reword so it doesn't quote the link's label.
  • Record-jargon: "The record kept no row for them" and "finished with no start in the record" are the strings the reader said they'd "most want a plain-language version of" ("sounds impossible to me"); in shot-08 that sentence is the section's entire content and it "makes me trust the table less." Reword in user terms, e.g. "Details for {{count}} of them weren't kept" / "{{count}} subagent finished but its start was never logged."
  • Closers-only header (shot-08) shows no summary where every other state shows "dispatched: … · running: …" — reader "can't tell whether that's a different situation or something missing." Rare state, but it reads as broken; give the header a non-numeric summary (e.g. "1 finished · no details") instead of silence.

Suggestions

  • Credits column: "not reported" vs "—" are indistinguishable to the reader; add a title on the not-reported cell ("closed without reporting a charge") matching the panel's dotted-hint idiom.

[UX-REVIEWED] b7364da

Description read

[DESCRIPTION-READ] 4211419bad3699a4766697cdb80e64ec35502dfc3368b52a23afc217b85adb45

That sha256 names everything this verdict read: the PR description, plus the 13 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: reworded the unmatched-closer line

  • "closed without a matching dispatch" defeated the blind reader (span=6318140d7f77)

Fixed in 0573ef1. The wording was the fold's vocabulary, not the reader's.

It now reads "N more finished, but this list does not have their start". One earlier
attempt is worth naming so it is not re-suggested: "too early to be listed here" reads
better and is FALSE -- these children are not pending, their start was dropped past the
retention cap or their opener predates the log, so a friendlier untruth would have been
worse than the jargon.

The line's job is to explain why the totals exceed the table, and it now says that
without asking the reader to know what a dispatch is.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: dotted-underline hint stating the subagent credits are part of the Usage total

  • Two credit totals, no stated relationship (span=0700f5fea0e2)

Fixed in 0573ef1, and the answer is a fact rather than a hedge: since #14966 the usage
fold bills subagent/completed and subagent/failed into its own total and buckets
them by source, so the subagent figure is a SUBSET of Usage's, never a second independent
charge.

The credits tile now carries hint, which is the same dotted-underline affordance the
Usage tiles already use, reading "Already counted in the Usage credits above -- this is
the part of it the subagents spent." Agreed this is the item that most needed fixing: it
is money, and the relationship was unreadable.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: feature map moved from five folds to six

  • Sixth fold leaves feature map stale (span=aa05298108d7)

Fixed in 0573ef1. docs/feature-map/README.md claimed five folds in four places and listed
the route enum without this one: the Crew log panel row, the Session crew log row, and the
Crew log agent reads row. All now say six, the enum reads
{status,usage,timeline,tools,approvals,subagents}, and the panel row's prose names what
the sixth answers.

check_feature_map.py with FEATURE_MAP_BASE_REF set to this PR's base passes.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: OverflowError guard on the credit conversion, plus an exact running count

  • Valid credit value crashes projection reads / Retention discards the exact running count (span=edc024cbb4a9)

Both fixed in 0573ef1; one span, so one record.

The crash is real and reachable. Python's int has no magnitude limit, so an integer
past about 1.8e308 passes the isinstance(value, (int, float)) check and then raises
OverflowError inside float(value). The line stays on disk and nothing rewrites it,
so the raise would have turned EVERY later read of that session's fold into a permanent
crash. _subagent_credits now catches it and returns None, the same posture
_ledger_iso takes for its own overflow: the child still closes, only the unusable
charge is dropped.

The running count is also right. open is built from retained rows with no outcome, so
a dispatch dropped past the cap has no row to be counted in -- a session with 600 children
in flight read as 512 or fewer. render now also emits running, derived from the
totals as dispatches minus closers, which retention never touches, floored at 0. The panel
header reads running; open remains the listed subset and the spec says so.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: dropped two retained row fields and gave the other three a reader on the row

  • Item 6 -- zero consumers (span=df19a82f8017)

Fixed in 0573ef1. The finding is right: the row retained five fields nothing drew.
Both halves of "Clears when" are now done, split by whether the field earns a reader.

DELETED, because no surface wants them: the child's inherited scope (and its
_subagent_scope coercion) and time_spawned. seq_spawned stays and is not
decoration -- _subagents_render orders the rows by it, and it is deliberately the seq
rather than the clock, since two children dispatched in one millisecond tie on a time.

DRAWN, because they answer "what happened to this one": turn and steers on a detail
line under the child's name, and reason on its own full-width row for a child that did
not finish, where it can be read instead of truncated.

test_a_row_retains_only_fields_something_reads now pins the row's key set exactly, so
a field added back without a reader fails rather than ships.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed b7364da97a71fc35a3fad474e3b78ab567b4c594 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b7364da

Verdict parsed from the review's SHA-scoped output markers for commit b7364da97a71fc35a3fad474e3b78ab567b4c594.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b7364da97a71fc35a3fad474e3b78ab567b4c594: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: extracted the module's single credit screen, moved the invariant onto the result

  • Item 9 - duplicate of _bill_credits (span=8942ba13f943)

Fixed in 44b9cc5, taking the first branch of "Clears when": the fold now bills under the
module's single screen rather than justifying a divergence.

_credit_charge(value) is extracted as THE shape screen for a credits field anywhere
in this module -- the isinstance check plus the guarded float() -- and
_bill_credits now calls it too, so there is one spelling instead of two.

The deeper half of the finding was right as well, and I had it backwards: my per-charge
clauses (< 0, NaN, each infinity) were exactly the approach _bill_credits' own
comment argues against, and they still missed the case no per-charge check can catch --
two FINITE charges that overflow on the way up. _subagent_credits now takes the total
the charge would join and applies the same result-invariant: stay finite, never go down.
One clause, every shape, including that one.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: credits label states its own coverage

  • "credits, all subagents" overclaims (span=08348e301187)

Fixed in 44b9cc5. "all subagents" claimed coverage the figure does not have, and the reader was
right that nothing on screen could settle it.

The label now reads "credits, reported by N of M" -- built from credits_reported and
spawned, which the fold already held, exactly as suggested. With 14 dispatched and one
charge reported it says "reported by 1 of 14", so the gap is visible instead of implied.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: unmatched line rewritten to the consequence

  • Unmatched-closer line still not understood (span=a6726470f9e0)

Fixed in 44b9cc5, using your wording almost verbatim: "N finished subagents aren't listed;
their cost is included in the totals above."

Worth recording why two rounds failed here, since both failures were the same mistake.
"closed without a matching dispatch" and then "this list does not have their start" both
described the fold's BOOKKEEPING. The reader does not have that model and does not need
it; what they need is what it means for them -- these are missing from the table, and
their cost is already in the totals. Stating the consequence was the instruction both
times and I described the mechanism both times.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: running child draws a dash for its charge, matching its elapsed cell

  • Running child's credits cell reuses "not said" (span=9dc94433b20e)

Fixed in 44b9cc5. Agreed, and it undid the distinction the cell exists for: I built three
states and then drew two of them with the same words, so "free, unknown, or not yet
reported" was unanswerable.

A child with no outcome now draws the same dash its elapsed cell draws -- its cost is not
knowable yet rather than withheld -- and "not said" is reserved for a child that CLOSED
having reported no charge. The vitest case and the screenshot harness both assert the
running row draws a dash in both numeric cells.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: dotted-underline hint on the corrections count

  • "corrections" undefined to the reader (span=f92137761038)

Fixed in 44b9cc5. The count now carries the dotted-underline title hint the panel's other
labels use, reading "Corrections the parent session sent into this subagent while it was
running."

The word is mine rather than the record's -- the entry type is subagent/steered -- so
it had no definition anywhere on the surface for the reader to find.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: failure reason renders through ErrorNotice with the askAgent hand-off

  • Failed subagent errors bypass the required error surface (span=aa05298108d7)

Fixed in 44b9cc5. Legitimate, and a blocking AUTOSDE rule: errors-use-error-notice tests
where the VALUE comes from, not how it is dressed, and a child's closer reason is the
outcome of something that failed -- the same category the rule names with "a job's
last_error". My plain muted <td> is the shape the rule calls out explicitly, an error
"rendered through a neutral container".

It now renders <ErrorNotice message={reason} askAgent variant="inline" />.
askAgent is ON deliberately: the rule says it must be on where there is nothing to
lose, and this is a read-only status panel with no draft the hand-off could destroy, while
a failed child is precisely what the agent can look into.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=76e673e69ac6. Fixed in db96634.

Split as you asked, one sentence per population. "{{count}} more counted above, not listed
here. Ask the agent for {{askable}} of them. The record kept no row for the other {{dropped}}."
The recoverable count is new and derived from the two the line already showed, so a reader who
subtracts gets what it says.

The old single sentence was carrying a subordinate clause, a semicolon and two different
populations at once, which is what made it unreadable. All eleven translations were redone
against the split version rather than patched.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=adc9f4099ea1. Fixed in db96634.

Taken exactly as prescribed: the tile is suppressed when nothing was dispatched, so the
closers-only state looks like the true-empty state in that respect and the sentence stands
alone. The new frame in the body shows it -- no tile, one sentence, and the sentence says why a
count would have been zero.

You are right that the previous revision did not fix this. I added the sentence and left the
0 above it, which is a contradiction a reader has to resolve on their own. The tile was the
half that had to go.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=338a8c1330b0. Fixed in db96634.

Took the first option: the footer reuses the button's own vocabulary. The button label is
"Ask the agent", and the footer now reads "Ask the agent for the full list." -- the same verb
phrase with its object named, in every locale, translated from that locale's own label rather
than invented.

Not the second option, and the reason is what AskAgentButton sends. Its title is "open a
chat with this error's full context attached" and askAgentPrompt builds an error report: it
is an error-handoff control. A reconciliation footer is not an error, so routing it through
that affordance would hand the agent an error that does not exist.

A note on the earlier ruling this reverses in part: an earlier revision moved the footer AWAY
from this wording because the sentence and the button read as two identical imperatives. Naming
the object is what separates them now -- "Ask the agent for the full list." is not the button's
label, while sharing its words. Three of eleven translations first came back with the label's
grammatical FORM rather than its words, which reads as a caption; those were corrected to each
language's own imperative.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted on the defect, span=2cc86a5ef735, though not by the route described. Fixed in db96634.

Checked the arithmetic before acting. At the retain cap the selection you describe cannot fire:
a dispatch is refused only once by_id holds 512 rows, and the table draws 12, so
undetailed is at least 500 + omitted while dropped is omitted -- the comparison is
false, and the hand-off sentence is the one that renders.

It IS reachable by the other path into omitted. An unusable or repeated agent_id is counted
and left unretained without the cap being involved, so with few rows dropped >= undetailed
holds. And there the sentence was worse than suppressed: it explained the loss by the retain
cap, which was not what happened.

So the wording no longer names a cause at all -- "The record kept no row for them." -- which is
true of all three ways a dispatch loses its row. The related comment in the fold made the same
single-cause claim and is fixed with it.

One fold answers "which children did this session dispatch, and for each one its
outcome, its duration and its cost" from one savepoint read, instead of leaving
the four subagent/* types to be swallowed by timeline's 200-entry window.

totals.spawned counts EVERY dispatch while by_id holds only the retained ones,
and the render emits omitted beside them so a reader can check
spawned == len(by_id) + omitted rather than mistake a capped window for the whole
list. A closer whose agent_id has no row still bills its outcome, duration and
credits into the totals, with closed_unmatched counting them: crash-repair
closes a child by matching agent_id across the whole file, so a closer routinely
names a dispatch that fell past the cap, and dropping it would under-report what
the session actually spent.

The panel's cells draw THREE states rather than two -- a charge, a child that
reported none, and a child still running -- because "0" and "0.0s" there would
present the absence of a measurement as a measurement of zero.
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=7c27e3067ace. Fixed in b7364da.

Correct, and it was a comment I should have updated in the same edit that moved the pin. It
still said subagents "lands at the base with no bump of its own" while the pin three lines
below read 5 and the registration read _FOLD_STATE_VERSION_BASE + 1.

The comment now says what is true: this fold is the first to exercise the per-fold bump, it
stands past the base, and every sibling stays at 4 so retiring its savepoints costs a cold fold
to that fold alone. It reads one step further now -- two past the base -- because a second
change to what the fold stores landed with this revision.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=b24c7968466b. Fixed in b7364da.

You are right and my previous answer was wrong. I kept these two arguing that usage holds no
per-child duration, so this fold was the only record of one. That is true and it is not a
reader. Grepping ms_reported and totals["ms"] across src/ and website/src finds zero
outside the defining fold and its fixtures, and the spec states the rule itself: a field kept
against a reader that does not exist is state this module pays for on every copy and every
savepoint write. "Nothing else holds this fact" does not clear that bar.

Both keys are deleted -- state, step, render, spec, fixtures. The cost is narrow and is now
written down rather than implied: for a child whose dispatch left no row, the outcome counters
and closed_unmatched still record that it ran and how it ended, and how long it took is kept
nowhere. A matched closer's duration still rides on its row, which is the figure the panel draws.

state_version is now two past the base and the pin is ("c4930a44d9ee6cc6", 6) -- one step
per change to what the fold stores, each retiring the savepoints written under the shape before
it, with every sibling left at 4.

This is the sixth field on this fold that turned out to have no reader, and the sixth time the
honest branch was to delete rather than to name one. The pattern is mine, not the lane's.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Declined, span=bdfc57e06ad4, with the reasoning below.

The remedy names AskAgentButton, and what that control SENDS is why I am not attaching it.
Its title is "open a chat with this error's full context attached" and askAgentPrompt builds
its message from components.askAgent.prompt_lead: "This error just came up in the dashboard.
Diagnose the root cause and fix it." A capped subagent list is not an error, so wiring the
footer to it would hand the agent a fabricated error to diagnose -- worse for the reader than a
sentence that is not clickable, because the thing it does is wrong rather than absent.

You are right that a sentence shaped like an instruction, next to a control shaped like the same
instruction, teaches the reader the sentence should be clickable. Two revisions ago this lane
asked me to make those two read as one vocabulary and I did; this finding is the cost of that,
and I do not think the answer is a third wording.

What I think is actually needed is a non-error hand-off affordance -- the same "open a chat with
this context" gesture without the error framing -- and that is a new shared control, not a
change to one panel's copy. That is outside this PR, and I would rather say so than fake it with
the error button.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Declined, span=b761a00508b8, on ownership.

Agreed on the substance: a reader who cannot predict what a control sends will not press it, and
naming the outcome in a title is the right fix. It just is not this PR's to make.

AskAgentButton already sets its own title --
components.askAgent.open_a_chat_with_this_error_s_context_attached -- so the control states
its outcome today, and if that string is not doing the job the change belongs on the component
where every one of its instances gets it. Editing it from here, or layering a second title
over it at one call site, would leave the same control explaining itself two different ways
depending on which panel drew it.

You note this is pre-existing and that this PR doubles its instances. Both true. Doubling the
instances of a shared control is not the same as owning its copy, and the finding reads better
filed against the component.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Confirmed as deliberate, span=c6eb09c0cfd2. No change.

You asked for a human to confirm the neutral pill over a red failure line, so here is the trace
it rests on rather than an assertion.

terminal.py passes reason=info.error or "" to on_subagent_failed, and
on_subagent_completed takes no reason at all. So a reason reaches a row from an error field
and from nowhere else. An operator's stop whose kill then FAILS keeps outcome == "stopped"
while info.error gains the reap failure -- which is exactly the row you read.

Both halves are therefore true of that row and they are about different things: the OUTCOME is
what the operator asked for and got recorded, and the REASON is an error that happened while
carrying it out. An earlier revision gated the reason's container on the outcome and put that
failure in a muted cell, which this lane's sibling rule errors-use-error-notice forbids,
because the rule tests where the value came from rather than how it is drawn.

So the contradiction the reader felt is in the event, not in the panel: a stop can fail. If a
human prefers the pill to escalate when a reason is present, that is a one-line change and I
will make it -- but it would mean the pill stops reporting what the log recorded, which is why I
have not chosen it myself.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Accepted, span=0dc065ab028d. Fixed in b7364da.

Right, and it is the same defect one line up from the one I fixed last revision: I hid the tile
and left the collapsed header stating a dispatched count of 0 and a running count of 0 (joined
by U+00B7) above "1 subagent finished".

The header now says nothing at all in that state -- just the section name. Both of those counts
are TRUE, which is what made rewording them impossible: nothing was recorded as dispatched and
nothing is running. True and unreconcilable beside the sentence is still unreconcilable, so the
honest move is to drop the summary rather than restate it, and the body's sentence carries the
state whole including why a count would be zero.

Worth noting it cost no new string in thirteen catalogues, which is the cheapest fix this lane
has asked for on this panel. The frame in the body shows it, and the harness throws if either
the tile or the summary reappears there.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved: PR Readiness passed on this head, no open change requests.

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.

2 participants