Repository navigation
fix(ui): label model usage contributions as messages - #146735
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:22 AM ET / 11:22 UTC (Revision 7). ClawSweeper reviewWhat this changesThe Models settings page labels usage contributions as messages, renames its private count field, and adds regression coverage and explanatory documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused correction: fetched main and the latest release still show the incorrect unit. The supplied visual proof supports the fix, and no actionable patch defect was found. Priority: P3 Review scores
Verification
How this fits togetherThe Models settings page receives provider totals from the Gateway’s session-usage aggregation. It displays those totals as local spend, token usage, and a count of messages carrying usage records. flowchart LR
A[Session messages] --> B[Usage record aggregation]
B --> C[Provider totals]
B --> D[Separate session count]
C --> E[Models settings card]
E --> F[Tokens, cost, and messages]
D --> G[Usage overview]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +124, Docs 0. Total +124 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep accounting with its existing owner and make the Models card describe its usage-bearing message count accurately. Do we have a high-confidence way to reproduce the issue? Yes: one session with two usage-bearing replies produces a provider count of two, which current main labels as sessions. Source and supplied before/after screenshots establish the mechanism; this review did not run it. Is this the best way to solve the issue? Yes: correcting the private presentation field and label preserves the authoritative accounting and avoids introducing a competing counter. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 32bf352734f0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
d9b0583 to
cadb550
Compare
cadb550 to
00db6ad
Compare
|
Merged via squash.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
What Problem This Solves
Models settings calls its local usage count “sessions” even though the provider rollup counts messages with usage records. One session containing two model replies therefore appears as “2 sessions.”
User Impact
The local spend detail now labels those contributions as messages. Token totals, cost, and the Usage page's separate session count retain their existing meaning.
Why This Change Was Made
Rename the private provider-card count and render the matching unit at the existing presentation boundary. The accounting producer already supplies the right number. The feature reference now states what the detail counts.
Production is +5/−5, net zero. The test fixture extraction preserves the existing tests while keeping the new regression file within the repository's line limit.
Evidence
Four regressions fail on the original label and pass after the repair: repeated messages for one model, different models in one session, provider aliases, and messages across sessions. On current head
00db6ad7f006764e104257d722ec64e8f9b62090(base3a78c93d51f056c9a9979177d6ac4b111a01445c), all 79 Models tests, five shared aggregation tests, the selected SQLite cached-usage case, and the normal explicit-base changed gate pass. The fresh independent managed P0–P2 review found no actionable findings. Baseline/candidate builds and the following live UI proof remain attributed to base51caa9442e47b91a88c8f382000e4bac0c7e6743; the eight-file patch is unchanged after integration.The actual Gateway-served Models and Usage pages were exercised with a synthetic session through canonical session/usage writers and ordinary CLI requests. Before: Models “200 tokens · 2 sessions.” After: “200 tokens · 2 messages.” Usage retains one session, three total messages, two provider messages, and $2. The German UI uses the normal English fallback for the corrected phrase. Both runs joined their owned processes and removed their isolated state without rescue; all eight screenshots were inspected.
Current-head CI run 34753703704 is running. The current base includes the previously failing file-tab selector correction from #146810; the unchanged seven-case file-link browser suite also passed on that exact main. Earlier independent CI fixture repairs and the undiagnosed project-resolution timeout remain recorded in prior runs; no assertion or timeout was weakened. Defect introduction provenance is unverified.