[Codex cost] Large active rollout remains incomplete in 0.48.1; consider ccusage fallback/reference
Summary
CodexBar 0.48.1 still undercounts local Codex usage when one active rollout is very large and continues appending. The bounded scanner remains in catch-up even after processed bytes equal total bytes, while the Spend Dashboard can show no partial data.
This looks closely related to #2452, #2525, and #2648, but it is reproducible on the released 0.48.1 build.
Environment
- CodexBar 0.48.1 (113)
- macOS 27.0, arm64
- TokenRemain 1.2.11 with bundled ccusage 20.0.19 used only as a same-machine comparison
Privacy-safe evidence
No session paths, IDs, prompts, responses, or account identifiers are included.
- Active Codex rollout/corpus displayed by CodexBar: about 1.11 GB
- Persisted CodexBar scan state: 17 files total, 15 complete
codexScanCatchUpPending = truecodexScanProcessedBytes == codexScanTotalBytes- Spend Dashboard initially showed
0 / 7coverage and no spend/token data, with no Finish now control. - Restarting CodexBar made Finish now appear.
- Selecting Finish now switched briefly to accelerated mode, then returned to background mode after one pass while the same 2 files remained incomplete.
Same-machine result for 2026-08-09:
| Scanner | Codex tokens | Estimated cost | Runtime |
|---|---|---|---|
| CodexBar CLI 0.48.1 cached/incomplete report | 17,532,866 | $13.699906 | ~0.7 s |
| TokenRemain bundled ccusage 20.0.19 | 55,300,931 | $62.396858 | 0.28 s |
The ccusage command used by TokenRemain was equivalent to:
ccusage daily --json --by-agent --offline --no-color \ --timezone Asia/Shanghai --since 2026-08-09
The cost difference can include pricing differences, but the token-count gap is large. I am presenting the ccusage result as a comparison/reference, not claiming it is automatically ground truth.
Possible implementation direction
TokenRemain avoids maintaining its own Codex JSONL reducer for this view. It bundles a universal ccusage helper and invokes daily --json --by-agent --offline --since ... with a 30-second timeout:
Would CodexBar consider one of these options?
- An optional signed/bundled ccusage backend or fallback when native history coverage cannot be established.
- Use ccusage output as a conformance oracle in tests for giant active rollouts, fork/subagent attribution, and daily totals.
- Keep already validated partial totals visible while catch-up is pending, and expose why the remaining files cannot complete.
- Keep accelerated catch-up active until completion/cancellation instead of returning to background after a single pass.
This would preserve the native scanner while giving users a reliable escape hatch for unusually large active sessions.
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 2, 2026, 12:28 PM ET / 16:28 UTC.
Summary Keep open as the owner-directed tracker: v0.56.3 shipped the original large-corpus and removed-source recovery fixes, but current source still bypasses the in-app Background Work Low Power setting for both automatic catch-up schedulers and the remaining orphan/stall-diagnostics scope needs a product decision.
Reproducibility: yes. for the remaining setting mismatch: set the app Background Work Low Power preference on while macOS Low Power Mode is off, then inspect either automatic scheduler, which currently forwards only the macOS state. The broader orphan-accounting policy still needs a representative corpus or synthetic regression fixture.
Root-cause cluster
Relationship: canonical
Canonical: https://github.com/steipete/codexbar/issues/2815
Summary: This remains the canonical tracker for the residual native catch-up behavior after the principal recovery fixes shipped.
Members:
fixed_by_candidate: https://github.com/steipete/codexbar/pull/2918 - The merged PR fixed the large-corpus bounded-indexing and semantic-progress failures reported here.fixed_by_candidate: https://github.com/steipete/codexbar/pull/3292 - The merged PR repaired the removed-source existing-cache discovery boundary reported in this discussion.partial_overlap: https://github.com/steipete/codexbar/issues/3316 - It tracks the related stalled catch-up auto-restart and CPU-loop behavior; v0.56.3 calls its pause repair partial.adjacent_distinct: https://github.com/steipete/codexbar/pull/2817 - It proposes an optional ccusage fallback, which is a separate package and product-direction choice rather than the native scanner repair.
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Maintainer decision needed
| Question | Recommendation |
|---|---|
| Should this tracker retain the remaining native low-power, unresolved-parent accounting, and stall-diagnostics work, with ccusage limited to a possible test oracle rather than a shipped fallback? | Keep native follow-ups together: Authorize a scoped native low-power repair and retain this tracker for the unresolved-parent and diagnostics policy decision; consider ccusage only as a conformance reference. |
Why: The proven adapter mismatch is narrow, but deciding whether unresolved forks may complete and whether to introduce an external executable changes user-visible completeness and maintenance policy.
Next step The remaining work combines a source-proven adapter mismatch with an accounting/UI policy choice, and the issue is explicitly owner-directed rather than safe for an automatic repair PR.
Review details
Best possible solution:
Keep the native scanner authoritative, route the app low-power preference through both automatic schedulers, and separately define how unresolved fork provenance and per-file diagnostics should be presented before considering any external fallback.
Do we have a high-confidence way to reproduce the issue?
Yes for the remaining setting mismatch: set the app Background Work Low Power preference on while macOS Low Power Mode is off, then inspect either automatic scheduler, which currently forwards only the macOS state. The broader orphan-accounting policy still needs a representative corpus or synthetic regression fixture.
Is this the best way to solve the issue?
No for an immediate ccusage fallback: the native fixes already shipped and the remaining native setting defect is narrower; a bundled helper is a separate package and product decision.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- Bundling or invoking ccusage would add a signed executable, provenance, update, and account-scoping surface before the native remaining behavior is fully defined.
- Changing unresolved-parent completion semantics without an explicit accounting policy could publish incomplete fork totals as complete.
Codex review notes: model internal, reasoning high; reviewed against 620f3b8e4eef.
Label changes
Label changes:
- add
issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label. - add
clawsweeper:source-repro: Current issue advisory state selects this label. - remove
clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label. - remove
issue-rating: 🦪 silver shellfish: Current issue advisory state no longer selects this label.
Label justifications:
P2: The remaining behavior affects local cost-history completeness and background resource use, but the major large-corpus regressions are shipped fixes.impact:other: This concerns persisted local cost-history coverage and catch-up behavior rather than a more specific owned impact class.
Evidence reviewed
What I checked:
- Current low-power mismatch: Both automatic catch-up adapters pass only macOS ProcessInfo low-power state to the shared policy, rather than the app's Background Work Low Power preference. (
Sources/CodexBar/UsageStore+CodexCostCatchUp.swift:357, 620f3b8e4eef) - Preference has independent app semantics: The setting resolves explicitly to true for the in-app “on” preference, independently of macOS Low Power Mode, confirming that the adapters currently omit a meaningful existing setting. (
Sources/CodexBar/SettingsStore+Defaults.swift:885, 620f3b8e4eef) - Removed-source recovery is covered on main: The current regression test reopens the same cache after fork child files are removed and verifies stale pending IDs and deleted-path associations are retired while a surviving missing-parent fork remains unresolved. (
Tests/CodexBarTests/CostUsageDiscoveryRecoveryTests.swift:7, 620f3b8e4eef) - Fix provenance: Commit 56bbc037 repaired abandoned parent discovery; commit 170ebd36 stopped stalled Spend Dashboard catch-up from being restarted by background synchronization. (56bbc037f616)
- Release provenance: v0.56.3 release notes list the abandoned-parent recovery as a partial fix for this issue and the stalled/failed catch-up pause as a partial fix for the separate CPU-loop report; both commits are contained in v0.56.3. (
CHANGELOG.md:17, 542ca301f135) - Owner-scoped remaining work: The repository owner explicitly kept this tracker open after the merged recovery for the in-app low-power preference, stall diagnostics, and unresolved-parent policy follow-ups.
Likely related people:
- steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
- xiehaibin18: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
How this review workflow works
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
- Maintainer-only repair and merge flows require explicit commands such as
@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review. - Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
I tested a local prototype against the v0.48.1 source. This is not a proposal to make an external executable mandatory, but the implementation shape may be useful as either an opt-in fallback or a conformance reference.
Prototype shape
- Add a Codex-only bridge before the native JSONL scan result is returned:
if provider == .codex,
let report = try? await CCUsageCodexBridge.loadReport(...) {
return tokenSnapshot(
from: report,
historyCoverageIsEstablished: true)
}
- Invoke ccusage with a bounded offline command:
ccusage daily --json --by-agent --offline --no-color \
--timezone <calendar timezone> \
--since <YYYY-MM-DD> --until <YYYY-MM-DD>
The prototype uses a 30-second timeout and a 16 MiB output limit.
-
Preserve account/profile scoping. The subprocess environment inherits the normal process environment, merges the account-scoped environment, and sets the normalized
CODEX_HOMEfor the selected Codex account. A real home returned usage; an empty temporaryCODEX_HOMEreturned zero, so profiles did not get mixed. -
Parse only
agent == "codex". Map daily input/output/cache-read/cache-creation/total tokens, cost, models used, and model breakdowns intoCostUsageDailyReport. Other agents in the same ccusage output are ignored. -
Soft-fail to the existing native scanner when the helper is unavailable, times out, exits non-zero, or returns invalid JSON. When the bridge succeeds, the native catch-up UI can report complete for that source instead of continuing to offer Finish now.
Validation
- Added focused tests proving that a mixed Codex/Claude payload includes only the Codex row and preserves every token category.
- Added a scope test for
CODEX_HOME, timezone, date bounds, and offline arguments. - Compared the modified CodexBar CLI and ccusage back-to-back on the same active corpus: token delta 0 and estimated-cost delta 0.
- Repeated the comparison after packaging the helper inside the app bundle, without an external helper path: delta remained 0.
- The app continued to launch normally; if the bridge is removed or fails, the original scanner path remains available.
Possible upstream use
The lowest-policy option may be to keep the native scanner authoritative and use ccusage only as a test oracle for large active rollouts, forks, and subagents. A stronger but still contained option would be an explicit opt-in fallback behind a feature flag, with clear source labeling and the native scanner retained.
Even without bundling ccusage, the prototype suggests two immediately useful native behaviors:
- publish safely labeled partial totals while catch-up is incomplete;
- distinguish “all bytes visited” from “all files semantically complete”, and surface the specific stalled files/reasons instead of reducing the state to a generic error.
No account identifiers, session IDs, prompts, responses, or local paths were used in this validation.
I tested a local prototype against the v0.48.1 source. This is not a proposal to make an external executable mandatory, but the implementation shape may be useful as either an opt-in fallback or a conformance reference.
Prototype shape
- Add a Codex-only bridge before the native JSONL scan result is returned:
if provider == .codex,
let report = try? await CCUsageCodexBridge.loadReport(...) {
return tokenSnapshot(
from: report,
historyCoverageIsEstablished: true)
}
- Invoke ccusage with a bounded offline command:
ccusage daily --json --by-agent --offline --no-color \
--timezone <calendar timezone> \
--since <YYYY-MM-DD> --until <YYYY-MM-DD>
The prototype uses a 30-second timeout and a 16 MiB output limit.
-
Preserve account/profile scoping. The subprocess environment inherits the normal process environment, merges the account-scoped environment, and sets the normalized
CODEX_HOMEfor the selected Codex account. A real home returned usage; an empty temporaryCODEX_HOMEreturned zero, so profiles did not get mixed. -
Parse only
agent == "codex". Map daily input/output/cache-read/cache-creation/total tokens, cost, models used, and model breakdowns intoCostUsageDailyReport. Other agents in the same ccusage output are ignored. -
Soft-fail to the existing native scanner when the helper is unavailable, times out, exits non-zero, or returns invalid JSON. When the bridge succeeds, the native catch-up UI can report complete for that source instead of continuing to offer Finish now.
Validation
- Added focused tests proving that a mixed Codex/Claude payload includes only the Codex row and preserves every token category.
- Added a scope test for
CODEX_HOME, timezone, date bounds, and offline arguments. - Compared the modified CodexBar CLI and ccusage back-to-back on the same active corpus: token delta 0 and estimated-cost delta 0.
- Repeated the comparison after packaging the helper inside the app bundle, without an external helper path: delta remained 0.
- The app continued to launch normally; if the bridge is removed or fails, the original scanner path remains available.
Possible upstream use
The lowest-policy option may be to keep the native scanner authoritative and use ccusage only as a test oracle for large active rollouts, forks, and subagents. A stronger but still contained option would be an explicit opt-in fallback behind a feature flag, with clear source labeling and the native scanner retained.
Even without bundling ccusage, the prototype suggests two immediately useful native behaviors:
- publish safely labeled partial totals while catch-up is incomplete;
- distinguish “all bytes visited” from “all files semantically complete”, and surface the specific stalled files/reasons instead of reducing the state to a generic error.
No account identifiers, session IDs, prompts, responses, or local paths were used in this validation.
Additional privacy-safe reproduction on CodexBar 0.49.1 (115), macOS 27 arm64.
This appears to be the same semantic-stall cluster, reproduced on a much larger Codex corpus and on the current release.
Observed state:
- The Spend Dashboard shows
11.36 GB / 11.36 GB. - Spend coverage remains
0 / 30; token activity remains0 / 365. - The local session stores contain approximately 2,407 files.
- The SQLite cost cache tracks 2,269 files and 760,881 token snapshots.
- No tracked file currently has
scan_complete = false. catchUpPending = true.- Persisted progress is
2257 / 2262files. - Persisted bytes are
11,366,264,625 / 11,366,270,929; the UI rounds both sides to 11.36 GB. - Discovery remains incomplete:
isComplete = falsenextFileIndex = 2218 / 2269- 3 pending session IDs
- During the last 24 hours, Unified Log recorded:
- 115 occurrences of
Codex cost catch-up stopped because a bounded pass made no progress - 7 occurrences of
Spend Dashboard Codex cost catch-up stopped because all pending account caches stalled
- 115 occurrences of
The notable difference from the original report is that all tracked files are scan-complete here, while semantic discovery remains pending. This suggests that catch-up progress/stall detection needs to include discovery progress, rather than relying only on per-file parse state.
No account identifiers, session IDs, paths, prompts, or responses are included.
The new discovery-state detail does identify a concrete false-stall path on current main (8d113c6). codexScanCatchUpStatus builds its progressKey only from each tracked file's ID, parsed bytes, size, and completion flag, but catchUpPending also stays true for pending session discovery, buffered fork retries, and active lookback. A bounded pass can therefore advance nextFileIndex or a head-scan offset without changing the key; both catch-up loops then classify the pass as stalled and stop.
I think this should stay separate from #2817's ccusage decision. The native fix shape is to make the progress token cover every persisted cursor that can keep catchUpPending true, while preserving the existing stop for a genuinely unchanged pass. A regression test should keep the tracked-file rows constant, advance only discovery, prove both catch-up schedulers continue, and retain the true no-progress case. I ran the existing focused baseline on this SHA: swift test --filter 'UsageStoreCodexCostCatchUpTests|missing parent head discovery resumes inside the scan budget' (5 tests passed).
Additional affected-corpus datapoint: the semantic-stall state also causes sustained battery drain in the 0.49.0 app catch-up scheduler.
Environment
- CodexBar 0.49.0 (114)
- macOS 26.5.2, Apple Silicon
- Token-cost history enabled, 30-day window
- Global refresh cadence: 30 minutes
- CodexBar Background work low-power mode enabled
- OpenAI Web battery saver enabled
- macOS system Low Power Mode disabled; running on battery
Persisted state
The SQLite scanner had visited all current bytes but remained one file short while an active rollout continued growing:
completedFiles: 871 / 872 (later 872 / 873)
processedBytes: 1,149,607,402 / 1,149,607,402
catchUpPending: true
SQLite store: ~40 MB
Long-running process result
After about 15h05m uptime:
Process CPU time: 52m59s
Average process CPU: ~5.9%
RSS: ~331-537 MB during observation
Context switches: ~10.6 million
A 30-second idle sample showed 0-0.2% CPU, so this was periodic background work rather than a continuously spinning foreground loop. WebKit was not dominant: the CodexBar-owned WebKit networking process had accumulated only ~0.81s CPU.
One forced 30-day scanner refresh measured:
wall time: 14.39s
user CPU: 5.13s
system CPU: 1.16s
voluntary ctx switches: 83,610
peak RSS: 264 MB
The source policy appears quantitatively consistent with the process result. CodexCostCatchUpPolicy targets a 5% duty cycle on battery while pending. Because the active file keeps advancing, the no-progress stop does not fire and catch-up can remain alive indefinitely.
There is also a settings mismatch worth checking: the app preference backgroundWorkLowPowerModeEnabled=1 did not pause this catch-up. codexCostCatchUpDecision passes ProcessInfo.processInfo.isLowPowerModeEnabled into the policy, rather than the CodexBar background-work low-power preference used by other background paths.
Toggle A/B
I disabled only Token Cost Usage and restarted CodexBar:
tokenCostUsageEnabled: false
CPU time at t+54s: 1.44s
CPU time at t+74s: 1.44s
RSS: ~123 MB
The pending SQLite metadata remained untouched, but the periodic CPU work stopped. This isolates the cost catch-up path from provider refreshes, WebKit, and menu animation.
Suggested native fix
This looks like the same canonical active-rollout semantic-stall cluster, with an additional energy impact:
- Treat a currently growing active tail separately from historical coverage completion, so it cannot keep catch-up permanently pending.
- If only active tails remain, use a long or exponential backoff instead of the normal catch-up duty cycle.
- Honor CodexBar Background work low-power mode in the catch-up policy, not only macOS system Low Power Mode.
- Add a regression test where one rollout grows between passes: partial totals remain visible, history coverage settles appropriately, and the scheduler does not run indefinitely.
No session paths, IDs, prompts, responses, or account identifiers are included here.
Update: https://github.com/steipete/CodexBar/pull/2918 landed on main and addresses the root causes identified here — bounded, durable large-corpus indexing (persistent completion across relaunches, APFS device-component drift, stale lookback queues), plus stalled-progress detection that no longer misreads cursor advancement as "no progress". #2861 (Finish-now window cap) is fixed by the same merge.
Keeping this open for two bounded follow-ups noted in the PR: honoring the in-app background-work low-power preference in the catch-up decision, and surfacing per-file stall reasons in the UI. If your large rollout still shows gaps after the next release ships, fresh evidence here would be very welcome.
The low-power follow-up is still present on current main (a0a514f), and it reaches both scheduler adapters: codexCostCatchUpDecision and spendDashboardCodexCostCatchUpDecision pass only macOS ProcessInfo.processInfo.isLowPowerModeEnabled into the shared policy. I think the narrow contract is to treat settings.backgroundWorkLowPowerModeEnabled as an additional automatic low-power signal in both adapters, while leaving .accelerated / Finish now unchanged.
One timing detail is worth deciding in the same fix: changing the preference bumps backgroundWorkSettingsRevision and starts a refresh, but an existing same-scope catch-up only queues a restart; it does not cancel its current duty-cycle sleep. On battery that sleep can be long, so enabling the preference may not pause promptly unless the settings change explicitly wakes or restarts both loops. I ran the existing baseline against this SHA: swift test --filter CodexCostCatchUpPolicyTests\|UsageStoreCodexCostCatchUpTests\|UsageStoreSpendDashboardCodexCostCatchUpTests (23 tests passed). The regression seam should set macOS Low Power Mode false and the app preference true for both automatic schedulers, while retaining the accelerated case.
Follow-up after the native fixes shipped in CodexBar 0.49.5 (119): I can still reproduce a terminal local cost-history stall after rebuilding the derived cache from scratch.
Clean-cache A/B
- Quit CodexBar cleanly.
- Moved only the derived
cost-usage.sqlite,-wal, and-shmfiles to a local backup. No Codex session files, auth state, settings, or other provider caches were changed. - Relaunched 0.49.5 and verified that it created a new SQLite inode (initial size approximately 155 KiB,
PRAGMA quick_check = ok). - Selected Finish now and observed the fresh rebuild through completion/stall.
The fresh store indexed rapidly for about 12 minutes, then stopped at:
completedFiles: 2363 / 2365
tracked files: 2365
tracked files incomplete: 0
catchUpPending: true
discovery nextFileIndex: 2204 / 2365
discovery isComplete: false
pendingSessionIDs: 1
lookback pendingFilePaths: 2
buffered unresolvedFork: 2,514 lines across 2 files
Both buffered child lineages reference parent IDs absent from the SQLite files.session_id inventory. One matches the sole discovery-pending parent. A privacy-safe scan of the two configured Codex session roots found that identifier referenced in 10 JSONL files, but no file has a session_meta declaring it as its own session ID.
The fresh database remains structurally healthy:
PRAGMA quick_check: ok
SQLite errors: none observed
At the terminal state, Unified Log recorded twice:
Spend Dashboard Codex cost catch-up stopped because all pending account caches stalled
The UI briefly changed to the error/non-active state, then restarted the worker and returned to Refreshing 2,363 / 2,365. Re-running Finish now reached the same semantic state.
For comparison, the pre-reset store had stopped at 2,383 / 2,385 with 3 pending session IDs and 3,903 unresolved-fork lines across 3 files. The exact inventory changed after the clean rebuild, but the terminal shape remained the same: every tracked file is scan-complete while missing-parent fork resolution/discovery keeps the whole dashboard pending.
This appears to rule out stale migrated cache state and leaves a residual orphan-fork completion edge after #2918. It also seems directly relevant to the still-open per-file stall-reason follow-up: the dashboard currently withholds all otherwise validated history, while the visible 2-file remainder does not explain that the blocker is missing-parent fork provenance.
No account identifiers, session IDs, paths, prompts, responses, token totals, or model-usage values are included.
Follow-up on CodexBar 0.53.0 (125): I now have a recovery A/B that isolates an additional stale-discovery-state boundary.
Important distinction from my previous clean-cache result
In the earlier 0.49.5 clean-cache test, the orphan-fork child rollouts were still present in the configured scan roots, so a fresh database correctly reproduced the unresolved-parent terminal state.
For this test, I first identified three rollout files with these properties:
- each file was fully readable and
scan_complete = 1; - each was a fork/child rollout whose referenced parent session was absent;
- together they accounted for the unresolved-fork remainder.
I archived the corresponding threads and then moved the three JSONL files outside both configured Codex roots (CodexBar also scans archived_sessions). The files were compressed and hash-verified first. No auth, settings, or unrelated sessions were changed.
Restart-only result after the source files were removed
A normal CodexBar restart did not reconcile the existing cost cache:
files table: 2,766 / 2,766 complete
incomplete files: 0
catchUpPending: true
scan metadata: 2,768 / 2,769
discovery isComplete: false
pendingSessionIDs: 2
missingSessionIDs: 0
The important detail is that the persisted discovery_state.filePathBySessionID still mapped both pending (absent-parent) session IDs to paths of child rollout files that no longer existed in either scan root. The two stale pendingSessionIDs and those path associations survived relaunch, so the dashboard continued to stop one item short.
Cache-only rebuild after the source files were removed
I then:
- Quit CodexBar cleanly.
- Moved only
cost-usage.sqlite,-wal, and-shmto a backup. - Relaunched 0.53.0; it created a fresh store (~155 KiB initially).
- Let the scan run and used Finish now for the final pass.
The fresh rebuild completed successfully:
PRAGMA integrity_check: ok
completedFiles: 2,768 / 2,768
tracked incomplete: 0
source bytes: 12,718,905,701
parsed bytes: 12,718,905,701
catchUpPending: false
pendingSessionIDs: 0
missingSessionIDs: 0
stale pending IDs: 0
After reloading the Usage & Spend pane, Codex totals and model rows became available again.
Interpretation
This appears to be two linked edges rather than JSONL corruption:
- the already-described orphan-fork completion behavior while the child files remain present; and
- a separate invalidation/reconciliation gap when those child files are archived or removed: persisted
pendingSessionIDs/filePathBySessionIDentries can continue pointing at paths that no longer exist, and restart alone reuses that stale state.
The manual database reset is only a recovery workaround, and the restored totals intentionally exclude the three archived child rollouts.
A focused regression could seed discovery state with a child -> absent-parent dependency, remove the child file between runs, reopen the existing cache, and verify that discovery drops the stale parent/path association and settles catchUpPending = false without requiring users to delete the derived SQLite store.
No account identifiers, session IDs, prompts, responses, or private paths are included here.
The removed-source / existing-cache boundary from @xiehaibin18's A/B report is now fixed on main in #3292, commit 56bbc037f616.
Parent discovery previously advanced only when a requesting fork asked again. Once those child files left the scan roots, stale pending IDs and their deleted-path associations could survive indefinitely. Normal bounded refreshes now drain that persisted work within the existing byte/time limits. Compatible caches are adopted intact; deleting or rebuilding the SQLite store is not required for this repair.
The regression uses synthetic JSONL and the same SQLite store across refreshes, including both retained and already-removed child rows. It also proves that a surviving fork with a genuinely missing parent remains unresolved, then resolves its buffered usage exactly once when the parent appears. This does not guess orphan totals or add an external fallback.
Focused coverage passed (158 tests / five suites), the full local suite passed all 971 selections / 81 groups with no failures or retries, format/lint passed, and all nine exact-head CI checks passed. Changelog and documentation are updated.
Keeping this issue open for the separate low-power/stall-diagnostics and unresolved-parent policy follow-ups. This fix is on main under 0.56.2 Unreleased; it is not a new release announcement.
Rechecked against main at 173afc88a417. The active-rollout moving-target bug is fixed by #3314: bounded passes retain a finite validated prefix and later refreshes consume appended data. A synthetic 419,540,081-byte rollout completed with production byte/time budgets while another MiB and token event were appended between passes; the later tail was counted exactly once.
The passing debug run took 19 parsing passes plus one inventory-validation pass—equivalent to 4 hours 45 minutes at the simulated 15-minute cadence. This proves finite progress, not fast release-build completion. A final zero-byte inventory-validation pass is expected.
#3669 permits validated current-window publication during historical catch-up. Unparsed work and unresolved fork provenance still block complete coverage. The app Low Power follow-up is addressed by #3468, and removed-source discovery recovery by #3292.
Keeping this tracker open for the previously requested per-file stall explanation and unresolved-parent accounting policy. The UI still maps a no-progress pause to a generic “Error.” No additional starvation defect was established. Thanks @Yoroin and the follow-up reporters for separating the growing-tail, discovery, and missing-parent cases.
The native scanner now freezes each generation’s target (#3314) and can publish validated windows during historical catch-up (#3669). PR #3949 adds a 269 MB growing-rollout regression: nine bounded passes complete the original prefix, one later pass consumes eight appended turns, and the result is exactly 451,440 tokens. Existing growing-rollout, fork, and completion tests also pass. This supports closing the native starvation bug as fixed; an optional ccusage backend would be a separate feature decision.