feat: cut Codex cost persistence over to SQLite, delete the JSON artifact (refs #2760) - #2762
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3167cd9d59
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| @@ -1,1159 +0,0 @@ | |||
| import Foundation | |||
There was a problem hiding this comment.
Remove stale provider-gatekeeper allowlist entries
Deleting this file leaves ProviderArchitectureGatekeeperTests with several SuppressedProviderReference/AllowedProviderConstruct entries that still point at Sources/CodexBarCore/Vendored/CostUsage/CostUsageCache.swift (for example around lines 1523 and 3609 in that test). The cross provider case clusters are derived or specifically justified test removes entries only when their file is scanned, then fails any leftover paths as “file does not exist in a shipped Swift target”, so make test will now fail until those stale allowlist rows are removed or retargeted.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. Reviewed August 8, 2026, 5:07 AM ET / 09:07 UTC. ClawSweeper reviewWhat this changesThis PR replaces Codex cost-history JSON persistence with a SQLite store and redirects scanning, reports, CLI, and local-project consumers to that store. Merge readiness⛔ Blocked by patch quality or review findings - 9 items remain Keep open: the SQLite cutover still allows a partially published scan generation and treats ordinary SQLite contention as destructive corruption recovery. Two user-facing docs also retain the deleted JSON-cache path. Priority: P1 Review scores
Verification
How this fits togetherCodexBar scans local Codex session JSONL files into bounded cost history consumed by reports, the menu app, the CLI, and workspace summaries. This PR makes SQLite the persistence boundary for that history while retaining the existing in-memory report models. flowchart LR
A[Codex session JSONL] --> B[Bounded cost scanner]
B --> C[SQLite cost history store]
C --> D[Cost reports and snapshots]
D --> E[Menu app and CLI]
C --> F[Workspace usage sidecar]
Before merge
Findings
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:
Copy recommended automerge instructionTechnical reviewBest possible solution: Publish every scan result as one SQLite transaction or reader-visible generation, preserve the prior cache on retryable lock contention, and update both Codex cache-path documents to SQLite. Do we have a high-confidence way to reproduce the issue? Yes — source establishes a deterministic reader-between-transactions path and a busy/locked error path that invokes rebuildDatabase; focused store regressions can exercise both. Is this the best way to solve the issue? No — a single SQLite authority matches the approved direction, but separate commits inside one save and destructive busy handling are not a safe publication design. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 56a763eaa34c. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Summary
Cut the Codex cost pipeline over to the Phase 1
CostUsageStoreand delete the Codex JSON artifact authority entirely.cost-usage.sqlite.CostUsageDailyReportand snapshot models are unchanged.codex-v11.jsonartifact and atomic-write sidecars are deleted at the single startup cleanup boundary; the SQLite cache is rebuilt from bounded source scans instead of migrated.Schema and behavior
PRAGMA user_versioncontinues to combine the base version with the generated parser hash, so incompatible/corrupt stores rebuild cleanly.CostUsageStoreuses a portable dedicated serial executor as the only in-process writer. WAL plusbusy_timeoutkeeps independent app/CLI read-only snapshots safe during writes.(rollout_path, event_index), including time-zone re-bucketing.Thanks @xx205 for the terminal-accumulator and append-linearity design carried forward from #2726.
Proof
swift test --filter CostUsage: 389 tests in 25 suites passed.swift test --filter CostUsageStoreCutoverTests: cleanup, fixture parity, and append-linearity tests passed.make check: parser hash current; SwiftFormat clean; strict SwiftLint clean with 0 violations.libsqlite3-dev: build completed successfully.patch is correct, confidence 0.98); documentation follow-up review also clean (0.99)../Scripts/test.sh: stopped at group 10/69 after the unrelatedBoundedChildProcessProofTestsPTY cleanup timing assertion exceeded its 10-second budget twice (14.0 seconds); no cutover test failed.git diff --check: clean.No UI strings or layouts changed, so screenshots are not applicable.
Refs #2760.