Skip to content

[codex] fix dashboard oversized usage transcript scans#354

Draft
nil-err wants to merge 1 commit into
deepcoldy:masterfrom
nil-err:codex/fix-usage-large-jsonl
Draft

[codex] fix dashboard oversized usage transcript scans#354
nil-err wants to merge 1 commit into
deepcoldy:masterfrom
nil-err:codex/fix-usage-large-jsonl

Conversation

@nil-err

@nil-err nil-err commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a 64 MiB cap before dashboard token-usage row rendering scans transcript files
  • skip advisory token usage for oversized transcripts while preserving cached usage when available
  • cover oversized cold reads and cached-growth behavior in cost-calculator cache tests

Root Cause

Dashboard hydration calls /api/sessions, which composes rows for closed sessions and asks cost-calculator for native token usage. A Coco closed session had a roughly 14 GB events.jsonl; after the transcript reader was made chunked, it avoided whole-file allocation but could still synchronously scan from byte zero on the daemon main thread. That blocked Coco's IPC server long enough for dashboard hydration to time out, so the dashboard only showed the healthy Codex daemon.

Validation

  • corepack pnpm vitest run test/cost-calculator-cache.test.ts
  • corepack pnpm exec tsc --noEmit
  • git diff --check
  • source-level smoke against the real 14 GB Coco transcript returned null in ~0.7s with the oversized-scan warning instead of scanning the file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant