Skip to content

feat(decisions): strip shows what was sent and how long Jev took - #12245

Merged
bolichen97 merged 2 commits into
mainfrom
feat/decisions-strip-polish
Sep 20, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
feat/decisions-strip-polish

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

The ask

The shipped decision strip opens onto four counts. Three of them tell the reader nothing:

row what it printed why
Skills offered 44 real the menu size
Selection rounds 0 always 0 the menu is asked in ONE question; candidate batching went before ship
Context sent (characters) 0 always 0 counts only history, and the history budget ships at 0
Skills cut from the offer 0 always 0 counts prior-turn entries clipped to fit that same 0 budget

So a card whose whole job is "here is what this decision cost and what left this machine" answered 0 · 0 · 0, while a 2,000-char message excerpt had in fact left, and the latency was already on the row and simply not printed.

What this changes

One row for the egress, with both halves. Sent to Jev — message 96 chars, history 1,840 chars, the two halves joined by fmtList because what goes between two list items is a locale's decision. message_chars is one new int on the outcome record, measured by a new message_chars() over the same message_excerpt() that build_state_rows sends — one function, so the number on the receipt cannot overstate what left or miss the 2,000-char cap.

The latency, which needed no new field. Jev latency 197 ms on the expanded card and (0.81, 197 ms) in the collapsed parenthetical beside the score. latency_ms is one of the six core fields log.build_row stamps, and the record published to the strip is that row — so the reader keys on the log's own spelling instead of a duplicate the point would have to keep in step. A record without one prints no row rather than 0 ms, which would read as an answer that arrived instantly.

The two always-zero rows are gone, and build_outcome stops emitting truncated. Clipping is a fact about the transcript READ, which the call row still carries; on the strip it had no label that said so.

The contract moved on both sides in one change

docs/system-specs/modules/decisions.md § 8 holds the fenced record fixture that website/src/test/decisionStripContract.test.ts parses — so the gateway half and the reader half cannot drift apart silently, which matters here because the reader's fail-safe is to draw nothing and that is byte-identical to a release that stamps no record at all.

One bound in that section needed care: it says the record carries no message text, and the contract test enforced it by asserting the serialized fixture contains no message. A length is not the text, so the test now forbids "message" with its quotes and asserts message_chars is present and numeric — the narrower key cannot smuggle the wider one back in.

Tests

Extended in place, no new files.

  • sel.message_chars / sel.message_excerpt across empty, short, at the cap and over it (parametrised on the LENGTH — a multi-kB parameter value gets baked into the pytest node id), plus the identity through build_state_rows so a second cap cannot drift from the one that ships.
  • the outcome row: message_chars is what left, latency_ms is an int, and batches / rounds / truncated are each asserted ABSENT.
  • the reader: both new fields floored and refused like every other count; a gateway stamping neither still renders, at 0.
  • the collapsed parenthetical in all three states — both measurements, score only, latency only — each with the legend that case gets, because a title naming a number that is not there is the failure mode of folding two things into one span.
  • the expanded rows: message 96 chars, history 1,800 chars, Jev latency, and the two removed labels asserted gone.

Gates run locally

gate result
test_decisions_* (9 files, 563 tests) pass
DecisionStrip.test.tsx + decisionStripContract.test.ts (54) pass
src/i18n/ vitest (42 files, 692) pass
i18n:check (19 checks, I18N_BASE_REF set) PASS
typecheck, eslint, lint:theme-colors, lint:phantom-classes, lint:i18n pass
docs_lint.py, check_feature_map.py, check_comment_history.py, check_brand_name.py, check_focus_cue.py, check_harness_parity.py, check_subprocess_encoding.py pass
black --check on the three Python files unchanged

Seven i18n keys added and translated across all eleven catalogs plus the regenerated pseudolocale; three keys removed. check_black_formatting.py could not run on this host (it pins Black 26.3.1, the host has 26.5.1) — plain black --check on the changed files reports them unchanged.

Screenshots

