Repository navigation
fix: preserve Codex usage after session archiving - #181
Conversation
|
Thanks @ite476 — the root cause holds up. I pulled the Codex sources rather than take the description's word for it: Requesting one change before merge; the other two are notes. 1. The tests don't share the single root source — blockingI reverted the user-visible half of the fix and the full suite stayed green: static var codexScanRoots: [URL] {
[codexSessionsDir] // archived root dropped
}Both new tests inject There is a seam for this already: 2.
|
|
Thanks for the thorough review. I addressed the blocking test gap and incorporated the two follow-up notes.
Validation:
The changes are pushed in commit b9f369c. |
|
Thank you for your contribution! |
…n#177) resolvedRoots hardcoded the CLI path, which is defaultRoots[1] after chattymin#182, so a no-root scan dropped 2.0/Core and IDE stores. Codex custom roots had the same class of hole against archived_sessions (chattymin#181).
Brings in the representative-Pokémon pin (chattymin#158), Antigravity 2.0 multi-root discovery (chattymin#182), Codex rollout memory bounding (chattymin#184), and fixes for Codex usage after session archiving (chattymin#181), the Kiro rescan (chattymin#178), the AppLog willTerminate flush (chattymin#174), the update-loop PID wait (chattymin#175), the popover outside-click monitor (chattymin#168), and menu bar/popover sprite aspect ratio (chattymin#194). All 11 are scope- and identity-agnostic, so nothing is rejected. Conflict resolutions: - PokeTokenBarApp / FloatingPetPanel: the menu bar and pet now read the representative subject AND the animation-quality frame floor. The floor stays in the frame-cache identity key and in the observation set, so pinning a species and changing FPS both take effect immediately. - UpdateChecker: took upstream's PID-based exit wait and testable launcher signature, kept the fork's cask token and login-agent label via AppIdentity. The fork guard that asserted `pgrep -x <executable>` now asserts the PID wait, since upstream deliberately replaced that mechanism. - UsageStore: kept the fork's async notification-authorization request, which avoids the Swift 6 executor trap the closure form hits. - CLAUDE.md: kept the fork-maintenance row alongside upstream's expanded defect-log row. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: add per-provider additional scan folders (#177) Logs outside the built-in paths were a silent undercount for every provider except Claude. Store one list per provider so parsers never share folders, and only add custom roots — never evict a curated default. * fix: union custom scan roots onto every Antigravity default (#177) resolvedRoots hardcoded the CLI path, which is defaultRoots[1] after #182, so a no-root scan dropped 2.0/Core and IDE stores. Codex custom roots had the same class of hole against archived_sessions (#181).
* fix: preserve Codex usage after session archiving * fix: cover archived Codex roots in tests
…ymin#187) * feat: add per-provider additional scan folders (chattymin#177) Logs outside the built-in paths were a silent undercount for every provider except Claude. Store one list per provider so parsers never share folders, and only add custom roots — never evict a curated default. * fix: union custom scan roots onto every Antigravity default (chattymin#177) resolvedRoots hardcoded the CLI path, which is defaultRoots[1] after chattymin#182, so a no-root scan dropped 2.0/Core and IDE stores. Codex custom roots had the same class of hole against archived_sessions (chattymin#181).
Summary
sessionstoarchived_sessions.docs/reference/provider-extension.md.Root cause
Codex defines both
sessionsandarchived_sessionsas local rollout locations. Its archive implementation moves rollout files withstd::fs::rename()and then updates the archived thread metadata:PokeTokenBar previously scanned only
~/.codex/sessions, so an archived rollout appeared to disappear from the daily total. The two directories are alternative locations for the same local rollout history, not independent usage streams.Codex records session identity and cumulative token usage in the rollout format. The existing resolver already uses stable session/state-based canonical IDs, so this change reuses that deduplication boundary instead of summing both directory trees blindly. Codex documents
total_token_usageas accumulated session usage andlast_token_usageas the latest active context usage in its TUI model:Scope
This fixes usage loss caused by normal
sessions→archived_sessionsrelocation and prevents duplicate counting during a temporary cross-root overlap.This PR does not attempt to solve torn reads during an active write, corrupted or missing rollout files, custom Codex homes, account switching, or server-side quota attribution.
Validation
swift test --filter LocalUsageReaderTests— 56 tests passed../scripts/test-gate.sh— 680 tests passed, 7 skipped, 0 failures.Type of change
Checklist
swift buildandswift testpass locally.