Work type
Bug / regression
Observed behavior
store.Run.UsageTotalsJSON and CostTotalsJSON (internal/store/store.go:70-73) are read and written by internal/store/sqlite.go (lines 329, 532, 840) but no code in internal/harness or internal/server ever populates them (rg 'UsageTotalsJSON|CostTotalsJSON' internal/harness internal/server → no hits). The columns are always empty, so anything reading run totals from the store (e.g. the durable summary added in #1383, which had to fall back to scanning usage.delta events; GET /v1/runs listings; forensics) cannot use them.
Expected behavior
The runner persists the final usage and cost totals on the run row at terminal status (they are already computed for run.completed's payload), or the dead columns are removed with a migration note.
Reproduction
Complete any run with usage; sqlite3 runs.db "select usage_totals_json, cost_totals_json from runs" → empty strings.
User and operational impact
Store-backed listings and summaries show no usage/cost; #1383 works around it by event scanning, which is O(events) per summary.
Suspected seam and search evidence
Runner terminal persistence path (where store.Run status is set to completed/failed/cancelled, rg 'UpdateRun|SaveRun' internal/harness); RunUsageTotals/RunCostTotals types in internal/store.
Blast-radius impact map
Runner → store write on terminal status; durableRunSummary in internal/server/http_runs.go can prefer the stored totals when present. No wire change. Tests: internal/harness store persistence test, internal/server durable summary test.
Regression test first
Named below per item; red command go test <pkg> -run <Test>.
Fix boundaries
In scope: the single seam named. Out of scope: any wire or schema change.
Diagnostic and observability evidence
Grep evidence cited above.
Verification plan
Red/green; go test <pkg> -race; full regression script.
Rollout and rollback
None — no persisted or deployed behavior changes beyond populating an existing column / list; revert PR.
Documentation and handoff
Engineering log entry.
Definition of done
Process acknowledgement
Work type
Bug / regression
Observed behavior
store.Run.UsageTotalsJSONandCostTotalsJSON(internal/store/store.go:70-73) are read and written byinternal/store/sqlite.go(lines 329, 532, 840) but no code ininternal/harnessorinternal/serverever populates them (rg 'UsageTotalsJSON|CostTotalsJSON' internal/harness internal/server→ no hits). The columns are always empty, so anything reading run totals from the store (e.g. the durable summary added in #1383, which had to fall back to scanningusage.deltaevents;GET /v1/runslistings; forensics) cannot use them.Expected behavior
The runner persists the final usage and cost totals on the run row at terminal status (they are already computed for
run.completed's payload), or the dead columns are removed with a migration note.Reproduction
Complete any run with usage;
sqlite3 runs.db "select usage_totals_json, cost_totals_json from runs"→ empty strings.User and operational impact
Store-backed listings and summaries show no usage/cost; #1383 works around it by event scanning, which is O(events) per summary.
Suspected seam and search evidence
Runner terminal persistence path (where
store.Runstatus is set to completed/failed/cancelled,rg 'UpdateRun|SaveRun' internal/harness);RunUsageTotals/RunCostTotalstypes ininternal/store.Blast-radius impact map
Runner → store write on terminal status;
durableRunSummaryininternal/server/http_runs.gocan prefer the stored totals when present. No wire change. Tests:internal/harnessstore persistence test,internal/serverdurable summary test.Regression test first
Named below per item; red command
go test <pkg> -run <Test>.Fix boundaries
In scope: the single seam named. Out of scope: any wire or schema change.
Diagnostic and observability evidence
Grep evidence cited above.
Verification plan
Red/green;
go test <pkg> -race; full regression script.Rollout and rollback
None — no persisted or deployed behavior changes beyond populating an existing column / list; revert PR.
Documentation and handoff
Engineering log entry.
Definition of done
Process acknowledgement