Captured with website/scripts/capture-decision-strip.mjs against the real built SPA (website/dist) behind the shared transcript harness — every /api/** call answered from fixtures, so readDecisionStrip, the consent gate, the transcript virtualizer and the strip itself render exactly as in production. Light and dark, English pinned.

Expanded — the card this PR is about

The three rows that printed 0 forever are gone. In their place: Sent to Jev — message 96 chars · history 1,840 chars and Jev latency 197 ms.

light:

expanded-light

dark:

expanded-dark

Collapsed — the score now carries the latency beside it

(0.81, 197 ms) on the diverged line, (0.94, 142 ms) on the agreed one. One parenthetical, because both numbers describe the same answer and the line truncates.

diverged, light:

collapsed-diverged-light

agreed, light:

collapsed-agreed-light

diverged, dark:

collapsed-diverged-dark

agreed, dark:

collapsed-agreed-dark

The shipped decision strip opened onto four counts, and three of them told the
reader nothing. `Selection rounds` and `Skills cut from the offer` printed 0 on
every turn -- the menu is asked in ONE question, and the history budget ships at
0 -- and `Context sent (characters)` counted only the history, so the row read 0
while a message excerpt had in fact left the machine unmentioned.

So the card now names the egress as the two halves it actually has, and adds the
one measurement it was already carrying and not printing:

* `Sent to Jev - message 96 chars / history 1,800 chars`. `message_chars` is a
  new field on the outcome record, measured by `message_chars()` over the same
  `message_excerpt()` that `build_state_rows` sends, so the number on the receipt
  cannot overstate what left or miss the 2,000-char cap.
* `Jev latency 197 ms` on the expanded card, and `(0.81, 197 ms)` in the
  collapsed parenthetical beside the score. No new field: `latency_ms` is one of
  the six core fields `log.build_row` stamps, and the record published to the
  strip IS that row, so the reader keys on the log's own spelling rather than a
  duplicate the point would have to reconcile.
* the two always-zero rows are gone, and the record stops emitting `truncated`.
  Clipping is a fact about the transcript READ, which the call row still carries;
  a strip row for it had no label that said so.

The record contract moves on both sides in one change: the spec's fenced fixture
in `docs/system-specs/modules/decisions.md` SS 8 is what
`decisionStripContract.test.ts` parses, so the gateway half and the reader half
cannot drift. The spec's no-message-text bound now says explicitly that a length
is not the text, and the contract test proves `"message"` itself is still absent.

Tests extend the existing suites rather than adding files: the excerpt/count
identity through `build_state_rows`, the outcome row's fields and the three
absent ones, the reader's floors, both single-measurement cases of the collapsed
parenthetical with the legend each one gets, and the expanded rows. The seven new
i18n keys are translated across all eleven catalogs; three keys go.
@iamwhatever
iamwhatever requested review from a team and smeyffret September 20, 2026 08:47
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Screenshots

Captured with website/scripts/capture-decision-strip.mjs against the real built SPA (website/dist) behind the shared transcript harness — every /api/** call answered from fixtures, so readDecisionStrip, the consent gate, the transcript virtualizer and the strip itself render exactly as in production. Light and dark, English pinned.

Expanded — the card this PR is about

The three rows that printed 0 forever are gone. In their place: Sent to Jev — message 96 chars · history 1,840 chars and Jev latency 197 ms.

light:

dark:

Collapsed — the score now carries the latency beside it

(0.81, 197 ms) on the diverged line, (0.94, 142 ms) on the agreed one. One parenthetical, because both numbers describe the same answer and the line truncates.

diverged, light:

agreed, light:

diverged, dark:

agreed, dark:

expanded-light

expanded-dark

collapsed-diverged-light

collapsed-agreed-light

collapsed-diverged-dark

collapsed-agreed-dark

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Verify old records with nonzero history_chars but no message_chars acceptably lose the whole egress row, since messageChars !== null gates both halves.

Suggestions

  • The description's leak-test paragraph ("the test now forbids \"message\" with its quotes") describes the mechanism the second commit replaced; update it to match the shipped key-drop-plus-broad-ban approach so reviewers don't audit the wrong guarantee.

[DESIGN-REVIEWED] 45e9a7c

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

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

UX-Verdict: PASS

Verify legacy records (stamped before message_chars/latency_ms existed) render acceptably — the egress and latency rows silently vanish, a state tested but not screenshotted.

[UX-REVIEWED] 45e9a7c

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

FINDING -- docs/system-specs/modules/decisions.md:102 -- "two halves of the question's egress" omits candidate/question data, while "Jev latency" includes scheduling and logging -> Fix: label these conversation characters and end-to-end decision time.
[GPT-REVIEWED] 45e9a7c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 45e9a7cdbc333dbbfd706542d03df6f161d9067f: <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 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 45e9a7c

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

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

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 45e9a7cdbc333dbbfd706542d03df6f161d9067f — 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: PASS

Verify the one residual: an owner who raised history_budget_chars now finds the clip count only on the call-log row, its sole remaining copy.

What this change ships

Inventory (10 items) — 10 justified

Intent: make the decision strip's receipt truthful — print the real egress and latency instead of three rows that structurally printed 0 — a FIX (defect provenance is checkable on base: DECISION_HISTORY_BUDGET_DEFAULT = 0, build_outcome never stamped batches, one-question docstring).

  1. Expanded card gains "Sent to Jev — message N chars, history N chars"; new message_chars wire field, one consumer chain (reader → strip) — justified
  2. Expanded card gains "Jev latency N ms", read off the existing core log field (log.py:133), no new producer field — justified
  3. Collapsed parenthetical now holds latency beside the score, three-state legend — justified
  4. "Selection rounds" row removed (field was never stamped; printed 0 always) — justified
  5. "Skills cut from the offer" row removed; truncated off the outcome record, kept on the call row — justified
  6. "Context sent (characters)" replaced by the joined egress row, unit kept — justified
  7. Records that never stated message_chars draw no egress row (null, not 0) — justified
  8. Records without latency draw no latency row rather than "0 ms" — justified
  9. Leak-ratchet pin rewritten: message_chars excluded by exact key, broad pattern kept, teeth added; declared and defended — justified
  10. Seven i18n keys added / three removed across 11 catalogs + pseudolocale; all seven consumed in DecisionStrip.tsx — justified

Checks run: latency_ms in _CORE_FIELDS and the published record IS _log.build_row(...) (skills_select.py:723-739); fmtList pre-exists (website/src/i18n/format.ts); skills_select is the only decision point (glob decisions/points/*.py → 1); no other consumer of batches/truncated decision fields in website/src.

[FIRST-PRINCIPLES-REVIEWED] 45e9a7c

@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 20, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] Backend Tests (Windows) (1) is a main-side red this PR inherited, not a defect in this diff. Failed identically on two consecutive runs, so it is not a flake either. Root cause below, reproduced on plain origin/main.

The four failures

FAILED test/test_acp_runtime.py::test_kill_amends_the_summary_once_the_reap_completes[False-WARNING]
FAILED test/test_acp_runtime.py::test_kill_amends_the_summary_once_the_reap_completes[True-INFO]
FAILED test/test_acp_runtime.py::test_reap_amendment_leaves_the_reason_untouched
FAILED test/test_acp_runtime.py::test_reap_amendment_leaves_the_stderr_tail_untouched

each asserting [returncode=-15] and getting [returncode=<not reaped>].

Cause: two PRs collided mid-air

AcpRuntime.kill() has two platform paths, and the reap amendment is wired onto one of them.

On Windows the early return fires first, _note_reaped_after_kill never runs, and the retained summary keeps the pre-signal <not reaped>. #12188's own CI was green on Windows because its merge ref predated #12005 — the two are only in the same tree after both merged, and this PR's merge ref is where they first meet.

Reproduction, with nothing from this diff

Detached worktree at plain origin/main (9dea438cfa), running only those four tests, once as Linux and once with the single flag the Windows branch reads flipped:

=== as Linux (what CI's green shards run) ===
4 passed, 29 warnings in 8.45s

=== with IS_WINDOWS forced True (what the Windows shard runs) ===
FAILED ... test_reap_amendment_leaves_the_stderr_tail_untouched - AssertionError: assert '[returncode=-15]' in 'killed (displaced by a new al...
FAILED ... test_reap_amendment_leaves_the_reason_untouched      - AssertionError: assert False
FAILED ... test_kill_amends_the_summary_once_the_reap_completes[True-INFO]      - AssertionError: assert '[returncode=-15]' in 'killed (warm mint teardown) [...
FAILED ... test_kill_amends_the_summary_once_the_reap_completes[False-WARNING]  - AssertionError: assert '[returncode=-15]' in 'killed (warm mint teardown) [...
4 failed, 29 warnings in 5.09s

linux_exit=0 windows_exit=1

Same four tests, same four messages as CI. The platform flag is the whole difference.

Why it is not fixed here

This diff touches src/kiro_crew/decisions/, the chat strip, the decisions spec and the i18n catalogs — nothing under src/kiro_crew/acp/. The fix is one call on the Windows branch (await the handle, then amend from the drained returncode), and it belongs in its own PR against main so it lands for every PR whose merge ref now carries both commits, rather than riding in here as unrelated work. Every other shard on this head is green: 8 Linux backend, 7 of 8 Windows, 4 frontend, macOS, lint/typecheck, CodeQL, Semgrep, Coverage Gate, and the docs/brand/focus-cue/harness/feature-map gates, plus Opus, GPT, First Principles, Design, UX and Screenshot Evidence.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] The Windows red above now has a fix in flight: #12260, against main, one call plus the test-stub correction that let the gap ship. Once it lands, this PR's Backend Tests (Windows) (1) clears on a re-run with no change to this diff. Every other check on this head is green.

@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 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] UX Review — CONCERNS: upheld and fixed in 74babc2c58.

readDecisionStrip floors a missing message_chars to 0 and DecisionStrip.tsx renders the sent_label Detail unconditionally, so every record stamped before this release shows "message 0 chars · history 0 chars" — a false egress receipt on all existing history.

Correct, and it is the defect this PR exists to remove, reintroduced one field over. The row it replaced was merely uninformative; this one would have been wrong, which is worse.

The fix, and the one place it does NOT apply

message_chars is now the only count on the record whose absence is not 0. Zero characters is not a credible measurement of it — a turn that reached the selector had text — so asCountOrNull returns null for a value that is not a count, and the strip draws no egress row at all, exactly as it draws no latency row without a latency_ms.

history_chars deliberately keeps the floor-to-zero rule in full. 0 there is a real observation: build_history fills history_chars even when nothing is admitted, and the spec names that as what distinguishes "no history was reachable" from a field that was never sent. So the two halves of one row are read by two different rules, and the asymmetry is pinned from both sides:

record egress row
message_chars: 96, history_chars: 1800 message 96 chars · history 1,800 chars
message_chars: 96, history_chars: 0 message 96 chars · history 0 chars
message_chars absent no row

The middle case matters more than it looks: the shipped history budget is 0, so history 0 chars is the common record, not an edge case. Gating the row on the wrong half would have hidden it on every turn — so there is a test asserting that shape directly, not just the absent one.

Verification

Revert-verified in both directions, since this is two guards and not one:

as written        : exit=0 :: 58 passed
render gate removed: exit=1 :: 1 failed | 57 passed
reader null removed: exit=1 :: 5 failed | 53 passed
restored          : exit=0 :: 58 passed
                                   -> LOAD-BEARING (both halves)

The spec's § 8 count rule now states the exception, so the fenced fixture and the reader cannot drift on it — decisionStripContract.test.ts reads that block and asserts the null.

Green locally on the new head: 58 strip tests, typecheck, eslint, i18n:check 19/19, docs_lint.py, check_feature_map.py, check_brand_name.py, check_focus_cue.py.

Still outstanding, and still not this diff

Backend Tests (Windows) (1) remains the inherited main-side red diagnosed above. Its fix, #12260, is fully green and readiness: passed, including all eight Windows backend shards — shard 1 among them, which is the direct proof. It is waiting on a maintainer approval; once it lands, this PR's shard clears on a re-run with no further change here.

@iamwhatever
iamwhatever force-pushed the feat/decisions-strip-polish branch from 74babc2 to 6c8474c Compare September 20, 2026 10:47
@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] Screenshots re-captured for 6c8474c721, since the egress row's separator moved from a hardcoded · to fmtList (English renders ,). Same harness: the real built SPA behind the shared transcript harness, every /api/** call from fixtures, light and dark, English pinned.

expanded, light:

expanded, dark:

collapsed diverged, light:

collapsed agreed, light:

collapsed diverged, dark:

collapsed agreed, dark:

expanded-light

expanded-dark

collapsed-diverged-light

collapsed-agreed-light

collapsed-diverged-dark

collapsed-agreed-dark

@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 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] UX Review — CONCERNS on 6c8474c721: both points answered, neither taken. This is the second of two code rounds spent on reviewer findings, so the diff stops here; the reasoning below is code-evidenced rather than deferred.

Watch — "Jev" is an unidentifiable recipient

A receipt naming an unidentifiable recipient converts intended transparency into anxiety… Smallest fix inside this PR: give the sent_label Detail a title legend saying in one sentence what Jev is and that this text left the machine to it.

The product already says exactly that, on the gate the reader must pass before any record can exist. pages.developer.featurePreviewsTab carries both halves of the requested sentence, verbatim:

  • decisions_desc — "Jev is a small, fast decision model. With this on, {{productName}} asks Jev which one of your skills fits the message you just sent — or that none does…"
  • decisions_egress — "While this is on, the text of your messages and the names and descriptions of your skills leave this machine. They are sent over the internet to Jev, the decision service this…"

That is the identity and the egress, on the consent card, beside the endpoint address it is consent to. A decisions_strip record exists only for a session that passed that card — the seam is off by default and consent is strict opt-in — so there is no reader of this row who was not shown that text. Repeating it as a hover legend would make the receipt the disclosure surface, which is the one place it must not be: a receipt is read after the fact, and disclosure that arrives after egress is not disclosure.

And the row is not where "Jev" first appears on this card. Six strings on the same strip use the bare noun, five of them predating this PR:

key value in this PR?
jev_label Jev no
rate_jev Jev no
jev_named Jev: {{names}} no
agreed_named Jev and word match: {{names}} no
confidence_title Jev's confidence in its own answer, from 0 to 1 no
sent_label Sent to Jev yes

A legend on sent_label alone would leave the other five unexplained on the same expanded card, and imply by contrast that they are about something else. The vocabulary is either opaque everywhere on this surface or nowhere — so if it should change, it changes once for the whole strip, not on the one row a diff happened to touch. Filing that as a follow-up rather than smuggling it in here.

Worth naming the method limit too: the blind reader could not place "Jev" because they were shown one expanded card and not the consent flow that precedes it. That is a fact about the review, not about the product.

Suggestion — "chars" should be "characters"

chars is this product's established unit noun, not an abbreviation invented here. Six catalog strings already use it, including the closest sibling surface — the one whose entire job is character counts:

pages.contextBreakdown.card_meta              {{turns}} turns · {{chars}} chars sent by {{productName}}
pages.contextBreakdown.strip_your_messages_sub {{chars}} chars of {{total}}
pages.contextBreakdown.strip_kirocrew_added_sub {{chars}} chars · removable by config
pages.contextBreakdown.strip_kiro_builtin_sub  ~{{chars}} chars · kiro base + conversation (est.)
pages.overview.skillsTab.cost_line             … {{chars}} chars spent · last 30 days
pages.overview.skillsTab.cost_line_frozen      … {{chars}} chars spent · no longer counting

Spelling it out on this row alone would make it the only surface in the product measuring the same quantity by a different name. Consistency is the stronger property here, and the row is expanded-only so nothing is being saved by brevity — it is being kept the same word.

(The removed label did say "characters", but it also said "Context sent", which is the phrasing the owner called confusing. Its wording is not a baseline to preserve.)

Watch from the previous round, for the record

The earlier CONCERNS — "pre-upgrade records will read message 0 chars" — was upheld and fixed in this same round, with its own disposition. The lane's own suggested remedy is what shipped.

State

readiness: checking with CI running on 6c8474c721; Design Review, UX Review, Screenshot Evidence and First Principles Review are green on this head, and the screenshots in the description were re-captured for it after the separator moved to fmtList. Backend Tests (Windows) (1) remains the inherited main-side red whose fix, #12260, is green and readiness: passed, waiting on a maintainer approval.

Three review findings, all upheld, all in the reviewers' favour.

## The egress row claimed zero for records that never stated one

The UX lane caught the new row reintroducing the defect this change exists to
remove. `asCount` folds "absent" into `0`, and the row was drawn
unconditionally -- so every record stamped before `message_chars` existed
rendered "Sent to Jev - message 0 chars", asserting that nothing left the
machine on a turn that did send an excerpt. The row it replaced was merely
uninformative; this one would have been wrong.

`message_chars` is now the one count whose absence is NOT zero. Zero characters
is not a credible measurement of it -- a turn that reached the selector had text
-- so the reader returns `null` for a value that is not a count, and the strip
draws no egress row at all, exactly as it draws no latency row without a
`latency_ms`.

`history_chars` keeps the floor-to-zero rule in full, deliberately: 0 there is a
real observation, and it is how "no history was reachable" is told apart from a
field that was never sent. That asymmetry is the whole point, so it is pinned
from both sides -- an absent message length hides the row, and a history of 0
must not. The shipped history budget is 0, which makes "history 0 chars" the
COMMON record rather than an edge case, so gating the row on the wrong half
would have hidden it on every turn.

## The row's two halves were joined by a hardcoded separator

`fmtList` now owns that join, as it already did for the collapsed parenthetical
above: what goes between two list items is a locale's decision, and a hardcoded
separator sat directly beneath a comment saying exactly that. Pinned by
asserting the JOINED string -- two separate substring assertions pass under any
separator, so they could not have caught it.

## The message-leak ratchet was narrowed so the new field would fit

`"message" not in json.dumps(row)` became `'"message"' not in ...`, and the
frontend's forbidden list dropped `message` for a quoted form. That is a ratchet
loosened so a diff fits: a `message_text` field carrying the conversation itself
would have passed both.

The field is a LENGTH, so it is removed by exact key before the check instead,
and the patterns go back to what they were. Admitting a known-safe field costs
the assertion no width that way; narrowing the pattern cost it all of it. Both
sides now carry the teeth as an assertion of their own, so masking by key cannot
drift back into masking by pattern.

## Verified by mutation, not by reading

  render gate relaxed                 1 test fails
  reader's asCount restored           5 tests fail
  hardcoded separator reinstated      1 test fails
  a message_text leak injected        backend exit=1, frontend exit=1
@iamwhatever
iamwhatever force-pushed the feat/decisions-strip-polish branch from 6c8474c to 45e9a7c Compare September 20, 2026 11:06
@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 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] GPT F1 — upheld and fixed in 45e9a7cdbc.

BLOCKING — test/test_decisions_points.py:965 — Message-leak ratchets were narrowed to exact-key matching. A message_text field -> both assertions pass -> conversation text can enter published records unnoticed. Anchor: a-ratchet-may-only-tighten. Fix: Mask message_chars, then retain broad message rejection in both assertions.

Correct on every point, including the remedy. I narrowed a leak guard so my own field would fit it, which is exactly what that rule exists to catch. The fix is the one the finding names.

What changed

The field is a length, so it is removed by exact key before the check, and both patterns go back to what they were:

assert isinstance(row["message_chars"], int), "a length, and only a length"
without_length = {key: value for key, value in row.items() if key != "message_chars"}
assert "message" not in json.dumps(without_length), "no conversation text in a row"
const { message_chars: _length, ...withoutLength } = fixture
const serialized = JSON.stringify(withoutLength).toLowerCase()
for (const forbidden of ['api_key', 'secret', 'prompt', 'message', 'description', 'content']) { … }

Admitting a known-safe field by name costs the assertion no width. Narrowing the pattern cost it all of it — that is the asymmetry I missed.

Both sides also now assert the teeth, so masking by key cannot drift back into masking by pattern:

assert "message" in json.dumps({**without_length, "message_text": "review this code"})

Verified by injecting the leak, not by reading the diff

The claim is that a message_text field would pass. So that is what I made happen — a producer stamping it on the outcome row, and a spec fixture promising it — and required both checks to go red:

as written                          backend exit=0   frontend exit=0
with a message_text leak injected   backend exit=1   frontend exit=1
restored                            backend exit=0   frontend exit=0
                    -> RATCHET HAS TEETH (both sides reject a message_text leak)

Also in this push

Two UX findings, both answered in the disposition above and the one after it: the absent-message_chars false receipt (fixed), and the hardcoded · separator now owned by fmtList (fixed). The commit message carries all three.

Green locally on 45e9a7cdbc: 110 decisions tests, 58 strip tests, typecheck, eslint, i18n:check 19/19, black, flake8, docs_lint.py, check_comment_history.py.

The three CI reds on the previous head, none of them this diff

check verdict
Backend Tests (Windows) (1) the inherited main-side red diagnosed here; fix is #12260, green and readiness: passed, awaiting approval
Backend Tests (3.12, 8) worker 'gw1' crashed while running test_source_corpus.py — an xdist worker crash, not an assertion
Backend Tests (Windows) (7) test_windows_failed_tree_kill_keeps_live_pid_records expected did not drain and got Windows descendant handles unavailable: [8004, …] — a different branch of the same drain, i.e. a probe race. Shard 7 was green on ecdd2c1852 with identical code in that file, which this diff does not touch

@iamwhatever

Copy link
Copy Markdown
Contributor Author

[operator: iamwhatever] The inherited Windows red is gone, and no rebase is needed. Backend Tests (Windows) (1) is green on 45e9a7cdbc: main's tip is now 954fb69185 (#12269, fix(acp): record the reap on the Windows teardown branch too), which fixes the #12005/#12188 collision diagnosed here — same diagnosis and same remedy as my #12260, reached independently by @BoliChen and landed first. #12260 is closed as superseded, with credit. This PR's diff never touched an ACP file and has not changed for it.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) September 20, 2026 17:08

@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.

Reviewed against the pr-triage-pipeline gates plus a full-diff read.

feat(decisions), 22 files. Reworks the decision strip that shows how the skill selector chose skills against the word-match baseline. It drops two rows that always printed 0 (selection rounds/batches, skills cut/truncated) and the mislabeled single 'Context sent (characters)' row, replacing them with a real egress row (message-excerpt chars plus history chars) and a Jev latency row. Backend adds message_excerpt()/message_chars() and stamps message_chars on the outcome record, dropping truncated; latency_ms is read from the existing core log row rather than newly stamped. Frontend reads message_chars as nullable via asCountOrNull so absent is not 0, gates the egress row on a stated message length, and joins list parts via fmtList. Plus 7 new i18n keys and 3 removed across 13 catalogs.

Why I am approving despite feat: being outside the automated safe-category set: no correctness defect was found. The nullable handling is right (absent, negative, NaN or string all resolve to null and suppress the row, while an explicit 0 is kept), message_excerpt and message_chars share one cap so the receipt cannot overstate egress, None text is handled, and the leak ratchet is asserted by exact-key removal plus a positive message_text-leak assertion on both backend and frontend.

One intended behavioral consequence, not a defect: a legacy record stamped before message_chars existed now shows neither message nor history in the expanded card, because the standalone history row was removed and the egress row is gated on a stated message length. Practically moot while the shipped history budget is 0.

All six security-checklist answers NO, no denylist match, CodeQL PR-scoped open-alert query empty, Semgrep success, readiness label applied after the head commit.

Spec ride-along: docs/system-specs/modules/decisions.md changed as a minority of the diff (1 file / 10 lines against 21 files / 563 lines) and was not reviewed as a design decision.

@bolichen97
bolichen97 merged commit a738a0a into main Sep 20, 2026
93 checks passed
@bolichen97
bolichen97 deleted the feat/decisions-strip-polish branch September 20, 2026 17:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 20, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
…odotdev#12245)

* feat(decisions): strip shows what was sent and how long Jev took

The shipped decision strip opened onto four counts, and three of them told the
reader nothing. `Selection rounds` and `Skills cut from the offer` printed 0 on
every turn -- the menu is asked in ONE question, and the history budget ships at
0 -- and `Context sent (characters)` counted only the history, so the row read 0
while a message excerpt had in fact left the machine unmentioned.

So the card now names the egress as the two halves it actually has, and adds the
one measurement it was already carrying and not printing:

* `Sent to Jev - message 96 chars / history 1,800 chars`. `message_chars` is a
  new field on the outcome record, measured by `message_chars()` over the same
  `message_excerpt()` that `build_state_rows` sends, so the number on the receipt
  cannot overstate what left or miss the 2,000-char cap.
* `Jev latency 197 ms` on the expanded card, and `(0.81, 197 ms)` in the
  collapsed parenthetical beside the score. No new field: `latency_ms` is one of
  the six core fields `log.build_row` stamps, and the record published to the
  strip IS that row, so the reader keys on the log's own spelling rather than a
  duplicate the point would have to reconcile.
* the two always-zero rows are gone, and the record stops emitting `truncated`.
  Clipping is a fact about the transcript READ, which the call row still carries;
  a strip row for it had no label that said so.

The record contract moves on both sides in one change: the spec's fenced fixture
in `docs/system-specs/modules/decisions.md` SS 8 is what
`decisionStripContract.test.ts` parses, so the gateway half and the reader half
cannot drift. The spec's no-message-text bound now says explicitly that a length
is not the text, and the contract test proves `"message"` itself is still absent.

Tests extend the existing suites rather than adding files: the excerpt/count
identity through `build_state_rows`, the outcome row's fields and the three
absent ones, the reader's floors, both single-measurement cases of the collapsed
parenthetical with the legend each one gets, and the expanded rows. The seven new
i18n keys are translated across all eleven catalogs; three keys go.

* fix(decisions): never claim zero egress, and keep the leak ratchet broad

Three review findings, all upheld, all in the reviewers' favour.

## The egress row claimed zero for records that never stated one

The UX lane caught the new row reintroducing the defect this change exists to
remove. `asCount` folds "absent" into `0`, and the row was drawn
unconditionally -- so every record stamped before `message_chars` existed
rendered "Sent to Jev - message 0 chars", asserting that nothing left the
machine on a turn that did send an excerpt. The row it replaced was merely
uninformative; this one would have been wrong.

`message_chars` is now the one count whose absence is NOT zero. Zero characters
is not a credible measurement of it -- a turn that reached the selector had text
-- so the reader returns `null` for a value that is not a count, and the strip
draws no egress row at all, exactly as it draws no latency row without a
`latency_ms`.

`history_chars` keeps the floor-to-zero rule in full, deliberately: 0 there is a
real observation, and it is how "no history was reachable" is told apart from a
field that was never sent. That asymmetry is the whole point, so it is pinned
from both sides -- an absent message length hides the row, and a history of 0
must not. The shipped history budget is 0, which makes "history 0 chars" the
COMMON record rather than an edge case, so gating the row on the wrong half
would have hidden it on every turn.

## The row's two halves were joined by a hardcoded separator

`fmtList` now owns that join, as it already did for the collapsed parenthetical
above: what goes between two list items is a locale's decision, and a hardcoded
separator sat directly beneath a comment saying exactly that. Pinned by
asserting the JOINED string -- two separate substring assertions pass under any
separator, so they could not have caught it.

## The message-leak ratchet was narrowed so the new field would fit

`"message" not in json.dumps(row)` became `'"message"' not in ...`, and the
frontend's forbidden list dropped `message` for a quoted form. That is a ratchet
loosened so a diff fits: a `message_text` field carrying the conversation itself
would have passed both.

The field is a LENGTH, so it is removed by exact key before the check instead,
and the patterns go back to what they were. Admitting a known-safe field costs
the assertion no width that way; narrowing the pattern cost it all of it. Both
sides now carry the teeth as an assertion of their own, so masking by key cannot
drift back into masking by pattern.

## Verified by mutation, not by reading

  render gate relaxed                 1 test fails
  reader's asCount restored           5 tests fail
  hardcoded separator reinstated      1 test fails
  a message_text leak injected        backend exit=1, frontend exit=1

---------

Co-authored-by: Joe Guo <zejiangg@amazon.com>
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