Codex cost cache scan state is shared across CODEX_HOME profile homes, so scanning one home resets another's coverage
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing the cost cache implementation that writes scan_metadata and discovery_state in cost-usage.sqlite; the issue does not name source files or tests. Check how scan inventory and lookback state are keyed, then reproduce the two-home sequence from the report. Done means each CODEX_HOME retains its own established coverage and cached rows when another home is scanned.
Written by the indexing model from the issue text.
Description
Summary
With more than one Codex home (codexProfileHomePaths, or CODEX_HOME=… codexbar cost --provider codex), the Codex cost cache keeps a single scan state for all homes. Scanning home B after home A has established coverage sends A back to historyCoverageIsEstablished: false with partial totals. Each later --refresh re-adds A's sessions in batches until coverage is established again.
Details
- Cache:
~/Library/Caches/CodexBar/cost-usage/cost-usage.sqlite.scan_metadataanddiscovery_stateeach hold one row (id = 1), so the scan inventory and lookback state of the last scanned home replace those of the previous one. - The menu-bar app scanning profile homes in the background has the same effect on CLI scans, so totals for a home can change between two CLI runs with no CLI scan of another home in between.
- Setting
HOMEto another directory does not move the cache, so callers cannot isolate it per home.
Repro (CLI 0.81.0, macOS)
CODEX_HOME=<home A> codexbar cost --provider codex --provider-native-only --days 35 --refresh --format json, repeated untilhistoryCoverageIsEstablishedistrue(about 5 runs for a home with ~600 rollouts).CODEX_HOME=<home B> codexbar cost --provider codex --provider-native-only --days 35 --format jsononce.- Run step 1's command for home A again without
--refresh:historyCoverageIsEstablishedisfalseand the 35-day token total drops sharply (in our case to about 6% of the established value). Home B shows the same after a scan of home A.
Expected
The scan state and cached rows are keyed per CODEX_HOME, so each home keeps its established coverage regardless of which home was scanned last.
Related
- #3125 / #3132: profile-scoped token/cost snapshots were isolated for display; the underlying scan state still looks shared.
- #3411: scan-since / lookback reseeding on a single account, different root cause.
Workaround we use
Refresh each home until historyCoverageIsEstablished is true immediately before reading it, inside a time budget.
- Dominant language
- Swift
- Stars
- 22.8k
- Forks
- 2.2k
- Avg merge
- 21h 55m
- Merged PRs (30d)
- 403
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from steipete/CodexBar
-
Improve readability of red pace text in stacked menu bar layoutPossibly taken @steipete claimed this today. Openclawsweeper:fix-shape-clear clawsweeper:needs-live-repro clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:ux-friction issue-rating: 🐚 platinum hermit P2
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
steipete/CodexBar#4714 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 4/5 1-2 days Newbie friendliness 58/100
steipete/CodexBar#4809 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Picking a quota window duplicates it across a mixed two-quota menu bar layoutPossibly taken @egigoka claimed this today. Openclawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
steipete/CodexBar#4807 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
opencodego: background refresh reports 100% free quota, manual refresh shows real quotaPossibly taken @egigoka claimed this today. Openclawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 4/5 3-5 days Newbie friendliness 25/100
steipete/CodexBar#4805 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
0.82.0 (175) Cursor does not report usage.Possibly taken A pull request linked to this issue is open or already merged. Openimpact:auth-provider impact:ux-release-blocker issue-rating: 🦪 silver shellfish P0
Difficulty 4/5 3-5 days Newbie friendliness 35/100
steipete/CodexBar#4804 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
All issues in steipete/CodexBar
Similar issues
-
copy design-review mac P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
tosunlab/hisarapp-core#510 ·
-
bug needs-triage S2: major
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
manaflow-ai/cmux#26321 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SwiftyLab/MetaCodable#169 ·