Repository navigation
feat: a price file names its currency; show Bob's costs in Bobcoins - #1127
Conversation
Bob's prices.yaml held dollar estimates, with output at 5x input. Our own measurement says Bob charges 2.0 Bobcoins per million tokens for input and output alike: IBM's per-call credits fit 2.0 x (prompt + completion) / 1e6 on 20 calls, with 0.0000% error. Bob users see Bobcoins, not dollars. - prices.yaml: 2.0 per million for in, out, cache read and cache write, for every tier. The file says its unit is Bobcoins. The tiers were not measured apart, so all have the same rate. - The test checks 2.0 per million and output = input for every tier. - README and the preset-picker and status skills: Bob's cost figures are Bobcoins, even where the dashboard still shows a $ sign. The repo owner decided on 2026-11-12: Bobcoins only, no dollar conversion, and the rate may be public. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
The README's dashboard paragraph still said Bob is priced in estimated dollar rates. It now says Bobcoins, and that the dashboard and the status bar still show a $ sign. The status skill names the status bar too. The prices.yaml header no longer says no gate changes: the output rate makes CG's own model calls look cheaper to extract_llm's gate. The test's doc comment is back on the test. Both round-1 reviewers of #1118 raised the README paragraph. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Raised by both round-2 reviewers of #1118. No text change. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
A file-level key `currency` names the unit of every rate in the file. Absent or empty means USD. Each entry's Price carries it (Price.Currency, not on the wire), and Price.Unit() reads it, USD when empty. The public map and the built-in table stay USD. A value that is not 1 to 16 ASCII letters is a load error: the name is shown on the dashboard, so a typo or markup must not reach the screen. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
prices.yaml now says `currency: Bobcoins`, so every cost the proxy computes from it carries that unit, and the dashboard shows Bobcoins. The test checks every Bob tier. A proxy older than the currency key refuses the file and does not start. So bob-ultrahigh now needs context-guru-proxy v0.7.4 or newer (was v0.7.2). The README and the skills say so. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Each request row stores the unit of the price that costed it: a new column `currency`, default 'USD', added as an additive column (no schema version change). An unpriced row keeps the default. Every money reply also says `currency` at its top level: the one unit of the priced rows in its filter, "USD" when there are none, or "mixed" when there is more than one. One wrapper does it for the routes in currencyRoutes, with one DISTINCT query, cached per view for the replies' 30 s TTL (the query takes about 0.2 s on 200,000 rows). The *_usd field names do not change. The golden replies gain the key. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
usd() reads a page-wide unit, set from the API's `currency`: - USD: exactly the old output (pinned by moneyunit.test.mjs). - another unit: "1.75 Bobcoins" (2 decimals, 4 below 0.01), with lucide's coins icon on the tiles, built as SVG nodes. - mixed: money figures show "—", and one note says why. A unit name that is not 1 to 16 letters reads as mixed. The 230 call sites do not change. Two column heads, the campaign heads and the saving chart's title follow the unit. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
- reference and prices.example.yaml: the `currency` key, its rule (1 to 16 letters) and that it needs v0.7.4. - dashboard: every *_usd field is in the row's currency; money replies say `currency`, or "mixed". - data dependence: the dashboard row keeps a unit name, which is configuration, not user data; Bob's price file holds its unit. docs/data-dependence.md rebuilt with gen-datadep. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
"mixed" is the dashboard's word for a view in more than one unit, and such a view hides every money figure. A price file that named it as its unit would hide money everywhere, so it is a load error, in any case. The view-unit query also passes the accounting value as a parameter. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | fresh | 2 of 2 | 1 of 2 | 7651930943fd |
blocking |
Verdict: blocking
The server side is sound. Two UI paths do not follow the unit: the Cache detail (KV-cache) tab, and the net-saving chart in a mixed view.
Findings
-
dash/ui/kvcache.js:385 — the Cache detail tab never reads
currency, so it shows Bobcoins with a$sign- What fails:
kvFetchcallsfetchdirectly and returnsres.json(). It does not go throughapi(), soapplyMoneyUnitnever runs.refresh()(app.js:5279) runs only the current tab's loader. So:- A Bob-only proxy, page opened at
#kvcache:moneyUnitstays at its default'USD'.usd(c.cost_usd)(kvcache.js:618, and :221, :236, :242, :261, :643) shows "$1.75" for 1.75 Bobcoins. - A mixed proxy (Bob and Claude), page opened at
#kvcache: the tab shows the sum of Bobcoins and dollars with a$sign. This is the result the PR wants to prevent. - From another tab: the KV tab keeps the unit of the last tab.
dash/currency.go:229-230names this exact problem ("a tab that read none of these would keep the unit of the page before it").
- A Bob-only proxy, page opened at
- Proof: the server adds
currencyto/api/kvcache,/api/kvcache/rows,/api/kvcache/simulateand/api/kvcache/pricing(currency.go:236-237), andTestEveryMoneyRouteSaysTheUnitchecks that. No UI code reads it on this path.grep -n applyMoneyUnit dash/ui/*.jsfinds only app.js. - Fix: in
kvFetch, read the body and callapplyMoneyUnit(body.currency)when the key is there, asapi()does. Better: move that step into one helper that both use. Add a test that pins it, for example a node test that cutskvFetchand checks it sets the unit.
- What fails:
-
dash/ui/charts.js:97 — in a mixed view, the net-saving chart still draws the sum of two units and says "in dollars"
- What fails: a view with Bob and Claude rows has
currency: mixed.netSavingstill addsbaseline_cost_usd - cost_usd - cg_llm_cost_usdacross the buckets, so it adds Bobcoins to dollars. It draws that line and area. Its colour (good or bad) comes from the sign of that sum.moneyWord()returns'dollars'formixed(app.js:125), so the frame's label says "Cumulative net saving over time, in dollars". Only the axis and end labels go to "—". - Proof: charts.js:90-108. app.js:125
moneyWord() { return moneyUnit === 'USD' || moneyUnit === 'mixed' ? 'dollars' : moneyUnit; }. The PR description says a mixed view "shows '—' for money". - Fix: when
moneyUnit === 'mixed', show an empty state (for example "Costs are in more than one unit") in place of the chart. Check the other money charts thatcolumns()draws from*_usdkeys for the same case.
- What fails: a view with Bob and Claude rows has
Non-blocking
- dash/reprice.go:106 —
applyRepricedoes not writecurrency.priceCostsetse.Currency, but the UPDATE sets only the cost columns. The row keepsUSD. In the proxy this path cannot get a Bob row today:MODEL_PRICESloads at start, before any traffic (proxyapp/main_run.go:1574), so a Bob tier is priced at write time. A library host with a resolver that loads a non-USD table late would store Bobcoin costs as USD. Fix: addcurrency = ?to the UPDATE, and a test. /api/adapt/compaction,/api/adapt/settings,/api/adapt/toolscarry money (usd,usd_low, ... in adapttools.go:64-69). They are not incurrencyRoutes, and not in the PR's "left out on purpose" list.docs/dashboard.mdsays "Every money reply ... also sayscurrency". Add them, or name them in the doc as left out./api/requestsis not cached, so a new row shows at once, but its unit is cached for 30 s. On a new proxy the first read storesUSD. For 30 s after the first Bob row, the list saysUSD. Each row has its owncurrency, so the impact is small.- In a mixed view, the Requests table hides every row's cost. Each row has one known unit (
currencyon the row). The table could show each row in its own unit. This is a design choice; I note it only. - Live rows from
/api/eventsrender with the page unit. A Claude row that lands on a Bob-only page shows "Bobcoins" until the next refresh. - The mixed note stays visible on a tab that reads no money route (for example Settings), until a money reply resets it.
TestEveryMoneyRouteSaysTheUnitdoes not list/api/kvcache/suggest/holdout, which is incurrencyRoutes.DB.Currencyscans the whole window when there is one unit (DISTINCT with LIMIT 2 stops only at the second unit). The PR measures 0.2 s on 200,000 rows. Each/api/requestspage has a new query string (before), so each page pays this once.- bob-plugin/context-guru/README.md:24 is one very long line; the other lines wrap at about 100 characters.
What I checked
- Every changed line of the diff, except the 27 golden files, where I read two (
components.json,series_day.json); each adds onlycurrency. internal/modelinfo:currencyparses withKnownFields(true), so v0.7.3 refuses the key, and the plugin minimum of v0.7.4 is right (git describe: v0.7.3-9).Price.Resolvedcopies the struct, soCurrencysurvives the table lookup.Zero()does not compare the new field. No code comparesPricewith==.priceCostis the one place that setsAccountingCompleteat write time, and it setsCurrency. BothPriceandPriceMode, and the ping path (main_run.go:1117), go through it.withCurrency: wraps insidecachedRoute, so a cached body keeps its unit.capturecopies headers; no dash handler setsContent-Length./api/events(SSE) is not wrapped. No money route already has a top-levelcurrencykey, and no reply embedsEvent.addCurrencyhandles{}.cacheKeyhas no path, but every route takes its filter from the samescope, so sharing the unit across routes is correct.DB.CurrencyusesFilter.where(), so it excludes pings and follows tenant, agent, session and time filters.- UI:
el()skips a null icon and still turns a number into text, sotile()keeps its output.$$takes a root.setMoneyUnitrefuses a non-letter name.campaigns.jsandinsights.jsuseapi(), so they read the unit. - Data dependence: both row files changed, and the generated page matches them word for word. No Kind or level changed.
- The behavior-change block at the top of the PR names who, old, new, the minimum release and how to turn it off, with the owner's approval.
- I did not run Go or node tests (not approved, and Go is not installed).
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | fresh | 1 of 2 | 1 of 2 | 7651930943fd |
blocking |
Verdict: blocking
Findings
- dash/reprice.go:109 — a row that the late-price pass prices keeps
currency = 'USD', also when its cost is in Bobcoins- What fails: a Bob request on
bob-ultrahigharrives with incomplete usage (usageOK=false, for example a cut stream) but with some token counts.PriceMode(price, false)makes itpartialat $0, andpriceCostreturns before it setse.Currency(dash/event.go:939-946).insertBatchstoresrowCurrency("")=USD.noteUnpricedqueues the row (partial, cost 0, tokens > 0). On the next pass,repricePasscallse.priceCost(p, true)with Bob's table price, so the cost is now Bobcoins and the row iscomplete.applyRepricewritescost_usd,baseline_cost_usd,cache_saved_usd,billed_token_factorandtoken_accounting, but notcurrency. The row is now a complete Bobcoins cost markedUSD. - Result:
DB.Currencyfor the Bob view finds{Bobcoins, USD}and saysmixed. One such request hides every money figure on the Bob view for its whole window. It also adds Bobcoins totenant_spendas if they were dollars. This is the one write path fortoken_accounting = 'complete'that the PR did not change (grep "UPDATE requests SET" dash/*.go: only reprice.go:109 sets cost and accounting). - Proof: dash/reprice.go:77 (
priceCost(p, true)setse.Currency = p.Unit()on the copy), dash/reprice.go:109-113 (the UPDATE has nocurrency). The copy innoteUnpriced(reprice.go:31-33) starts with an emptyCurrency, so the value frompriceCostis the only correct one. - Fix: add
currency = ?to the UPDATE withrowCurrency(e.Currency). Add a test: queue an unpriced row, runrepricePasswith a Bobcoins price, then assert thatRequestsgivesCurrency == "Bobcoins"and that/api/statssaysBobcoins, notmixed.
- What fails: a Bob request on
Non-blocking
- Upgrade transition. Rows that
bob-ultrahighpriced on v0.7.3 (its prices.yaml then had 3.00/15.00 dollar rates) get the new column's default,USD. New Bob rows areBobcoins. A Bob view whose range covers the upgrade saysmixedand shows no money until the old rows leave the range. This is honest, but a Bob user will see it at once. One line in the Bob README or the PR's behavior note would help. The schema comment "USD on every earlier row, which is true" (dash/schema.go:954-955) is also false for any row that #1118's Bobcoins file priced before this release. - Stale body with a fresh unit. dash/api.go:831 says "Inside the cache, so a cached body carries the unit it was computed with". That is true only for
cachedRoutes./api/stats,/api/components,/api/insights,/api/spend/explain,/api/toolsand/api/toolfilterhave their own stale-while-revalidate caches inside the handler, sowithCurrencyputs a unit from at most 30 s ago on a body up to 10 min old. Most changes go tomixed, which hides money, so the risk is small. Correct the comment, or name this case. - README claim ahead of #1124. bob-plugin/context-guru/README.md:133-134 says the Bob status bar shows Bobcoins with a proxy that sends
currency. In this tree, bob-plugin/statusbar/src/model.ts:102 still prints$${usd.toFixed(2)}and does not readcurrency. The status skill still says "even where a$sign shows", which is correct. Make the README match until #1124 merges. - KV-cache labels still say dollars. dash/ui/kvcache.js:784 (
' $/MTok'column heads) and dash/ui/kvcache.js:462 ("Rates in USD per million tokens") do not follow the unit. With Bob's file,/api/kvcache/pricinggives Bobcoin rates under a$/MTokhead. - Request drawer.
/api/requests/{id}has the row's owncurrency, but the drawer formats it with the page unit. In a mixed view, a single row's cost shows—although its unit is known. Each row in/api/requestshas the same problem. You could format a row with its own unit. - Case of the unit. The server accepts
usd(the regexp allows any case). The UI then treats it as a unit that is not USD and shows1.75 usd. You could normalizeusdtoUSDinParseTable, or refuse it. withCurrencycallsa.scope(r)again, so a hosted deployment runsauthtwice for each money request. This is small, but you can avoid it./stats, thecg_*_usdmetrics andtenant_spendadd Bobcoins and dollars into one number on a mixed proxy. This was already true before (since #1118) and the docs now say so. No change is needed in this PR.
What I checked
CLAUDE.md, the full diff (32 non-golden files, 1105 lines), and the 27 golden files. The golden files only get"currency": "USD"(24 + 3 lines) and 2 comma fixes.internal/modelinfo:currencykey,KnownFields(true)(so an older proxy refuses the key, and the v0.7.4 minimum is necessary), the regexp, the reservedmixedin any case, andPrice.Unit(). v0.7.3 is the newest tag, so v0.7.4 is the next release.- Each write path for cost:
priceCost(used byPrice,PriceMode, and the ping row in proxyapp/main_run.go:1117-1118), the insert column and placeholder count (store.go: 1 column, 1?, 1 arg),scanRequestandrequestCols, the additive column, andapplyReprice(finding 1). DB.Currency:Filter.where()uses only ther.alias andEXISTSsubqueries, so every filter works in this query. The query counts only complete rows, and it excludes keep-alive pings the same way as the views.withCurrencyandaddCurrency: a non-200 or non-object body passes unchanged,{}gives no extra comma, the headers are copied, and no money route streams or setsContent-Length(SSE is/api/events, which is not wrapped). The order inMount(currency insidecachedRoute) and the 30 scurrencyCachekeyed by principal and query.- UI:
usd()gives the same USD output (the 9 values in the test),setMoneyUnitrefuses a name that is not letters, the note and.money-symheads,moneyIconadds a separate SVG node (no markup from the unit name),tile()withel()children,subLabelswith cloned heads,charts.jsandcampaigns.js. Every moneyapi()call uses the page filter, so concurrent replies do not set different units. I found noapi()call scoped to one session. - Tests: the Go tests for the unit on rows, the routes, the filter and the cachestate contract;
moneyunit.test.mjswith its Go wrapper; theestrange.test.mjsfix; the Python version tests (v0.7.3 refused, v0.7.4 accepted). - Data dependence: the 2 row files changed, and the generated page rows match them word for word. No Kind or level changed. The behavior change is named at the top of the PR, with the owner's approval.
- I did not run Go or node tests. Live tests are not approved.
The late-price pass (#920) wrote the cost and `complete` but not the currency, so a Bob row priced late kept the USD default. One such row made the whole Bob view say "mixed" and hid every money figure. applyReprice now writes `currency` too. No other path writes a cost. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
kvFetch read its money routes with its own fetch and never applied `currency`, so a Bob proxy showed Bobcoins with a `$` sign there. One helper, readMoneyUnit, now applies the unit for api() and kvFetch. No other direct fetch reads a money route with the page's filter. (The hook also removed one trailing space in kvcache.js.) Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
In a view with more than one unit, the net-saving chart still drew Bobcoins and dollars added into one line, titled "in dollars". Every money chart (net saving, the saving bars, the daily columns, the keep-alive cost line) now shows an empty state with the reason. A subscription's keep-alive line is in tokens and is still drawn. moneyWord() says "mixed units", not "dollars", for a mixed view. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
/api/adapt/compaction, /settings and /tools carry money (usd, usd_low), so they join currencyRoutes. Two comments now say what is true: a handler with its own cache can get a unit up to 30 s old on an older body, and a row a Bobcoins file costed before the column existed reads USD. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Rows written before v0.7.4 are stored as dollars, so a Bob dashboard range that covers the upgrade reads as more than one unit. The README says so. The Cache detail rate heads also follow the unit now (they said `$/MTok` for Bobcoin rates). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
The dashboard shows dollars only for "USD". A file that wrote usd or Usd would have shown "1.75 usd". The loader now stores the one spelling. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
|
Round 1 replies. All 3 findings are fixed, test-first, in f674a29..cc3f20e:
Also fixed:
Left as is, with why:
Checks: |
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | resumed | 2 of 2 | 2 of 2 | cc3f20e1940f |
approve |
Verdict: approve
All 3 round-1 findings (2 from me, 1 from reviewer 1) are fixed, each with a test. The 6 new commits add no new defect.
Findings
None.
Earlier findings
- Reviewer 2, finding 1 (the Cache detail tab ignores the unit): fixed in 762b27c.
kvFetchnow returnsreadMoneyUnit(await res.json())(kvcache.js:400), the same helper thatapi()uses (app.js:402-412).dash/kvfetch.test.mjscuts both functions and checks that the stubapplyMoneyUnitgetsBobcoins. The/MTokrate heads now usemoneySym()(kvcache.js:784). - Reviewer 2, finding 2 (a mixed view charts a sum of 2 units): fixed in a1674a3.
noMoneyChart(host)draws the empty state when the unit ismixed.netSaving,savingsBars,dailyColumnsand the keep-alive cost line call it first.emptyStateclears the host (app.js:427), so no old chart stays.moneyWord()says "mixed units" for a mixed view. I checked the other charts:CGCharts.columns(app.js:2078, :2089),cacheShare,trendand the otherlineChartcalls draw tokens, counts, percentages or ms, not money.dash/mixedcharts.test.mjspins each money chart. - Reviewer 1, finding 1 (a repriced row keeps
USD): fixed in f674a29. The UPDATE in reprice.go:109-114 setscurrency = rowCurrency(e.Currency).TestRepricedRowTakesTheCurrencyOfItsPriceuses the existinglateLoaderandpartialEventhelpers (reprice_test.go:16-45). It checks the row's unit and/api/stats?agent=bob.
Non-blocking
- The round-1 point from reviewer 1 about bob-plugin/context-guru/README.md:133-134 is not answered. The README says "The Bob status bar shows Bobcoins with a proxy that sends
currency". In this tree, bob-plugin/statusbar/src/model.ts:102 still prints$${usd.toFixed(2)}. That is true only after #1124 merges. Say "after #1124", or merge #1124 first. - kvcache.js:462 still says "Rates in USD per million tokens" while the heads below it now say "Bobcoins/MTok". The author's reason (the note is built before any unit is known) is correct. The text is still wrong on a Bob page. A
.money-symspan, refreshed byapplyMoneyUnit, would fix it at low cost. TestEveryMoneyRouteSaysTheUnitadds/api/adapt/toolsand/api/adapt/settings, but not/api/adapt/compaction, which dbd9bcc also adds tocurrencyRoutes.- The author's other "left as is" reasons (one unit per page for rows and the drawer, the second scope check,
/statssums, the 30 s unit cache on/api/requests) are design choices. I accept them. - The extra top-level
currencykey on/api/adapt/settingsdoes not break its readers:costly.py:188reads named keys only.
What I checked
- Last review: round 1, 7651930, 2026-11-12T09:47:16Z
- New commits read: 6
- f674a29 fix(dash): a row priced late keeps the unit of its price
- 762b27c fix(dash-ui): the Cache detail tab reads the reply's unit
- a1674a3 fix(dash-ui): a mixed view charts no money
- dbd9bcc fix(dash): the adapt replies say their unit too
- 540f0e6 docs(bob-plugin): say a range across the upgrade shows no money
- cc3f20e fix(modelinfo): read a price file's usd in any case as USD
- Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 1's round-1 review (09:47:35Z). I checked its finding 1 (above) and its non-blocking points: the upgrade note (now in README and in the schema.go comment), the stale-body comment (api.go:831-833 now names it), the KV heads (fixed), the
usdcase (fixed in cc3f20e), the README claim ahead of #1124 (not answered, see Non-blocking). - The author's round-1 reply (10:10:23Z). I checked each "fixed" claim against the diff, and each "left as is" reason (see Earlier findings and Non-blocking).
- Reviewer 1's round-1 review (09:47:35Z). I checked its finding 1 (above) and its non-blocking points: the upgrade note (now in README and in the schema.go comment), the stale-body comment (api.go:831-833 now names it), the KV heads (fixed), the
git diff 76519309..HEAD: 427 lines outside the golden files, all read. Code around each change read:emptyState, the reprice test helpers, the chart call sites in app.js, thecostly.pyreader.- cc3f20e:
strings.EqualFold(f.Currency, USD)runs after the regexp and before themixedcheck, sousdandUsdbecomeUSD. The new test covers 3 spellings. - Data dependence: no new feature and no new stored data in these commits. The row files and the generated page are unchanged since round 1.
- I did not run Go or node tests. Live tests are not approved.
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.316 | offload-review skill, @vz-ibm's session | resumed | 1 of 2 | 2 of 2 | cc3f20e1940f |
approve |
Verdict: approve
All 3 round-1 findings are fixed, and each fix has a test. The 6 new commits add no new defect.
Earlier findings
- Reviewer 1, finding 1 (a row priced late keeps
USD): fixed in f674a29.applyRepricenow writescurrency = rowCurrency(e.Currency)(dash/reprice.go:110-114).TestRepricedRowTakesTheCurrencyOfItsPriceseeds one Bob row priced at write time and one partial row, loads the price late, and then checks that the late row isBobcoinsand that/api/stats?agent=bobsaysBobcoins. Without the fix, the view would saymixed, so the test can fail.partialEventandlateLoaderalready exist in dash/reprice_test.go:16-33.lateLoaderprices any model, so the row's model name does not matter. - Reviewer 2, finding 1 (the Cache detail tab does not read
currency): fixed in 762b27c.readMoneyUnit(dash/ui/app.js:299) is now the one step forapi()andkvFetch(kvcache.js:400). kvcache.js loads after app.js, so the global is defined.dash/kvfetch.test.mjspins it. The one other directfetchof a money route (suggestDrop,/api/requests?limit=1with one filter left out) does not set the unit on purpose. That is correct, because its filter is not the page's filter. - Reviewer 2, finding 2 (a mixed view still charts a sum of 2 units): fixed in a1674a3.
noMoneyChartcallsemptyState, which clears the host (app.js:427), so a refresh does not stack messages. It now guardsnetSaving,savingsBars,dailyColumnsand the keep-alive cost line, and a subscription line (in tokens) is still drawn. I checked every other chart call in the UI (grepforlineChart,CGCharts.*,columnsandecharts.init, 14 hits). The token, volume, cache-share, latency, expiry, KV ladder and feedback charts draw no money. The Insights bars plot usage, and their totals go throughusd(), which gives—in a mixed view.moneyWord()now says "mixed units". - Non-blocking items from round 1:
- Fixed: the adapt routes now carry the unit. The kvcache
$/MTokheads and the comments indash/api.goanddash/schema.goare correct now. The README describes the upgrade range.usdin any case is stored asUSD. - Left as is, with a reason: the static "Rates in USD" note, the per-row unit in the drawer and the Requests table, the double scope check, and the mixed
/statsand metrics totals. I accept these reasons. Each item is small and none is a defect of this PR.
- Fixed: the adapt routes now carry the unit. The kvcache
Non-blocking
TestEveryMoneyRouteSaysTheUnitnow lists/api/adapt/toolsand/api/adapt/settingsbut not/api/adapt/compaction, which dbd9bcc also added tocurrencyRoutes. The map entry is correct (dash/adaptcompaction.go:2037 registers that pattern). Only its test is missing. That route has a 5-minute timeout, so you may have left it out on purpose. If so, a comment would say why.- In a mixed view,
moneySym()returns$, so the kvcache rate heads read$/MTokabove rates that can be Bobcoins. This happens only when one deployment has both price units. - README line 168 (
`currency: Bobcoins`, so the proxy sends…) is still one long line. Reviewer 2 noted this in round 1.
What I checked
- Last review: round 1, 7651930, 2026-11-12T09:47:35Z
- New commits read: 6
- f674a29 fix(dash): a row priced late keeps the unit of its price
- 762b27c fix(dash-ui): the Cache detail tab reads the reply's unit
- a1674a3 fix(dash-ui): a mixed view charts no money
- dbd9bcc fix(dash): the adapt replies say their unit too
- 540f0e6 docs(bob-plugin): say a range across the upgrade shows no money
- cc3f20e fix(modelinfo): read a price file's usd in any case as USD
- Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 2's round-1 review (09:47:16Z). I checked both of its findings against the new code. Both are fixed, as described above. I also checked its non-blocking list.
- The author's reply comment (10:10:23Z). I checked each "fixed" claim against the diff, and each "left as is" reason. I accept all of them.
- The full diff
7651930943fd..cc3f20e1(427 lines), with the code around each change:applyRepriceand the reprice test helpers,emptyState, the chart call sites, the adapt route registrations, the order of the regexp, theUSDcase fold and themixedcheck inParseTable, and the order in which the UI scripts load. - I did not run Go or node tests. Live tests are not approved.
|
Round 2: both reviewers approve.
The review budget (2 rounds) is used. Ready to merge after #1124 and #1118. |
Main now holds #1118 squashed. Hand-resolved files: - bob-plugin/context-guru/README.md, skills/preset-picker/SKILL.md, skills/status/SKILL.md: kept this PR's wording (the dashboard now says Bobcoins, v0.7.4 minimum). - bob-plugin/context-guru/prices.yaml: kept the comment about the `currency` key and the `currency: Bobcoins` line. - bob-plugin/prices_test.go: kept the Unit() == Bobcoins check. - bob-plugin/context-guru/scripts/test_bob_control.py: tests added on main named v0.7.2 as the minimum; now v0.7.4. - dash/schema.go: kept the `currency` column and main's backend, client_compaction and acc_fallback columns and backfill. - dash/store.go: INSERT has 108 columns and 111 placeholders in the literal text, as on main plus one for `currency`; args add rowCurrency after RestoredTokens. - dash/query.go: `r.currency` after restored_tokens, and `&e.Currency` in the same place in scanRequest. - dash/reprice.go: main's cg_llm_cost_usd update plus `currency = ?`. - dash/ui/app.js: took main's shell, then moved this PR's changes to app.js (usd, unit helpers, api), tabs/overview.js (tile), tabs/usage.js (dailyColumns), tabs/sessions.js (subLabels) and tabs/keepalive.js (keep-alive chart). - dash/mixedcharts.test.mjs: reads the moved functions from their new files. - docs/data-dependence/features/{bob-plugin,dashboard-database}.md: main's text plus this PR's sentence about the unit. - docs/data-dependence.md: rebuilt by hand for those two rows (Go is not installed here). Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Main removed the local waitFor helper in #1182. dash/currency_test.go still called it, so go vet failed in CI (build-test, record). Assisted-By: Claude Opus 5.5 <[email protected]> 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 1 (claude, user of @amiddavid) | Claude Code 2.1.326 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 3 of 3 | 051976da62ba |
approve |
Verdict: approve
The merge of main keeps every change of this PR, and the test fix is correct. I found no new defect.
Findings
None.
Earlier findings
- Reviewer 1, round 1, finding 1 (a repriced row keeps
USD): still fixed. Main changed the UPDATE in #1172 (cg_llm_cost_usd = cg_llm_cost_usd + ?). The merge addscurrency = ?after it, and the argumentrowCurrency(e.Currency)is in the same place (dash/reprice.go:123-126). - Reviewer 2, round 1, finding 1 (the Cache detail tab ignores the unit): still fixed.
readMoneyUnitis in app.js, and kvcache.js is unchanged by the merge. - Reviewer 2, round 1, finding 2 (a mixed view charts money): still fixed. #1151 moved
dailyColumnsto tabs/usage.js and the keep-alive cost line to tabs/keepalive.js. ThenoMoneyChartguards moved with them.dash/mixedcharts.test.mjsnow reads those two files. - README claim ahead of #1124 (round 1 and 2 non-blocking): resolved. #1124 is on main, and bob-plugin/statusbar/src/model.ts:109-110 now reads
currency. The merge order in the author's comment of 2026-11-12T10:12:45Z (#1124, then #1118, then this PR) is met.
Non-blocking
- bob-plugin/context-guru/README.md:175 is still one long line (about 150 characters). Both reviewers noted it before.
- The small follow-ups the author listed on 2026-11-12 are still open: a route-walk test row for
/api/adapt/compaction,$/MTokheads in a mixed view, and the static "Rates in USD" note in kvcache.js.
What I checked
- Last review: round 2, cc3f20e, 2026-11-12T10:12:11Z
- New commits read: 2 on the PR's first-parent line, plus 46 main commits that the merge brings in
- Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
- New items since my last review:
- Merge check. I compared the PR's net change at cc3f20e (against c4b284e) with its net change now (against d008870), file by file. 19 files differ:
- bob-plugin files: the difference is #1118 and #1124, which are now on main. What is left is this PR's own text: the
currency: Bobcoinskey, the v0.7.4 minimum, and the README and skill wording. - test_bob_control.py: the tests main added now say v0.7.4. The v0.7.3 refusal test and the v0.7.4 accept tests are consistent with
PRESET_MINIMUM_RELEASE. - dash/ui: the sorted set of added and removed lines in app.js plus tabs/*.js now is the same as the set in app.js at cc3f20e (
diffexit 0). No change was lost in the move to the tab files. - dash/store.go: a script counts 111 columns (without the token columns) and 111
?in the literal text. The argumentrowCurrency(e.Currency)followsRestoredTokens, as the column followsrestored_tokens. - dash/query.go:
r.currencyand&e.Currencyare both afterrestored_tokensand before the token columns. - dash/schema.go: the column and the additive column are as before, beside main's new columns.
- Golden files: all are valid JSON. Each adds only
"currency": "USD"(27 lines) and 3 comma fixes. - docs/data-dependence.md: the two rows match their row files word for word (
grep -Ffinds each body one time).
- bob-plugin files: the difference is #1118 and #1124, which are now on main. What is left is this PR's own text: the
- 051976d:
internal/testutil.WaitFor(t testing.TB, what string, cond func() bool)has the same signature as the removed helper. NowaitFor(call is left in dash/*.go. - Main's new code since c4b284e: no new
/api/route, socurrencyRoutesstill covers every money route. #1173's Overview line for requests that could not be priced usesusd(), so it follows the unit. - I did not run Go or node tests. Live tests are not approved.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @amiddavid) | Claude Code 2.1.326 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 3 of 3 | 051976da62ba |
approve |
Verdict: approve
The 2 new commits are a merge of main and a one-line test fix. The merge keeps every change of the PR. I found no new defect. CI is green at this head.
Findings
None.
Earlier findings
- Reviewer 2, round 1, finding 1 (the Cache detail tab ignores the unit): still fixed.
kvFetchreturnsreadMoneyUnit(await res.json())(dash/ui/kvcache.js:400). - Reviewer 2, round 1, finding 2 (a mixed view charts a sum of 2 units): still fixed. After the split of app.js (#1151), the guards are in their new files:
netSavingandsavingsBars(charts.js),dailyColumns(tabs/usage.js:24), the keep-alive cost line (tabs/keepalive.js:726).dash/mixedcharts.test.mjsnow readstabs/usage.jsandtabs/keepalive.js, so it still checks each guard. - Reviewer 1, round 1, finding 1 (a repriced row keeps
USD): still fixed. The mergedapplyRepricekeepscurrency = ?beside the newcg_llm_cost_usdterm from #1172 (dash/reprice.go:123-127). The argument order matches the columns. - Round 2 non-blocking, README line ahead of #1124: now true. #1124 is merged and in this head. bob-plugin/statusbar/src/model.ts:109-110 reads
currency. - The other round-2 non-blocking items (no test row for
/api/adapt/compaction,$/MTokin a mixed view, the static "Rates in USD" note, one long README line at bob-plugin/context-guru/README.md:175) are not changed. The author listed them as follow-ups. I accept that.
Non-blocking
- proxyapp/main_run.go:1141-1157: a timed-out Bob ping row stores
currency = USDwith a Bobcoins cost. #1186 (now merged in) books a timed-out ping at its projected cost:ev.CostUSD = r.CostUSDwith no tokens. Soev.Price(price, false)does not reachpriceCost'se.Currency = p.Unit(), andinsertBatchstoresUSD. The view's unit is correct:DB.Currencycounts onlycompleterows and leaves out pings. Only the row's owncurrencyfield is wrong. Fix: setev.Currency = price.Unit()whenpriced, inKeepAlivePing. This came with the merge, so a follow-up is enough. - bob-plugin/context-guru/skills/status/SKILL.md:36 still says "even where a
$sign shows". With #1124 merged, the status bar shows Bobcoins. The text is still safe advice.
What I checked
- Last review: round 2, cc3f20e, 2026-11-12T10:11:56Z
- New commits read: 2
- Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
- New items since my last review:
- The merge: I compared every changed UI line of
c4b284e2..cc3f20e1withd008870e..HEAD. The 2 sets of+/-lines are the same, so no UI change was lost in the split intotabs/*.js. The 11 new top-level names (moneyUnit,setMoneyUnit,noMoneyChart,readMoneyUnit, ...) are declared once, in app.js, soTestDashboardScriptsDeclareEachTopLevelNameOnceholds.$$,svgElandemptyStateexist in app.js. - The merged Go code:
requestColsandscanRequestputr.currencyand&e.Currencyat the same place.insertBatchhas one more column, one more?and one more argument, in the same order. The additive column,priceCost,withCurrencyandcurrencyRoutesmatch round 2. No newUPDATEinmainsets a cost orcomplete(setBypassTokensmoves onlymissingtopartial). Main added no new money route and no new money chart (grepforyFmt: usdand directfetch(calls in dash/ui). - The rest of
d008870e..HEADoutside dash/: bob-plugin, modelinfo, deploy and docs. The prices.yaml from #1118 keepscurrency: Bobcoins. The two data-dependence rows and the generated page match word for word. - 051976d:
testutil.WaitFor(t, what, cond)has the same signature as the removed local helper. No otherwaitFor(call or sleep is left in the new tests. - CI at this head: build-test, record, purego, build, analyze, CodeQL, trivy and DCO pass.
- I did not run Go or node tests. Live tests are not approved.
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]>
Summary
Bob bills in Bobcoins, and Bob users see Bobcoins in Bob IDE. The dashboard now shows Bob's costs in Bobcoins too. The unit comes from the price file, which already holds the numbers, so no code names Bob.
What changed
internal/modelinfo: a file-level keycurrency(1 to 16 ASCII letters; absent meansUSD;mixedis reserved). It is carried onPrice.Currency(not on the wire) and read throughPrice.Unit().bob-plugin/context-guru/prices.yaml:currency: Bobcoins.PRESET_MINIMUM_RELEASE["bob-ultrahigh"]is now v0.7.4.currency, defaultUSD(an additive column, no schema version change). Each row stores the unit of the price it used.currencyat the top level: one unit,mixed, orUSDwhen no row is priced. OneSELECT DISTINCTquery per view, cached for 30 s. Unpriced rows do not count. If the unit cannot be read, the reply saysmixed, so money is hidden, not shown with a wrong unit.usd()uses the page's unit. The ~230 call sites are unchanged. The saving chart's title, the campaign column heads and 2 table heads follow the unit.*_usdfield names in the API,/statsand the Prometheus metrics. Their docs say the value is in the price file's unit.Data dependence
The new column holds a unit name, which is configuration, not user data. The dashboard database row in
docs/data-dependence/says so.How it was tested
go build ./...,go vet ./...: OK.go test ./dash/... ./internal/modelinfo/ ./bob-plugin/ ./components/all/ ./config/ ./proxy/ ./proxyapp/: OK, exceptTestRateFillTableAndPrice(see Known failure).mixedrefused.Bobcoinsfor Bob rows,USDfor Claude rows andmixedfor both, also with a filter;1.75 Bobcoins; mixed gives—;bob-ultrahighand accepts v0.7.4.TestCacheStateCurrencyContractpins the contract that the Bob status bar (feat(bob-statusbar): show Bob's savings in Bobcoins, not dollars #1124) reads:currencyat the top level,"USD"(never empty) and"mixed"in lower case.Known failure, not from this change
TestRateFillTableAndPrice(internal/modelinfo) fails on this Mac on the base branch too, with and without-race: a float rounding difference (0.00042against0.00042000000000000007). It fails the same way without this PR. It likely needs its own issue.Technical notes
/api/requests/{id}(each row has its owncurrency), the keep-alive ledger, the transcript and archive reads (no money),/api/me/*(subscription figures, always API dollars), and/api/events(a stream; its rows carrycurrency).currencykey. They were edited by a script, not regenerated, to keep their floats stable across machines.