Add Codex Workspaces indexing foundation - #2456
Conversation
Redacted real-workspace proofInspect the sanitized runtime log. These sanitized artifacts are pinned to evidence commit The screenshot was rendered and captured with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c571d71ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Ready-run CI closureExact head Run: https://github.com/steipete/CodexBar/actions/runs/30180152648 For the paired draft contract proof, #2453 at The task-specific raw session/catalog copy and temporary instrumented runtime worktree have now been permanently removed after verification. Only the inspected sanitized screenshot and transcript linked above remain published. |
|
Codex review: needs maintainer review before merge. Reviewed July 26, 2026, 3:39 AM ET / 07:39 UTC. ClawSweeper reviewWhat this changesAdds a local Codex Workspaces indexing foundation that scans existing Codex data, attributes usage to projects, sessions, models, and days, and stores derived results in a v11 cache plus a SQLite sidecar. Merge readinessThis PR has addressed the prior catalog/sidecar correctness findings and provides strong real-workspace proof, but it still needs a maintainer decision before merge because it introduces a new persistent local-data contract for existing installations. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s local usage system reads Codex rollout logs and caches token/cost data for usage reporting. The new Workspaces layer combines those scanned records with a read-only Codex thread catalog, then publishes project/session/model aggregates for a later UI PR. flowchart LR
A[Local Codex rollout logs] --> B[Usage scanner]
C[Codex thread catalog] --> D[Catalog reader]
B --> E[Workspace index]
D --> E
E --> F[Versioned cache and SQLite sidecar]
F --> G[Project session model aggregates]
G --> H[Future CodexBar views]
Decision needed
Why: The patch can be technically correct while still committing the product to durable local artifacts, compatibility behavior, and an internal presentation boundary that need maintainer ownership. Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept or narrow the durable cache/sidecar contract after a maintainer confirms that CodexBar should own the documented v10-to-v11 rebuild, schema migration, and last-good retention behavior; then land this foundation before reviewing the UI follow-up. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR introduces a new local indexing capability rather than fixing a current-main bug. Its supplied real-workspace run provides strong behavior evidence for the proposed feature. Is this the best way to solve the issue? Unclear: the implementation is internally staged and well-tested, but a maintainer must decide whether the new durable cache and sidecar contract is the right long-term product boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cc8da27cec92. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Addressed the three catalog/sidecar correctness findings in 7bf6a49.
Regression coverage added:
Validated on the identical source tree:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer verification complete on exact head The final hostile review found no blocking defect. This lands the owner-approved non-UI Workspaces indexing foundation while keeping Local focused proof passed 229 tests across 13 Workspaces, Models, cache, and scanner suites. Structured autoreview was clean after each current-main merge. Hosted CI is green on the final head: https://github.com/steipete/CodexBar/actions/runs/30418945708. One unrelated Kimi timing assertion exceeded its 250 ms budget by 10.96 ms on the first attempt; the authorized failed-job rerun passed, as did both macOS shards, all Linux builds, lint, the aggregate gate, and GitGuardian. Thank you, @AmrMohamad, for the careful foundation work and thorough test coverage. |

Summary
This is the non-UI foundation extracted from #2453 so the compatibility-sensitive scanner, cache, catalog, sidecar, and analytics behavior can be reviewed and proven independently.
The remaining menu, inspector, Settings,
UsageStore, AppKit/SwiftUI, accessibility, and localization work stays in draft PR #2453 and will be rebased/merged onto this foundation after it lands.Scope
CostUsageScannerauthoritative for parsing, cumulative-token deltas, fork/subagent accounting, pricing, and incremental cursors.No remote API, provider authentication, billing interface, public CLI JSON contract, product enablement, or UI is introduced here.
Maintainer-approved cleanup
The accepted landing scope drops migrations for unreleased sidecar schemas 2–4 and removes the unreleased legacy JSON snapshot reader. Public Workspaces snapshot loads now require an explicit personal-information-hiding choice; hidden snapshots remove persisted workspace paths, working directories, workspace names, and session titles before presentation.
Compatibility contract
codex-v10.jsonis not treated as a v11 cursor or migrated in place.CostUsageFetcher.loadCachedCodexLocalProjectUsageSnapshotCostUsageFetcher.loadCodexLocalProjectUsageSnapshotCostUsageFetcher.clearCachedCodexLocalProjectUsageSnapshotCodexLocalProjectUsageSnapshotCodexLocalProjectUsageIndexProgressCommit structure
Stabilize spend dashboard fixturesPersist Codex session metadataAdd Codex Workspaces indexAdd workspace models analyticsTest and document workspace indexingEach intermediate source layer was built before the next layer was added.
Regression history
The 13 reported Spend Dashboard issues were not introduced by Workspaces:
cc8da27ca29ca8765c571d71The repair gives the synthetic token snapshots an explicit USD currency and injects fixed request/model clocks into July fixtures. Production grouping, completeness, pricing, and cache behavior are unchanged.
Contributor verification before maintainer cleanup
All commands below ran from a detached worktree at
5c571d71ed6c557a217b7c457cb15f605f13d9b4.make testmake checkgit diff --checkThe automated gates used deterministic fixtures/stores and did not perform Keychain reads, cookie imports, browser imports, real provider/account probes, or provider network requests.
Redacted real-workspace proof
The proof used three real local Codex session files copied into an isolated
CODEX_HOME, a task-specificCFFIXED_USER_HOME, a task-specific cache root, and an outer macOS sandbox policy denying all network access.A full-resolution sanitized screenshot of the same evidence is attached in this PR discussion.
Privacy review
The published transcript and screenshot were manually inspected at full resolution and scanned for home paths, identities, emails, UUID/session IDs, API-key/token patterns, auth headers, and IP addresses.
They do not contain raw paths, chat titles, session IDs, database rows, token or cost values, account identities, API keys, auth headers, hostnames, or IP addresses. Raw captures remain outside the repository and will be deleted after verification.
Follow-up
After this foundation merges, #2453 will be updated onto
mainand its current diff will be limited to the Workspaces preference/inheritance rule,UsageStoreintegration, native menu/progress rows, inspector presentation, display-only projections, accessibility/localization, CSV action, and UI tests/evidence.The proposed product decision remains: a missing dedicated Workspaces preference inherits existing local cost usage, while an explicit Workspaces setting overrides it. That default is not introduced by this foundation PR and still requires maintainer approval in #2453.