Repository navigation
feat(crew-log): a subagents fold, and a panel section that draws it - #15078
Conversation
|
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. |
Design Review (Fable 5) — ✅ PASSDesign-level review of 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 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Each published row echoes Not justified as shipped
What this change shipsInventory (8 items) — 7 justifiedIntent: let a reader see, durably, which subagents a session dispatched and what each cost — an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] b7364da Description read[DESCRIPTION-READ] e4cc4267cde9bc96bd83836611977940f40d1105dcf042111fcb21b502740e18 That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- docs/system-specs/modules/crew-log-projection.md:273 -- Two finite charges can overflow False positive or not applicable? A repository writer can comment: |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of 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
Suggestions
[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 |
bef4901 to
0573ef1
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
0573ef1 to
44b9cc5
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
Accepted, span=76e673e69ac6. Fixed in db96634.
|
|
Accepted, span=adc9f4099ea1. Fixed in db96634.
|
|
Accepted, span=338a8c1330b0. Fixed in db96634.
|
|
Accepted on the defect, span=2cc86a5ef735, though not by the route described. Fixed in db96634.
|
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.
|
Accepted, span=7c27e3067ace. Fixed in b7364da.
|
|
Accepted, span=b24c7968466b. Fixed in b7364da.
|
|
Declined, span=bdfc57e06ad4, with the reasoning below.
|
|
Declined, span=b761a00508b8, on ownership.
|
|
Confirmed as deliberate, span=c6eb09c0cfd2. No change.
|
|
Accepted, span=0dc065ab028d. Fixed in b7364da.
|
bolichen97
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on this head, no open change requests.
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 eachone cost. Nothing folds those into an answer. They fall into
timeline, whose value is a200-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
terminal numbers from the
subagent_doneframe; repointing it at this fold is a separatechange to a WebSocket contract, and deliberately not bundled here.
_publish(
src/kiro_crew/dashboard/handlers/crew_log.py:1918) foldsprojections.PROJECTION_NAMES, so the panel gets this fold over the socket the same wayit 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.
which
turn/completedalready covers).What changed (motivation → approach → change)
The approach is the one
src/kiro_crew/crew_log/projection.pyalready uses fortools: pairan opener to its closer by id, bound the rows, keep totals exact where rows are capped.
src/kiro_crew/mcp_crew_log.pyandsrc/kiro_crew/validation.pyboth gain the name, pinnedby a test.
docs/feature-map/README.mdanddocs/reference/crew-log/reading-from-an-agent.mdmove to six folds.Six rules make the result trustworthy. The spec
(
docs/system-specs/modules/crew-log-projection.md) carries the reasoning:totals.spawnedcounts every dispatch,by_idonly retained rows, withomittedcounting every dispatch that got no row -- past the cap, unusable id, or a repeated id -- so
spawned == len(by_id) + omittedreally is checkable. The cap REFUSES a new dispatch ratherthan evicting a row, so the retained rows are the EARLIEST and the copy says so.
totals.closed_unmatched; the empty state keys onboth, since closers alone still cost.
runninghas two floors, and says when it is only a floor.spawned - closedsurvivesthe cap; the open rows are the other floor. With both at once it can still be short, so
running_exactis false and both surfaces say "at least".creditsnull, noduration leaves
msnull;credits_reported/ms_reportedmake a zero total legible._credit_chargeis the module's one shape screen,shared with
_bill_credits: it rejectsbooland an integer too large forfloat, whoseOverflowErrorwould crash every later read. Sign, NaN and infinity screen on the total.scope, spawn time,turn and steer count are gone,
subagent/steeredis out ofaffects, and noopenid listor
limitsurvives -- a lister filtersby_idfor an absentoutcome.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. Pinnedby a test.
In
website/src/pages/chat/CrewLogPanel.tsx,CREW_LOG_FOLDSgains'subagents'andSubagentsBodydraws a five-column table plus a dispatched count, its first column headedsubagentbecause Status already usesagentfor the assistant. Strings land in all 13catalogues. Six more rules there:
ErrorNotice, one container: the only closer carrying areason passes
info.error, so it is an error wherever the outcome landed. The outcomestill owns the pill.
case rather than a base plus an addition.
inside Usage's credits, not added on top.
title.import(), so all six sections leave the eagerchunk. 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_onematches a savepoint file to a fold by NAME andno file on disk claims to be this one, so nothing existing is retired.
Bundle Size Gatecaught this section pushing theAppchunk 2,318 B past its 1978 KB budget.No budget was raised.
CrewLogTabis now reached through a lazyimport()in both consumers --pages/chat/ActivityViewer.tsxandpages/members/MembersPage.tsx-- each wrapped inErrorBoundary+Suspensewith aContentSkeletonfallback, the shapeCapabilitiesPagealready uses for its templates tab and
DeveloperPagefor the memory graph.Measured, three builds: main alone builds
Appat 2,024,034 B (1,438 B under the budget, so mainhad 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
CrewLogPanelchunkfetched when a reader opens the tab.
check-bundle-size.mjsis byte-identical tomain. All sixsections leave the first load, so the eager shell is smaller than before this PR.
No cost or duration aggregate in this fold.
usagealready folds one from these same closers --CREDIT_SOURCEScarriessubagent, socredits_by_source.subagentis{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_unmatchedrecordthat it ran and how it ended, and how long it took is kept nowhere.
state_versionmoves one stepper 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.jsonso i18next picks the form: this line routinely renders at exactly 1, because one lost
subagent/spawnedappend is one child, and a formatted count would always selectother.Each catalogue carries the forms its own language needs --
one,otherfor de/hi/bn,many,one,otherfor es/fr/it/pt, all four for ru,otheralone for ja/ko/zh-CN.Every string this section draws is a new key in
website/src/i18n/locales/en.manual.jsonandthe eleven translated catalogues beside it;
website/src/i18n/locales/en-XA.jsonis generatedby
npm run i18n:pseudorather than written.The child table is drawn only when it has a row.
spawnedat 0 with a closer billed is a realstate -- 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_idempty, so an ungated table would be atheadover an emptytbody. The section shows its tile alone there instead.One frame grows without its shape changing.
_publishfoldsprojections.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:openstopped, never asfailedOPEN_RETAIN_LIMIT, a further dispatch is counted inomittedand not retainedclosed_unmatchedtotals.spawned == len(by_id) + omittedon a session past the capnullandcredits_reportedat 0True,"2.0",None, dict, list) is refused, driven atthe fold because the writer's declaration already rejects those
lazyand absent fromEAGER_FOLD_NAMESfloatrange closes its child and drops only the unusable charge,rather than raising out of the fold
on the way up are refused and the total stays finite
runningstays exact past the retention cap, whereopencannot, and floors at 0 when alog holds more closers than openers
GET /api/sessions/{id}/crew-log/projection/subagentsserves it on the existing routeOne 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/foldcallstepfor every entry in the file rather than only the onesaffectsnames -- so every
turn/completedin the log was billed as a child that closed. The testdrives five unrelated entry types through the step and requires the rendered value to equal
a fresh one.
test/test_crew_log_checkpoint.pygains the fold's state pin, which is what obliges aversion bump if its stored meaning ever changes.
Frontend:
website/src/test/CrewLogPanel.test.tsxgains the fold to its bundle plus a tablesnapshot, 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_exactis false and nowhere when it is true, the empty statedrawing 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 rowsstaying in dispatch order when an agent id is spelled as digits.
src/i18n/deadKeys.test.tsis 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 thefold 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 reconciliationsentences 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 Gatecaught this section pushing theAppchunk 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.tsxfor the chat route's activity sidebar andMembersPage.tsx-- each wrappedin
ErrorBoundary+Suspensewith aContentSkeletonfallback, the shapeCapabilitiesPagealready uses for its templates tab and
DeveloperPagefor the memory graph. A stale chunk aftera deploy therefore rejects into a local boundary instead of the app-shell error screen.
Measured, three builds: main alone builds
Appat 2,024,034 B (1,438 B under the budget, so mainhad 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
CrewLogPanelchunk fetched when a reader opens the tab.check-bundle-size.mjsis byte-identicalto
main. The boundary moves all six fold sections off the first load, not just this one, so theeager shell is smaller than before this PR.
The table's width was measured rather than eyeballed, at panel widths 360, 430 and 520:
scrollWidth == clientWidthat all three, no cell's right edge past the panel's contentbox. The only truncation is the model column's own
max-w, the same posture thetoolsfold 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
creditsheader carries the dotted underline that says a child'scharge is inside the session total:
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.
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.
Both at once, the only state where both sentences are true: 17 retained and 2 the record kept
no row for.
runningreported as a floor rather than the answer: the collapsed header and the footerclause 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.
Two reasons under different outcomes, both on the error surface. The
stoppedrow is anoperator's stop whose kill then failed: neutral outcome, real reap failure in the reason.
No subagents dispatched, which is what the section shows on first expand for most
sessions: its own copy, not an empty table.
Only closers reached the log: a child whose
subagent/spawnedappend was abandoned in awrite/droppedmarker still gets closed, sospawnedstays 0 whilemsandcreditsarebilled 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.
The section with every fold collapsed, dark and 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