Repository navigation
feat(mod): on a subscription show one next-message figure for the cache state - #1096
Conversation
…he state On a subscription the band showed `90.0k rd · 90.0k wr if cold`. Both numbers are the same cached prefix, so the pair says nothing about cost. - nextPrice returns a tagged NextPrice. With an API key it is `usd` (warm and cold, unchanged). On a subscription it is `tokens`: one figure for the cache state now, `rd` warm (success color) or `wr` cold (warning color). - Band row 1: `next message 90.0k rd` warm, `○ cache cold · next message 90.0k wr` cold. - Pane NEXT MESSAGE: one `next message <figure>` line on a subscription. Dollar mode keeps its two lines. - nextPrice's doc comment marks where the 5-hour share kind goes once the #1068 weights are learned (#1095 point 1, not built). Part of #1095. Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 5e79ff6c5e1a |
approve |
Verdict: approve
Findings
None. The change does what issue #1095 points 2 and 3 ask, and nothing else.
Non-blocking
context-guru-plugin/hooks/register.tsx:529— the pane line readsnext message 90.0k rddirectly under theNEXT MESSAGEheader. The label repeats the header. The band needs the label; the pane does not.context-guru-plugin/hooks/register.tsx:346and:354— the band hardcodessuccessandwarningfor the subscription figure, whilemodel.tsalready returns the same colors inNextPrice.color(the pane uses it). Two sources of truth for one color. The doc comment promises a thirdsharekind later; that is the moment this bites.context-guru-plugin/hooks/model.ts:59— thepricedgate checks only the current state's price. A warm thread whose server sentnext_cold_usdbut notnext_warm_usdwould show no figure, wheremainstill showed· 90.0k wr if cold. I checkeddash/cachestate.go:442(nextPtrs): the proxy sets both prices in one call, so the shape cannot occur today.- Test coverage gaps, both small: the cold subscription band is tested at 140 columns only (warm is tested at 60 and 140); the
unknownfigure of thetokenskind (no price or no tokens) has no test in band or pane.
What I checked
- The full diff (one commit, three files) and the code around every change:
model.ts,register.tsxandregister.test.tsxread in full. - Behavior parity with
main: onmainthe band already showed one figure per state (warm neededwarmUsd, cold neededcoldUsd). The only band change is the dropped· wr if coldtail, exactly what the PR claims. The pane changes from twoif the cache is warm / if it is coldlines to one line. Dollar mode renders through the unchangedusdbranch. nextPriceconsumers: only the band and the pane (grepover ts/tsx/py/go).scripts/statusline.pydraws no such pair, so no other display diverges.- The redraw path: the subscription figure depends on
isWarm,tokens,warmUsd,coldUsdand the engine'sfiveHour; all of these reach the render through thesnapshot/contextatoms andsignature(which listsisWarm, both prices andtokens), so a warm→cold flip redraws the band. - The new tests' regexes traced against the render tree: row shapes (
◆ next message 90.0k rd …,◆ ○ cache cold · next message 90.0k wr), the negative matches (/wr|cold/,/\brd\b/cannot hithide,dash ↗,[ Ping ]), and the color assertions viaprops.color. - TypeScript: the
NextPricediscriminated union narrows correctly at every use (price.warm/price.coldbehindkind === 'usd',price.now/price.colorbehind thetokensbranch). - Repo rules: the behavior change is named at the top of the PR with who it affects, old and new behavior, how to turn it off, and the owner's approval (2026-11-11), as
CLAUDE.mdandRELEASING.mdrequire. Data dependence stated (metadata only, no change) — the figure is built from token counts that already reach the mod. - The PR reports
103 pass, 1 fail, with the one failure also failing on unmodifiedorigin/main. Live tests were not approved for this review, so I did not re-run them.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 5e79ff6c5e1a |
blocking |
Verdict: blocking
Findings
-
docs/plugin/statusline.md:200 — the doc still describes the display this PR removes
- What fails: the PR changes the band and the pane on a subscription to one figure. The doc keeps the old rule. A reader of
statusline.mdlearns the wrong behavior. - Proof: the diff touches only
context-guru-plugin/hooks/{model.ts,register.tsx,register.test.tsx}— no docs file.docs/plugin/statusline.md:200still says: "the next message shows tokens …next message 90.0k rd · 90.0k wr if cold… The pane shows the same figures." After this PR the band showsnext message 90.0k rd(warm) or○ cache cold · next message 90.0k wr(cold), and the pane shows onenext message <figure>line. The doc is the reference for what the band means (CLAUDE.md points users atdocs/). - Fix: rewrite the Subscription bullet in
docs/plugin/statusline.mdfor the new one-figure rule, warm and cold, band and pane. Say the 5-hour share comes later (#1095 point 1).
- What fails: the PR changes the band and the pane on a subscription to one figure. The doc keeps the old rule. A reader of
-
context-guru-plugin/hooks/model.ts:59 — a warm cache with no warm price now draws a label with no figure
- What fails: subscription user, warm cache, proxy that sends no
next_warm_usd(a proxy that predates the warm figure —docs/plugin/statusline.md:164documents this skew). Row 1 draws◆ next messageand then nothing. The label dangles. Onmainthe same state drewnext message 90.0k wr if cold, a usable figure. - Proof: trace.
nextPrice(model.ts:59-60) gatesnowonpriced = m.isWarm ? m.warmUsd !== undefined : …. WithwarmUsdmissing,nowisundefined. In the band (register.tsx:330-331)warmandcoldare then bothundefined, but the warm branch (register.tsx:345-348) prints the dimnext messagelabel unconditionally. Before this PR the oldnextPricesetcold = "90.0k wr"whenevercoldUsdexisted, so a figure showed. The pane handles the same state honestly (next message unknown, register.tsx:530); the band does not. No test covers the{ kind: 'tokens' }return withnowundefined, in the band or the pane. - Fix: in the band's warm branch, treat a missing figure as the pane does — print a dim
unknown, or print no label at all. Add a test: subscription, warm,next_warm_usdabsent,next_cold_usdpresent; pin what row 1 shows.
- What fails: subscription user, warm cache, proxy that sends no
Non-blocking
- The band hardcodes
success/warning(register.tsx:346, 354) while the pane usesnext.color. The two agree today. If asharekind is added later (#1095 point 1), read the color from the model in both places.
What I checked
- The full diff
202087de..HEAD(3 files) and the code around each change:model.ts,register.tsx,register.test.tsx. - The new
NextPriceunion: TS narrowing at both call sites, theusdpath byte-for-byte unchanged, the band's warm/cold branch mapping (warm = m.isWarm ? price.now : undefined). - Redraw path:
signature(model.ts:326) covers every fieldnextPricereads (isWarm,warmUsd,coldUsd,tokens), so a state flip redraws the band. - All new and changed tests: warm band at 140 and 60 columns, cold band, pane warm and cold, the API-key pair test. Checked the regexes against the drawn rows (
not.toMatch(/wr|cold/),\brd\b) — no false pass found. - Docs: searched all of
docs/andREADME.mdfor the old display; onlystatusline.md:200is stale (finding 1). The dollar examples and row-2 token figures elsewhere are unchanged by this PR. - Issue #1095 and the PR description: the behavior change is named at the top, approved by David Amid, data dependence stated (metadata only). The PR implements points 2-4 of the issue; point 1 (5-hour share) is correctly left as a documented hook.
- Live tests were not run (not approved for this review). The PR reports 103 pass, 1 fail, with the failure pre-existing on
origin/main.
Round 1 of #1096: - Band row 1 shows no "next message" label when there is no figure for the current cache state (a proxy with no warm price). - The band takes the subscription colors from nextPrice, as the pane does. - docs/plugin/statusline.md describes the one-figure rule. - New tests: the cold band at 60 columns, and a warm cache with no warm price in the band and the pane. Assisted-By: Claude Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 answers. All fixes are in commit e1ceb93. Reviewer 1 (blocking)
Non-blocking, fixed too: the band now takes the subscription colors from Reviewer 2 (approve)
Tests: |
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | e1ceb934ef83 |
approve |
Verdict: approve
Findings
None. Both round-1 findings are fixed and tested.
Earlier findings
- Mine, finding 1 (stale doc,
docs/plugin/statusline.md:200): fixed. The Subscription bullet now gives the one-figure rule: warmnext message 90.0k rdin green, cold○ cache cold · next message 90.0k wrin amber, the pane the same figure and color, nonext messagelabel when the proxy has no figure, and the 5-hour share named as later work (#1095, #1068). I checked each claim against the code. All match. - Mine, finding 2 (bare
next messagelabel,model.ts:59): fixed. The warm branch now renders only when it has a figure:m.isWarm && (warm !== undefined || cold !== undefined)(register.tsx:346). Trace of the new test's state — subscription, warm,next_warm_usddropped from the doc and the main thread,next_cold_usd0.78,tokens90000:pricedis false,nowis undefined,warmandcoldare both undefined, so no label. Row 1 is◆, Ping,hide, the link. The test pinsnot.toMatch(/next message/)andnot.toMatch(/\b(rd|wr)\b/)on the band, andnext message unknownin the pane. The regexes cannot false-pass againsthide,dash ↗or[ Ping ]. - Mine, non-blocking (band colors hardcoded): fixed.
warmColor/coldColorcome fromprice.colorfor thetokenskind (register.tsx:332-334). For theusdkind they staysuccess/warning, byte-for-byte the old rendering. - Reviewer 2, non-blocking (colors in two places): fixed, same change as point 3. Checked it myself.
- Reviewer 2, non-blocking (warm thread with no warm price): fixed, same change as point 2.
- Reviewer 2, non-blocking (test gaps): fixed. The cold band is now tested at 60 columns too, and the no-figure case has tests in band and pane.
- Reviewer 2, non-blocking (the pane's
next messagelabel repeats the header): kept by the author. The reason: the line must read alone when a person scans the pane, and it uses the band's words. I accept it. It is a display choice, and it was non-blocking.
What I checked
- Last review: round 1,
5e79ff6c5e1a551df164e75c76e3154a75d9f7eb, 2026-11-11T16:13:57Z. - New commits read: 1 —
e1ceb934"fix(mod): no bare next-message label; colors from the model; doc". - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
- New items since my last review: commit
e1ceb934(reviewed below); the author's round-1 answer comment at 16:15:48Z (each claim checked against the commit); reviewer 2's round-1 review at 16:13:46Z (posted before mine but unread in round 1 — read now in full; its non-blocking items are dispositioned above). - The full diff
5e79ff6c..e1ceb934and the code around each change: the band's row-1 gate, the color ternaries, both new tests, the rewritten doc bullet. - The new gate's reach beyond the subscription: for the
usdkind with both prices missing, row 1 also drops the label now. Onmainthat state drew the same bare label. Same rule, an improvement, no figure is lost. - The new doc bullet claim by claim against
register.tsxandmodel.ts: colors, both row shapes, the pane's single figure, the no-label rule. No false statement found. - The commit message: DCO
Signed-off-by,Assisted-By, conventional title. Correct. - Live tests were not run (not approved). The author reports 105 pass, 1 fail, the failure pre-existing on
origin/main.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.322 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | e1ceb934ef83 |
approve |
Verdict: approve
Findings
None. Commit e1ceb934 fixes both of reviewer 1's findings and my non-blocking notes. I verified each fix by trace. No new defect.
Earlier findings
- Reviewer 1, finding 1 (stale doc): fixed.
docs/plugin/statusline.md:200now states the one-figure rule — warm90.0k rdgreen, cold○ cache cold · next message 90.0k wramber, the pane the same figure and color, the 5-hour share later (#1095). I read the new bullet in full. It also names the no-label case. It matches the code. - Reviewer 1, finding 2 (bare
next messagelabel): fixed.register.tsx:346now gates the whole warm branch on(warm !== undefined || cold !== undefined). Trace: warm subscription,next_warm_usdabsent →pricedfalse →nowundefined →warmandcoldboth undefined → no label, no figure. The pane keepsnext message unknown(register.tsx:530), which is honest. The new test drives exactly this shape (doc and main thread withnext_warm_usddropped,next_cold_usdkept) and pins band and pane. - Reviewer 1 non-blocking (colors in two places): fixed.
register.tsx:333-334takesprice.colorfor thetokenskind;usdkeepssuccess/warningas before. One source of truth per kind now. - My non-blocking, test gaps: fixed. The cold band at 60 columns and the no-figure case (band and pane) both have tests now.
- My non-blocking, pane label repeats the header: rejected by the author. Reason: the line must read alone when a person scans the pane, and it uses the band's words. I accept the reason. It is a wording choice, not a defect.
Non-blocking
register.tsx:346— the no-label gate also covers theusdkind. Onmain, an API-key warm cache with no prices at all drew a danglingnext messagelabel; now it draws nothing. This is a second, tiny behavior change beyond the subscription case named in the PR. It is strictly an improvement (an empty label said nothing), and the fix commit is authored by the owner, so the permission rule is met. Noted for the record only.
What I checked
- Last review: round 1,
5e79ff6c5e1a551df164e75c76e3154a75d9f7eb, 2026-11-11T16:13:46Z. - New commits read: 1 —
e1ceb934fix(mod): no bare next-message label; colors from the model; doc. - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files; the inline file is empty).
- New items since my last review:
- Reviewer 1's round-1 review (blocking, 2 findings + 1 non-blocking): checked each against the fix commit — see "Earlier findings".
- The author's round-1 answers (comment, 2026-11-11T16:15:48Z): every claim in it matches the diff — doc rewritten, gate added, colors from the model, two new tests. The reported test run is 105 pass, 1 fail, the failure pre-existing on
origin/main; live tests were not approved, so I did not re-run them. - Commit
e1ceb934(3 files): full diff read, plusregister.tsxaround the change. Verified the commit message follows the repo conventions (conventional title,Assisted-By:,Signed-off-by:).
- The two new tests traced against the render tree: the cold 60-column row is
◆ ○ cache cold · next message 90.0k wr … hide dash ↗(about 53 cells, fits the 56-cell budget); the no-figure band row is◆ … [ Ping ] hide dashboard ↗with nonext messageand nord/wr; the pane line isnext message unknown. - Regression check on the gate: every existing test that expects the
next messagelabel runs with prices present (usd kind:next_warm_usd: 0.06), so the gate does not hide the label where a test ormainbehavior expects it. The cold branch is unchanged in shape.
Plugin versions for v0.7.4: - Claude Code plugin 0.7.3 -> 0.7.4 (#1096, #1135, #1174, #1177, #1199, #1216). - Codex plugin 0.2.12 -> 0.2.13 (#1115, #1135). - Pi package 0.1.1 -> 0.1.2 (#1113). - Bob plugin 0.1.1 -> 0.1.2 (#1093, #1111, #1118, #1124, #1126, #1127). The owner's Bob hold (#1221) covers release tests only. - OpenCode: PINNED_VERSION v0.7.3 -> v0.7.4 in opencode-plugin/index.js, its README, docs/how-to/install-opencode-plugin.md and 3 tests. Behavior change: the version numbers; the OpenCode plugin's first start downloads proxy v0.7.4. Release bumps are approved by the owner ("I approve version bumps"). Data dependence: none. Reviews: 2 offload review rounds (GLM): both approve at ab79001. After it: 1422093, a merge of main with no hand resolution (remerge-diff 0; approval-still-valid: SAME CHANGE). Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
Behavior change
next message 67.3k rd · 67.3k wr if coldwhile warm. The two numbers are always the same. The pane showed both lines too.next message 67.3k rd, in the success color.○ cache cold · next message 67.3k wr, in the warning color.next messagelabel with nothing after it. Now row 1 draws no label in that state, in both modes. This part needs the owner's yes (review round 1, commit e1ceb93).Note: on
main, row 1 already showed the cold figure when the cache was cold (○ cache cold · next message 90.0k wr, an existing test pins it). This PR keeps that row. The real change on row 1 is the warm state: the· wr if coldpart goes away.Summary
On a subscription the next-message read and write figures are the same token count (the cached prefix). Showing both says nothing about cost. This PR shows one figure, for the state the cache is in now. Part of #1095 (points 2 and 3). The 5-hour share (point 1) comes later, after the #1068 weights.
What changed
context-guru-plugin/hooks/model.ts:nextPricereturns a taggedNextPrice.usd(API key): warm and cold dollar prices, as before.tokens(subscription):now(<tokens> rdwarm,<tokens> wrcold) andcolor(successorwarning).sharekind goes for the 5-hour share. It is not built.context-guru-plugin/hooks/register.tsx:next message <figure>line on a subscription. Dollar mode keeps its two lines.context-guru-plugin/hooks/register.test.tsx: updated the90.0k rd · 90.0k wr if coldtest and the pane test. Added tests:90.0k rd, success color, nowr.90.0k wr, warning color, nord.if the cache is warmlines.Data dependence
Metadata only (token counts). No change.
How it was tested
claude plugin test context-guru-plugin: 103 pass, 1 fail.no data: the band is left to the engine,no implementation for clock.now) also fails on unmodifiedorigin/main(98 pass, 1 fail there). It is not part of this change.🤖 Generated with Claude Code