Track token usage per session and objective#7
Conversation
A rebase follow-up that died without landing the fix (e.g. it couldn't push) marked the conflict feedback handled, so the head SHA being unchanged meant a re-sync deduped and never tried again — the PR stayed conflicting forever. RefreshPR now only dispatches a conflict follow-up when none is active for the PR (no duplicates while one is in flight), and clears stale handled conflict feedback first so a finished-but-unresolved conflict re-fires on the next observation. This is what lets PR #7 retry on its own once a working force-push exists. Test: a conflicting PR spawns one follow-up; no duplicate while it is active; a new one once it finishes still unresolved.
ae6768c to
0db71d3
Compare
|
Resolved the merge conflict with Conflict: only Verification after rebase:
The branch is now conflict-free and up to date with |
|
needs rebase to pick up fix of hanging test (cause of failing CI) |
Attribute agent token consumption to the session that spent it, in addition
to the existing provider usage buckets used for scheduling. This enables a
per-session and per-objective view of token spend in the dashboard.
Backend:
- schema: add sessions.used_tokens (INTEGER NOT NULL DEFAULT 0), plus an
idempotent ALTER-based migration so pre-existing DBs backfill to 0.
- store: AddSessionTokens / SessionUsedTokens, and ObjectiveUsage which
aggregates an objective's sessions into a total with per-session and
per-provider breakdowns (usage_provider overrides agent).
- orch: recordUsage now also increments the session total alongside the
provider bucket and transcript usage message.
- api: GET /api/objectives/{id}/usage; usage summary embedded in objective
detail; used_tokens flows through session + dashboard JSON.
Frontend:
- api.ts: used_tokens on Session/DashboardSession, ObjectiveUsageSummary
types, and a compact formatTokens helper (e.g. 12.3k).
- Objective page shows objective total + per-provider chips and a per-session
Tokens column; SessionDetail shows the session's token usage.
Tests: store aggregation/scoping/provider-override, recordUsage session vs
provider-bucket behavior, and the usage endpoint + JSON fields.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Head branch was pushed to by a user without write access
0db71d3 to
99e5d59
Compare
|
Rebased onto latest |
Summary
used_tokenscolumn.recordUsagewhile preserving provider bucket scheduling behavior.GET /api/objectives/{id}/usage.Verification
go test ./...npm --prefix ui run build