Repository navigation
FIX-2398: Teammates shows what each coding task spent - #4710
Conversation
A coding task's line gives its tokens and, when the vendor reported one, the charge; its popup gives the model with input and output apart; the teammate's panel totals its coding tasks. All read from the row's spend, folded by orchestration's taskSpendView, through the registry's spend copy. A subscription run shows tokens and no dollar figure. Cursor's host now passes onActivity, as Codex's does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Second look + architecture passOverall: the approach is right. It reads the already-folded 1. Panel total mixes two populations (worth fixing here)
2.
|
There was a problem hiding this comment.
/simplify review (FIX-2398)
Verdict: The overall shape is right for this repo — fold spend in the adapter, render with the same registry Spend line the other workforce UIs use, and prove it with tests. This is a single commit (~249 lines, 10 files), not a sprawling bundle.
What works
- Vendoring
flow-state/spend.tsxvia fallow matches kitchen-sink, shift-manager, and claude-code-style; fighting that with a new shared import path would be more complexity, not less. - Splitting
spendViewOf(fullTaskSpendView) from harness/model extraction keepsBoardTaskhonest for UI while preserving existingharnessAndModelbehavior. - Wiring Cursor
onActivityinhost.mtsis the minimal harness hook so live spend can update (Codex already had it). task-spend.test.tsxencodes the product rules well (subscription → no$, popup split, panel total, ledger fold).
Simpler alternatives considered (optional follow-ups, not blockers)
spendViewOfvs orchestration —packages/orchestration/src/inbox/row-view.tsalready folds row spend the same way; shift-manager reads.spendthroughtaskRowView. Teammates already callstaskRowViewinwaitingOf. A follow-up could merge to onetaskRowViewcall pertoBoardTaskand dropspendViewOf+ the smallspendOf(view)helper, avoiding drift androw as never.- Card line
model: nullspread — Prefer aSpendLineOptionsflag (e.g.hideModel) in the registry copy so the card does not mutate the view object for presentation. - Panel total vs
spend.tsxheader — The file comment says totals are "never summed here";CodingSpendcorrectly sums for the panel but the comment will mislead. Either a one-line exception in the copy's header or a tinycodingTasksSpendLine(views)helper next tospendLine(with a unit test) would keep aggregation rules in one place. - Partial / unreported tokens in the panel total — Summing with
(inputTokens ?? 0)can read as fully reported when some tasks are still partial; worth a conscious product call (maybe only sum rows with!unreportedand both sides non-null).
Performance: No concerns at lab scale.
Tests run locally: pnpm test task-spend in labs/teammates — 6/6 passed.
Happy to merge as-is; the items above are polish if you want a cleaner second pass.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35ad93d307
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Snob — already tight. No POC.
Read labs/teammates/src/adapter.ts, components/TaskCard.tsx, components/Popups.tsx, components/TeammatePanel.tsx, components/flow-state/spend.tsx, host.mts, test/task-spend.test.tsx, test/fake-lab.ts, README.md, and .fallowrc.json. spend.tsx matches packages/ui/registry/components/spend.tsx byte for byte (and the kitchen-sink, claude-code-style, and shift-manager copies). Also read taskRowView / taskSpendView and packages/shift-manager/src/lib/usage.ts.
A rewrite does not shrink this contract:
- The registry copy keeps
durationText, attempts, andharnessLabelso the file stays the copy fallow ignores. This lab does not call them. Cutting them is a fork. - Cursor
onActivityis the one feed argument Codex already forwards. spendViewOfis the fold this adapter already used for harness and model, now returned whole.spendOfturns anullharness or model into an absent field soharnessAndModeldoes not storemodel: null. Inlining that projection lengthens the call.waitingOfalready callstaskRowViewfor the hold. Readingspendoff that same view deletesspendViewOf, and it also runs status normalization (blocked→held) into theliveflag. That is a different read.CodingSpendis the panel total this PR decided: sum of the per-task views, a charge only when some task reported one, attempts left off.usage.tstotals theworkerUsagequery over a period, in different words (12.5 K tokens). A shared summer is new API.spendLinejoins with·and has noCoding tasks:prefix, so a fake view is longer and changes the pinned string.{ ...task.spend, model: null }hides the model the harness tag already shows, with no new option on the copied component.- The
data-task-spendwrapper is the marker this PR names so the line is not adata-step. The six tests are six pins: charge, subscription, popup, panel, stored ledger, unreadable ledger.
Left as recorded: panel total in place of a Background list, no second ledger fold, attempts omitted, byte copy, no changeset.
Head 35ad93d3079a1632fe8836bbc3cb7a77ad5a7496.
Sent by Cursor Automation: Code Snob
…artial total says so Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
|
Typecheck is red, and the cause is outside this PR.
Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDfgRv9riWiVVdj8JG


The problem
The Teammates lab shows a coding task's harness and model, but not what the task cost. You can't choose between Claude Code, Codex and Cursor by cost. Each task row already carries its spend (FIX-2288), and PR 1 (#4423) added the vendor's charge to orchestration's folded view. The lab doesn't read any of that yet.
What this does
14.7k tokens · $0.42.gpt-5.5-codex · 12.4k in · 2.3k out · $0.42.Coding tasks: 23.9k tokens · $0.42.$0.00.onActivity, as Codex's already does. Spec D1 found this was the one thing Teammates dropped.Each figure is read from the row's spend, which
toBoardTaskfolds with orchestration'staskSpendView(the same fold it already used for harness and model). It's drawn through a byte copy of the registry'sspenditem.This is PR 4, the last app PR in the spec's plan. PRs 1, 2 (#4602), 3 (#4522) and 5 are merged. It's stacked on FIX-2382's Teammates PR #4709, because both edit the task popup.
What's asked of you
Nothing to decide. Merge after #4709.
Decided, not asked: the spec's "Background list total" is now Chief of Staff's panel total. The lab no longer has a Background list, and its panel lists the same tasks. The total adds up the per-task views. It doesn't fold the ledger again. Attempts aren't shown: the row's
attemptsalso counts re-claims (task schema), so it would overcount.Parts worth reviewing closely
labs/teammates/src/adapter.ts:spendViewOfnow returns the whole view, andBoardTask.spendcarries it. An unreadable ledger reads as no spend, so the row still renders.labs/teammates/src/components/TeammatePanel.tsx→CodingSpend. It shows the cost only when some task reported a charge.data-task-spend, notdata-step. It isn't a run step, and the screen test pins the step order.Verification
labs/teammates/test/task-spend.test.tsxhas six cases: card with charge, card with subscription, popup, panel total, a stored ledger folded by the adapter, and no spend or an unreadable ledger. Red states: removing the card'sSpendfails the two card cases. Removing the popup's or the panel's fails its own case. RemovingspendfromtoBoardTaskfails the stored-ledger case.pnpm typecheckandpnpm fallow:new-dead-codeagainst the base.No changeset: Teammates is a private lab.
Links: FIX-2398 · epic FIX-2369 · spec #4398 · base #4709
Generated by Claude Code