Skip to content

Show each task's token spend in the task picker - #205

Merged
milind-soni merged 1 commit into
mainfrom
feat/task-usage-chip
Aug 17, 2026
Merged

Show each task's token spend in the task picker#205
milind-soni merged 1 commit into
mainfrom
feat/task-usage-chip

Conversation

@milind-soni

Copy link
Copy Markdown
Owner

In plain terms

Each task now shows what it has spent: a quiet "· 12.3k" token tally after the timestamp in the task picker rows, with the input/output split on hover. The open task's total rides the picker button's hover title.

Notes

  • No server changes: wireTask already shipped the usage field the server tallies at turn.completed — the client type just never declared it and nothing rendered it.
  • formatTokens (src/lib) hides the chip entirely at zero ("a task that never ran shouldn't advertise a tally"), and rounds on integer tenths because float math would round 999,950 down to "999.9k" instead of promoting to "1M".

Test plan

  • src/lib/format-tokens.test.ts — 22 assertions across every threshold and rounding boundary (999/1000, 999,949/999,950, half-up at 1.25M, singular "1 token")
  • Mutation check: inverting either boundary fails the suite
  • pnpm typecheck clean; full pnpm vitest run green (740 passed); touched files clean under oxlint (added a SAFETY comment to a pre-existing assertion in TaskPicker so the file lints clean)
  • Reviewer eyeball: open the task picker on a bot that's run a few turns — rows show "· Nk" after the time; hover shows the in/out split

🤖 Generated with Claude Code

The server has tallied per-task usage since tasks landed, and wireTask
already carries it — the client just never typed or rendered it. Task
rows now show a quiet combined total ("12.3k") next to the timestamp,
with the input/output split on hover; the picker button keeps its shape
and carries the open task's tally in its hover title instead.

Formatting lives in src/lib/format-tokens: zero hides the chip, sub-1k
spells out "tokens", then k/M with one decimal. Rounding runs on integer
tenths so 999,950 promotes to "1M" instead of float-rounding down.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@milind-soni, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Limit details: You’ve used all 3 included reviews currently available under your plan.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1575fd43-e688-4853-91d3-fd349f310825

📥 Commits

Reviewing files that changed from the base of the PR and between 8b95206 and dd3e714.

📒 Files selected for processing (4)
  • src/components/TaskPicker.tsx
  • src/lib/format-tokens.test.ts
  • src/lib/format-tokens.ts
  • src/state/store.tsx

Comment @coderabbitai help to get the list of available commands.

@milind-soni
milind-soni merged commit 8c7bd1a into main Aug 17, 2026
5 checks passed
@milind-soni
milind-soni deleted the feat/task-usage-chip branch August 17, 2026 20:31
kargnas added a commit to kargnas/OpenMausBot that referenced this pull request Aug 17, 2026
main의 milind-soni#205(태스크별 토큰 지출), milind-soni#200(승인 결과 타입화), milind-soni#196(위임
영속화·비밀 마스킹) 등 7개 커밋 병합 충돌을 해결했다.

- main이 busy 플래그를 activity 상태 기계로 대체함에 따라 룸 턴의
  catalog 검증 실패 경로도 setActivity로 맞췄다.
- antigravity respondToRequest 테스트는 main의 unavailable 해소
  시맨틱을 채택했다.

Tested: pnpm typecheck, pnpm vitest run (83 files, 770 passed, 8 skipped)

Confidence: high
Scope-risk: moderate
Reversibility: moderate
aivsomkar added a commit that referenced this pull request Aug 18, 2026
main gained #205 (token spend in the task picker, using the same
TaskRecord.usage), the store change stream, activity states, and typed
approvals. Reconciled: one addTaskUsage with the superset shape (costUsd
kept; emits a bot change like main's did), settle path banks the turn's
authoritative usage then moves the bot to idle via setActivity, the
Usage settings tab sits beside main's new Companion tab.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.

1 participant