Repository navigation
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Usage page shows which projects, providers and models spent tokens, but not which conversation spent them, so an unexpected cost can't be traced back to a thread.
What changed
server.getUsageThreadBreakdownRPC returns per-thread token and cost totals, with expandable subagent rows and daily cost components. The Usage page loads it on demand when the Thread breakdown is selected.cwd, never counts as "Outside projects".client-runtimeadds the thread query atom, refreshed when prices change. Mobile has no thread view yet.docs/user/usage.mdcovers the new view.Stack
Depends on #9015, which depends on #9014. The branch is #9014's three commits, #9015's commit (
dcbaf50868), then this PR's single commitd41a62aaca. Review only the thread increment. Merge #9014 and #9015 first.Rebuilt 2026-09-25 on current
main(66129c6fd5). The previous head (c329b6d7d9) squashed an older, wider version of the stack. This head keeps only the thread breakdown. Dropped, as #9014 and #9015 already did:refreshTokencontract field (the thread RPC now walks sources like the summary, and the file cache keeps the second walk warm)Inputvariant and the refresh-lifecycle rewrite (retained statuses, refresh error toasts/alerts)Kept from
main: #12304's saved totals after transcript cleanup (the thread view folds the same retained files as the summary, so both reconcile after cleanup) and #11485's per-account scan directories and per-directory session counting.ProjectionThreadRepository.listByProjectIdwas removed as unused in #9917 and is restored here for worktree attribution.UsageThreadTable.test.tsxrendered static markup, whichmainno longer allows (#13104), so it was dropped. The subagent badges lost theirfont-normal/muted classes to satisfy the newshadcn(no-restyle)lint rule, arbitrary text sizes use thetext-2xs/text-3xs/rounded-xstokens, and the unusedUsageThreadDailyChartexport is now module-private (knip).Verification
At head
d41a62aaca:vp test runon server usage + persistence repositories, web usage components and state, sharedusageMerge/usageFormat, client-runtime state and contracts: 92 files, 1307 of 1309 passed. The two failures (uses explicit account settings…,does not share an in-flight scan…) fail identically on unmodifiedmainon macOS and pass in CI.t3,@t3tools/web,@t3tools/shared,@t3tools/contracts,@t3tools/client-runtimeand@t3tools/mobile.vp lintandvp fmton the changed files pass.UI
Breakdown recording: project → thread → expand → collapse
These captures were taken on 2026-09-05 from the integrated usage stack (#9308 at
7e24802) with synthetic data. They show this PR's thread table and expand/collapse behavior but were not re-captured at the rebuilt head. A fresh capture is still pending.Coordination trace: T3 thread b9fe71d2-8f1e-4170-aa28-e6972b3797bf
Rebased and updated with Claude Opus 5 in Claude Code (T3 Code harness). Earlier revisions: GPT-6 and GPT-5.6 Sol in the Codex harness.
Closes discussions