Repository navigation
feat(opencodego): expose local history in cost command - #4629
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesExpose existing OpenCode Go local token and cost history through the cost command’s JSON and text output. Example: Export synthetic OpenCode Go history containing $1.25 of recorded cost without token totals.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR provides a useful CLI export that current main lacks; one minor help and documentation correction remains. Priority: P3 Before merge
Findings
Agent review detailsHow this fits togetherProvider capabilities admit CLI cost requests, which pass the selected home, calendar, and history period to the existing SQLite reader and shared snapshot projection before JSON or text rendering. flowchart LR
A[Cost command] --> B[Provider capabilities]
B --> C[Cost usage fetcher]
C --> D[Local SQLite reader]
D --> E[Shared cost snapshot]
E --> F[JSON or text output]
Technical reviewBest possible solution: Keep the shared reader and renderer integration, and update CLI help and the CLI guide to describe OpenCode Go support accurately. Do we have a high-confidence way to reproduce the issue? Current-main capability gates establish the unsupported-provider path, and the PR reports a synthetic baseline CLI rejection; this review ran no builds or tests. Is this the best way to solve the issue? Reusing the provider’s existing reader, shared snapshot projection, and renderer is the smallest complete implementation and preserves existing accounting semantics. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7e31e74ea662. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 12:15 AM ET / 04:15 UTC. |
# Conflicts: # CHANGELOG.md
Summary
Enable
codexbar cost --provider opencodegousing the existing device-local SQLite reader and snapshot projection. JSON exposes the same daily/per-model recorded costs and available tokens; text--breakdownreuses the shared daily/model renderer. Unknown token totals remain unknown.The cost command honors its passed home directory, selected cost time zone, and All history period. The existing reader checks its local auth file only to classify missing history; it makes no remote quota or cookie request. Existing app usage-source ownership and estimate provenance/disclaimer are preserved.
Verification
The main baseline failed
cost fetcher exposes existing local daily history; the main CLI returned unsupported-provider JSON (exit 1). The fixed synthetic CLI returns JSON and text (both exit 0, empty stderr), with $1.25 recorded cost and unknown token totals preserved.Local proof used a combined lane candidate; this PR is the independently split change, and exact-head PR CI is the broad gate. All data was synthetic. No running app, real account, Keychain, or browser-cookie probe was used.
swift test --build-system native --jobs 2 -Xswiftc -gnone --filter 'CostUsageClaude(ArtifactWriter|CacheIsolation|Fragment|KimiAlias|MetadataParsing|Overflow|PriceRange|PricingRace|Rebuild|ReconciliationMemory|ReportContext|ReportWire|Resolver|RowCapacity|RowStorage|VertexClassifier|VertexPrecheck|WriteAmplification)Tests|CostUsageScanner(Claude.*)?Tests|PiSession.*Tests|PiBedrockPricingTests|PiNativeProjectionTests|PiInclusiveRefreshTests|PiSharedRootMergeTests|PiProviderTests|PiProjectOverflowTests|UsageStorePiHistoryScopeTests|OpenCodeGo.*Tests|CLICost.*Tests|CLICommonOptionsTests|CLIProviderSelectionTests|CostReportingPeriodTests|ProviderArchitectureGatekeeperTests|ProviderSettingsDescriptorTests|BrowserCookiePromptContractTests|SettingsStoreTokenCostSourceTests|SettingsStoreCoverageTests|SettingsStoreAdditionalTests|SpendDashboardModelTests', under the sharedserial.shlock withScripts/test_environment.sh.--filter 'CLICost.*Tests|ProviderArchitectureGatekeeperTests|CLIProviderSelectionTests|CLICommonOptionsTests|OpenCodeGoLocalUsageReaderTests': ✔ Test run with 144 tests in 9 suites passed after 21.085 seconds..swift test --build-system native --jobs 2 -Xswiftc -gnone --filter 'CostUsageScannerClaudeDesktopTests|CostUsageClaudeReportContextTests|CostUsageScannerClaudeMemoTests|CostUsageScannerClaudeRegressionTests|CostUsageClaudeCacheIsolationTests|PiSession.*Tests|PiBedrockPricingTests|PiNativeProjectionTests|PiInclusiveRefreshTests|PiSharedRootMergeTests|PiProviderTests|PiProjectOverflowTests|UsageStorePiHistoryScopeTests|ProviderArchitectureGatekeeperTests|CLICost.*Tests|CLIProviderSelectionTests|CLICommonOptionsTests|OpenCodeGo.*Tests|ProviderSettingsDescriptorTests|BrowserCookiePromptContractTests|CostUsageClaudeFragmentTests': ✔ Test run with 573 tests in 53 suites passed after 43.853 seconds..make check: passed.python3 /Users/steipete/Projects/CodexBar-triage-evidence/20260921/precheck-catalogs.py .: no findings before push.5 files changed, 48 insertions(+), 24 deletions(-)(net +24); Tests:3 files changed, 106 insertions(+), 6 deletions(-).Fixes #4606