Repository navigation
fix(context-panel): honest empty state, rebuild label, earlier range - #17355
chenmingwei23 wants to merge 2 commits into
Conversation
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that the start-row label rule, which treats only What this change shipsInventory (6 items) — 6 justifiedIntent: make the Context panel's copy state only true things about the empty state, rebuild rows and earlier turns. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] a38610d Description read[DESCRIPTION-READ] e32ba28d85a13477cd2a60f4e93fd935056d743c5d7f4f6a92d6649e39b11ac2 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — 🔴 BLOCK (blocking)Design-level review of Design-Verdict: BLOCK cannot evaluate: missing screenshots of the Context panel's new crew-log-off empty state, the "context rebuilt" row, and the earlier-turns range line. BlockersNo rendered evidence of this revision for a reshaped panel surface WatchThe rebuild label depends only on the turn number [DESIGN-REVIEWED] a38610d Description read[DESCRIPTION-READ] 55d3a66331335cd7bcb439482eac9411ab22c92fb3e90a24656078786408eaf0 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 |
UX Review (Opus 5.5, fork) — 🔴 BLOCKUX-level review of UX-Verdict: BLOCK cannot evaluate: missing screenshots. The image list is empty, so none of the three reworded Context panel strings has been shown rendered. Evidence gaps
Watch
Suggestions
[UX-REVIEWED] a38610d Description read[DESCRIPTION-READ] af803e13d041d1e5ca21d17036005046b9e50ca2ec0409e6e06195c320cc4494 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
edc2438 to
a7fdd93
Compare
Three wording problems in the Context panel, left over from kirodotdev#15367: - With the crew log switched off, the empty state said "No context breakdown recorded for this session yet." Nothing is ever recorded in that case, so "yet" was false. The trace payload now says whether the gateway is recording (`recording`, the same reading the crew-log fold read already returns). With recording off, the panel says so and names how to switch it back on. The other three ways to an empty list keep the "yet" copy, because for them it is true. - Every session-start row read "Turn N - session start", so a context rebuild at turn 41 read as a session that began at turn 41. Only turn 1 keeps that label; a later start row reads "Turn N - context rebuilt". - "44 earlier turns not shown" did not match the chart starting at turn 46 (turn 41 is listed above), and it read like a control that could reveal turns the fold no longer keeps. It is now a range that names the rows above neutrally: "Turns 1-45 earlier - 1 of them listed above". Copy in every locale, en-XA regenerated, translator context added, the metrics spec updated, and a capture harness for the evidence screenshots. Items 4 and 5 of the issue each need a decision first and moved to kirodotdev#17349. Fixes kirodotdev#15520
a7fdd93 to
508b425
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
The wording fixes look right: recording comes from crew_log_enabled(), so the empty state only says "yet" when data can still arrive, and a mid-session rebuild is no longer labelled the session start. One blocker: this branch commits six PNGs under temp-screenshots/context-panel-wording-15520/. This is a same-repo PR, so screenshots should be attached to the description (gh pr edit --attach or drag-and-drop) instead. Once merged, committed binaries stay in main history for good. Please drop those six files from the commit and attach them to the description. The capture script under website/capture/ is fine to keep.
buluoray
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (code). @iamwhatever's committed-screenshot block is still valid and still unaddressed at 508b4259df, so the PR should not merge until it is resolved.
What it brings: the Context panel stops misleading users in three places. With the crew log off it says nothing will ever be recorded and how to turn recording back on, a mid-session rebuild is no longer labelled as the session's start, and the earlier-turns line now matches the turn where the chart begins.
Reviewed head 508b4259df848151c3eee8763b85e3e9d1002d7e (single commit on merge-base ea7e91c8e6). CI on this head: 96 pass, 8 skipping, 0 failing, 0 pending. Sensitive Change Review passed. Auto-merge is off.
Blocking
None in code logic.
Prior human review: iamwhatever CHANGES_REQUESTED (on 508b4259df)
- Six PNGs committed under
temp-screenshots/context-panel-wording-15520/. Not fixed: all six are still in the head commit. The review's wording is slightly off: the head ischenmingwei23/KiroCrew, so this is a fork PR, not a same-repo one. The substance still holds, though. The repo allows committed media only for contributors without write access (.gitignore:113-119,.github/PULL_REQUEST_TEMPLATE.md"WITHOUT write access…",docs/ci/ci-and-reviews.md§"What happens to committed evidence at merge").chenmingwei23hasadminpermission onkirodotdev/KiroCrew(collaborators/chenmingwei23/permission), sogh pr edit --attachworks for them and that exception does not apply. The First Principles bot's "force-added … as.gitignore:116tells authors to do — justified" leaves out the write-access condition. This is a repo-hygiene finding rather than a code-logic defect, so it does not change my code verdict. It remains a gate: drop the six files and attach them to the description instead.
Non-blocking follow-ups
start_notecontradicts the new rebuild label. Real issue, please fix in this PR if you can. The UX Review flagged this as CONCERNS and the Design Review called it out too.ContextBreakdownPanel.tsx:685still renderspages.contextBreakdown.start_note("The session-start turn is shown above the chart so later turns stay readable.",en.json:6874) wheneverstarts.length > 0. In the issue's own case, a session whose only row is "Turn 41 · context rebuilt", the footnote calls that row the session-start turn, which is the misreading this PR set out to remove. It is not a truthfulness regression against main, where both strings said "session start". It is, however, an incomplete fix within the PR's own stated goal. Smallest fix: neutral wording that covers both kinds of row (e.g. "Turns that load the full context are listed above the chart…"), or pick the copy based on whether any listed row hasdisplayN !== 1. Either way, update the 12 locales anden.context.json.- "Turns 1–N earlier" never says those turns are left off the chart (UX Review suggestion). This is a matter of taste. "Turns 1–N not in the chart" would keep the range and stay non-clickable while saying why the turns are missing. Optional.
- Legacy rows with no ordinal.
displayNfalls back toturn.ordinal || i + 1(ContextBreakdownPanel.tsx:570). For rows recorded before ordinals existed, and with the day window dropping the true first turn, the first visible start row gets index 1 and is labelled "session start" even if it was a rebuild. The case is narrow and the label behaves exactly as it did on main. Noted only. - The First Principles bot's check ("is turn 1 always the session's real start?"): yes for ordinal-bearing rows.
ordinalis the session's own turn position (usage.py:745-747,:861), so a start composition at ordinal 1 is the session start and any later one is a rebuild. The legacy fallback in item 3 is the only exception.
Upgrade impact
- New gateway with an old SPA: the payload only gains
recording, and older readers ignore it. - Old gateway with a new SPA:
recordingis absent, sotrace?.recording === falseis false and the panel shows the existing "…yet" copy. That is main's behaviour. - Catalog:
earlier_hidden_*is removed from every locale and frompluralKeys.json. Its only reader was the panel, which now readsearlier_range*/earlier_single(grep finds no remainingearlier_hiddenunderwebsite/src). - Crew log off with turns already on disk: the list is non-empty, so the old data still renders and the off copy appears only when the list is empty. Nothing that works on main is newly refused. No new prompt and no new config.
- Intended changes: only copy changes. Every number, ordinal and the hidden-turn arithmetic (
hiddenat:600, which gates whether the line appears) is unchanged.
Error paths
recordingreads the samecrew_log_enabled()ascrew_log.py:415. Because that function treats an unrecognised value as off, a typo'd opt-out readsrecording: false, which is accurate. Fail-closed, and the copy stays truthful.- A missing or older payload falls back to the "yet" copy, matching main. Fail-closed.
- An empty trace caused by an unreadable fold still shows "yet" (
test_an_unreadable_fold_reads_as_nothing_folded), as on main. Not a new path.
What I verified
Verified against source at the head SHA: the diff end to end, crew_log_enabled() semantics (constants.py:148-163), the crew-log fold's matching recording field, the spec update in docs/system-specs/modules/metrics.md (it now describes the range wording, the rebuild label and the off state, so it is not stale), the start_note contradiction (:685 / en.json:6874), and the author's permission level.
Baseline: test/metrics/test_context_trace.py 58 passed; website/src/test/ContextBreakdownPanel.test.tsx 40 passed.
Mutations (each applied alone; file restored afterwards; git status --short clean):
| # | Mutation | Reddens |
|---|---|---|
| M1 | usage.py:907 "recording": True |
TestContextTrace::test_the_payload_says_whether_the_crew_log_is_recording |
| M2 | ContextBreakdownPanel.tsx:548 off-branch condition → false |
does not promise data while recording is switched off |
| M3 | :474 displayN === 1 → true |
labels only turn 1 as the session start and a later start row as a rebuild, lists a regenerated start turn once, from its newest attempt, announces the start row by its TRUE ordinal, matching what the row displays |
| M4 | :607 startsBeforeFirstShown > 0 → false |
counts a regenerated turn once when two session-start rows share its ordinal |
| M5 | :613 lastEarlier === 1 → false |
names a single earlier turn without a range |
Each new branch is covered by at least one named test. Not checked: I did not run the full suite, tsc -b or the i18n gate locally (CI is green on this head), and I did not open the six screenshots.
|
@iamwhatever thanks, done.
|
|
@iamwhatever thanks for the review. Where it stands on the screenshots:
Could #17734 be squash-merged, so it lands as one commit? |
Problem / Motivation
Goal: The Context panel's wording says only true things: an empty panel says whether data will ever arrive, a mid-session rebuild is not labelled as the session's start, and the earlier-turns line adds up with what is on screen.
Three wording problems were left over from #15367 (items 1, 2, 3, 6 and 7 of #15520):
Why it matters
Anyone reading the panel is misled by all three. A user with recording off waits for data that will never arrive. A user reading a rebuild row thinks their session restarted. A user who adds up the numbers finds they do not match and cannot tell why. None of these is a wrong number; each is copy that says something untrue about a correct one.
Not a goal
What changed (motivation → approach → change)
context_traceinsrc/kiro_crew/dashboard/handlers/usage.pyreturnsrecording, read through the existingcrew_log_enabled(), the same reading the crew-log fold read already returns. The TS interface declares it optional, so a payload from an older gateway reads as recording. Whenrecording === falsethe panel shows "Context breakdown is not recorded while the crew log is off. Remove KIROCREW_CREW_LOG from the gateway's environment and restart the gateway to record it." This follows the Crew Log panel's own off-state copy, so the user has a way forward. In every other case the existing "…yet" copy stays.en.context.json, the plural key list is updated, anddocs/system-specs/modules/metrics.mddescribes the new wording.website/capture/context-panel-wording.*is an isolated capture entry and shoot script that render the realContextBreakdownPanelfrom fabricated traces. They produced the screenshots below, which are attached to this description rather than committed.Backwards compatibility
Compatible: the payload only gains an optional
recordingfield. Readers that ignore it keep working, and the panel treats its absence as recording.Reader: website/src/pages/ContextBreakdownPanel.tsx:earlier_hidden -- chat -- the only reader of the removed
pages.contextBreakdown.earlier_hiddencatalog keys; it now readsearlier_range/earlier_range_starts/earlier_single, pinned by ContextBreakdownPanel.test.tsx and the i18n key-refs gate (0 dangling).Tests
test/metrics/test_context_trace.py: newtest_the_payload_says_whether_the_crew_log_is_recordingchecks thatrecordingfollows the switch, and the payload-shape test now includes the field.test/test_usage.py,test/metrics/test_usage_turns.pyandtest/test_source_pin_budget.pyalso pass locally (228 passed).website/src/test/ContextBreakdownPanel.test.tsx: expectations updated to the range wording and the rebuild label. New tests cover the off state (names the way back), the "yet" state, a single earlier turn, and turn 1 "session start" next to a later "context rebuilt". WithContextBreakdownTab.push.test.tsx,SessionBreakdownTree.test.tsxandsrc/i18n/catalogParity.test.tsthis is 141 tests, all passing.node scripts/i18n-check.mjsagainst the base passes all 19 checks.tsc --noEmitand eslint on the touched files are clean.Manual verification
Rendered the real panel for every variant with
node capture/shoot-context-panel-wording.mjs(Vite plus Playwright on loopback, no gateway), in dark and light themes. The screenshots below come from that run.Screenshots / video
Recording switched off, then recording on with no turn yet:
Turn 1 "session start" next to a later "context rebuilt" row:
A rebuild at turn 41 with the chart from turn 46 (the case from the issue). It reads "Turns 1–45 earlier · 1 of them listed above":
Range with nothing listed above, and a single earlier turn
Related Issues
Fixes #15520
Follow-up: #17349 (items 4 and 5 of #15520).
Pattern harvest
Not generalizable: each of the three is copy that was true for the panel's state before #15367 and went stale when the panel switched to the
usagefold. There is no code shape a rule could match.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.