mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
Fix Overview crash when the act report has no totals block (#1438)
* fix(app): tolerate an act report without totals on Overview * Make ActReportJson.totals optional to match existing optional access
This commit is contained in:
parent
94090583f0
commit
9eb51af7cf
4 changed files with 18 additions and 3 deletions
|
|
@ -22,6 +22,7 @@
|
|||
- **The Capacity Dock card and the popover quota rows no longer print a pace verdict under each window.** The "On pace" / "Lasts until reset" caption from #1314 added a third line to every window cell and made the card read as clutter; the cells are back to percent, label and countdown, up to three windows share one row again with a fourth wrapping to a second, and the pace math still feeds the tooltip and the agent-tab card.
|
||||
|
||||
### Fixed
|
||||
- **The Overview no longer replaces itself with "This screen hit an error" when the act report has no totals.** The realized-savings figure read `actReport.data.totals.realizedCostUSD` behind a guard on the payload only, so an act report without a `totals` block threw during render and the section's error boundary latched — and because the desktop app repaints the durable report snapshot instantly on the next launch, a single such payload persisted in `localStorage` (one written by an older build that answered `{}`) crashed the Overview on every relaunch. The read now tolerates a missing block and reports $0 saved, which is what the card already shows before the first act report arrives.
|
||||
- **Codex sub-agent rollouts no longer double-count their parent's usage.** A thread spawned as a sub-agent replays its parent's history, including every `token_count` event with its original timestamp, and names the parent under `source.subagent.thread_spawn.parent_thread_id` rather than `forked_from_id`, so the fork guard never saw it and the replayed prefix was counted again per child. The parent id is now read from either field, and the replayed events drop like a fork's. On a corpus with 381 spawned children this removed 405 duplicate calls and 403,712 duplicate cache tokens; rollouts without sub-agents are unchanged. (#1380)
|
||||
- **Shared and MCP-redacted payloads no longer carry pull request urls or owner/repo labels.** `current.pullRequests` survived both passes verbatim: each row's full GitHub url and its `owner/repo#123` label named the repository to a paired peer device and to a name-redacted MCP client, the same class of leak #1337 closed for branch names. Sharing now drops the block outright, the way it already drops the project, session and per-branch rows. The MCP pass with `include_project_names: false` pseudonymizes `url` and `label` from the url — the aggregation key — with the same salted hash as the project and branch pseudonyms, domain-separated so rows referring to the same PR still line up while the cost, calls and totals stay untouched; `include_project_names: true` still sees the real urls and labels. (#1346)
|
||||
- **The menubar refreshes usage within five minutes while a session is running, instead of up to thirty.** The background change guard only stats directories, so a session appending to its transcript looked unchanged and the app skipped every refresh for half an hour; the skip now lasts at most five minutes, and the Kimi Code session store joined the watched roots.
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ export type DeviceScanResult = { found: ScannedDevice[] }
|
|||
// ————— src/act/report.ts buildActReportJson —————
|
||||
|
||||
export type ActReportJson = {
|
||||
totals: {
|
||||
totals?: {
|
||||
realizedCostUSD: number
|
||||
measuredActions: number
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,6 +454,20 @@ describe('Overview', () => {
|
|||
expect(screen.queryByText(/across \d+ fix/)).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders when the act report carries no totals', async () => {
|
||||
const now = new Date()
|
||||
getOverview.mockResolvedValue(makePayload(now))
|
||||
// A payload persisted by an older build (or any CLI that answered `{}`) is
|
||||
// replayed from the durable report snapshot before revalidation.
|
||||
getActReport.mockResolvedValue({} as ActReportJson)
|
||||
|
||||
render(<Overview period="30days" provider="all" />)
|
||||
|
||||
await waitFor(() => expect(getActReport).toHaveBeenCalled())
|
||||
expect(await screen.findByText('$312.40')).toBeInTheDocument()
|
||||
expect(screen.queryByText('Saved by applied fixes')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('zero-fills a contiguous 30-day window from sparse history', async () => {
|
||||
const now = new Date()
|
||||
const payload = makePayload(now)
|
||||
|
|
|
|||
|
|
@ -845,8 +845,8 @@ export function OverviewContent({
|
|||
const weeklyPct = weekPrior > 0 ? Math.round(Math.abs((weekNow - weekPrior) / weekPrior * 100)) : null
|
||||
const weeklyDirection = weekNow >= weekPrior ? 'higher' : 'lower'
|
||||
const topModel = data.current.topModels[0]
|
||||
const saved = actReport.data?.totals.realizedCostUSD ?? 0
|
||||
const applied = saved > 0 ? (actReport.data?.totals.measuredActions ?? 0) : 0
|
||||
const saved = actReport.data?.totals?.realizedCostUSD ?? 0
|
||||
const applied = saved > 0 ? (actReport.data?.totals?.measuredActions ?? 0) : 0
|
||||
const localSaved = data.current.localModelSavings.totalUSD
|
||||
// A custom range has no meaningful "vs last week" or month-to-date baseline.
|
||||
const signals = deriveSignals(data, now, rangeActive)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue