Repository navigation
feat(members): show the credits a Bot's work used on its Goals tab - #37665
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the card is a new view next to the goals, built on the existing What this change shipsInventory (6 items) — 6 justifiedIntent: let a Bot's owner see what the Bot's work has spent so far, next to its goals. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 6d5d3d0 Description read[DESCRIPTION-READ] 0a5dee93dc7158aae4cb6eb90e32ccdf5eb0370241f8ba325c1de21680c07f11 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change adds an optional field and a card on top of the Notes
[DESIGN-REVIEWED] 6d5d3d0 Description read[DESCRIPTION-READ] 3151473ed961ae90aa12e7093345ab5e682cb4cc73478d525b6c1246c74a26af That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS No blockers. All four card states are in the screenshots, and the blind reader correctly read "Credits used" as what the work has cost so far. Notes
[UX-REVIEWED] 6d5d3d0 Description read[DESCRIPTION-READ] 8602dd5a286438ef8f3c261cddfac44b39fb685d7b512ceeb6fcf8a6f0b2a06c That sha256 names everything this verdict read: the PR description, plus the 7 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: A person should decideWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 521 lines, more than the 400 it may approve on its own. Additive change: GET /api/members/{slug}/goals gains an optional An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
|
Render Benchmark (counter budgets) is red for a reason outside this diff: Playwright cannot install Chromium on the ubuntu-26.04 runner image ( |
d2cdf7a to
0fa8fec
Compare
|
span=eecd55cefe1e
|
0fa8fec to
6d5d3d0
Compare
|
span=eecd55cefe1e
|
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 6d5d3d04f40e.
What I checked
member_goals.work_spend: counts each worker once through the per-renderspenderalias, only for rows withcredits_reported is True, returnsnot_reported(never 0) when nothing was metered, and markspartialwhen the fold dropped boards, tasks, units or spenders._read_work_spend: reads withcold=Falseoff the loop, schedules one background prime onSlotFoldNotReady, and returnsnullunless the thread's DM binding names this Bot and this slot, so a shared slug or a deleted Bot's leftover thread shows nothing. Any read error givesspend: nullwith a 200, so the Goals GET cannot fail because of the card.- Writes do not read the crew log; both cache writers (
CrewGoals,CrewHeartbeat) keep the spend line already shown.
Tests run locally on this head
- Backend:
test/test_member_goals_spend.pyplus the othertest/test_member_goals*.pyfiles: 252 passed. - Frontend:
src/pages/members/CrewGoals.test.tsx: 53 passed. - All CI checks pass on this head (none pending); the Render Benchmark red mentioned earlier is gone.
Optional (non-blocking)
CrewGoals.tsxSpendCard: the query does not refetch whilestatusispending, so "Still counting" stays until the tab is opened again (the UX review noted the same). A shortrefetchIntervalwhile pending, or "Still counting, check back shortly", would fix it. Fine as a follow-up.
AI-assisted, sent by Bolin Review bot
Part of #37361
Problem / Motivation
Goal: A Bot's Goals tab shows the credits that the Bot's work has used, right under its goals.
The owner in #37361 gave a Bot a goal and let it run for days. The goal and its milestones say what the Bot believes, and nothing on the Bot's page shows what the work spent. The per-task cost already exists: the
workstreamscrew-log fold joins each work item to the charges of the worker session bound to it. Only a page the Bot writes itself (project report, org chart) reads that fold today, so an owner who never asked for such a page sees no number at all.Why it matters
An owner who cannot see what a goal has cost cannot tell when to stop or narrow the work. This is the "what was spent" half of the third ask in #37361, and the number the later per-goal limits would be measured against.
Not a goal
What changed (motivation → approach → change)
The Goals tab gets a Credits used card right after Goals.
42.5 creditsAt least 42.5 creditsNot reported(never0)Still countingGET /api/members/{slug}/goalsadds aspendfield (dashboard/handlers/member_goals.py, typed asGoalSpendinapi/client/agents.ts).work_spendsums the task rows of theworkstreamsfold for the Bot's thread slot, and counts each worker session once by the fold's per-renderspenderalias, so a worker that served three tasks is billed once. The route reads the fold withcold=False: a cold slot answerspendingand asks one background prime, so the request never folds every unit on the loop. Goal writes do not read the crew log; the Goals tab and the Heartbeat row keep the spend line they already have when a write answer comes back without one.What the number includes and what it leaves out. It is the credits that the turn, subagent and background closers of each session bound to a work item reported (
work/charged, relayed into the board's log). It leaves out the Bot's own chat turns, sessions that were never bound to a work item, and anything a provider did not meter. It does not touch the Telemetry spend table that #37407 changes, does not implement the attribution rule that the #35488 RFC proposes, and does not fix #21973 (subagent spend missing from turn and session totals in Telemetry); a subagent's charge counts here only when the bound worker's own log recorded it with credits.New strings are in all 12 locales (
i18n/locales/*.json, withen-XA.jsonregenerated);docs/system-specs/modules/crew-mode.mddescribes the card.Backwards compatibility
Compatible: the GET answer gains one optional field,
spend; every existing field and route is unchanged, and the frontend treats a missing field as no card.Removes nothing: the change adds one field and one card; no key, route, record or reader is changed or dropped.
Tests
test/test_member_goals_spend.py(new): one worker bound to two tasks counts once; no charge readsnot_reported, not zero; any dropped board, task, unit or spender readspartial; a malformed value readsnot_reported; the GET route carries the line and reads onlyworkstreamswithcold=False; a cold slot readspendingand schedules one prime; only the Bot that the thread's DM binding names sees its spend, and another Bot on the same slug (before or after the owner is deleted) or a Bot with no thread getsspend: nullwithout reading the fold; an unreadable fold givesspend: nullwith a 200; a goal write does not read the fold.website/src/pages/members/CrewGoals.test.tsx: the card sits between Goals and Milestones;At least,Not reported(and no0),Still counting; no card onnull; the line survives a milestone removal and a Heartbeat toggle, whose answers carry nospend.not_reportedbranch, and replacing the cache merge inCrewGoals.tsxorCrewHeartbeat.tsxeach turn a test red.--sequence.shuffle.i18n:checkwithI18N_BASE_REF, thesrc/i18n/vitest layer,tsc, eslint andnpm run buildpass. The related backend set (1356 files) has 57 failures in five files (file_explorer/tests/test_server.py,test_cli.py,test_cli_stt_memory_doctor.py,test_apps_registry_identity_admission.py,test_auto_improvement_members.py); the same 57 fail on a clean checkout of the base commit on this host, so they are environment failures, not this change. The related frontend set (567 files) passes.Manual verification
Component renders with mocked data (below). No live gateway was used.
Screenshots / video
Component render, not the live page. Mocked data.
Reported, light:
At least (dark), Not reported (light) and Still counting (dark)
Related Issues
Part of #37361
Related, not duplicated: #37407 (Telemetry spend table outcome columns), #35488 (RFC for subagent credit attribution), #21973 (subagent spend missing from totals).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)