Add OpenCode Go usage API support - #2879
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 13, 2026, 12:21 AM ET / 04:21 UTC. ClawSweeper reviewWhat this changesThe PR adds an OpenCode Go API-key usage source, integrates it with existing local and cookie-backed fallbacks, and documents the revised source order. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep open. The branch is a coherent extension of the existing provider-routing design with no discrete source-level defect found, but it still lacks the requested after-fix authenticated runtime proof. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s provider layer selects local, API, or web usage sources and converts them into a common snapshot for the menu-bar app and CLI. This change adds an API-key source to OpenCode Go while retaining local cost history and cookie-derived fallback data. flowchart LR
A[Local OpenCode history] --> D[OpenCode Go source selection]
B[Configured API key] --> C[Usage API]
C --> D
E[Browser or manual cookie] --> F[Legacy web usage]
F --> D
D --> G[Unified usage snapshot]
G --> H[CodexBar app and CLI]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the branch’s narrow fallback design and merge it only after a redacted authenticated run confirms the API windows and a fallback path on a real OpenCode Go account. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a new provider source. The branch has high-confidence mocked request-contract coverage, but no real authenticated after-fix execution. Is this the best way to solve the issue? Unclear until runtime proof is supplied. The descriptor-based source integration matches existing architecture, but the upstream API contract and real credential routing need a redacted authenticated trace. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 208016687098. 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 (7 earlier review cycles)
|
|
Fixed the failing macOS shard in signed commit The implementation intentionally adds OpenCode Go to the descriptor-derived API-key debug registry; the architecture gate's exact expected list had not been updated. The corrected gate now passes locally. Verification:
@clawsweeper re-review — Akshay / Codex |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
b839f54 to
2f42b83
Compare
|
Rebased this draft PR onto current upstream The prior aggregate failure was draft policy rather than a provider regression: required macOS tests were deferred while the PR was draft, so the aggregate correctly reported incomplete. GitHub now reports the rebased branch mergeable. — Akshay / Codex |
|
Post-rebase verification is complete on head
GitHub reports the PR mergeable. ClawSweeper found no actionable implementation or security findings; its remaining gate is an authenticated OpenCode Go runtime trace, which requires contributor-provided account credentials and must be redacted before posting. — Akshay / Codex |
Summary
GET /zen/go/v1/usageAPI for rolling, weekly, and monthly utilizationOPENCODE_API_KEYfrom CodexBar settings, provider config, or the environmentWhy
OpenCode Go now exposes an authenticated public usage endpoint. CodexBar previously depended on local estimates or private web-session requests, even when a stable API key was available.
Behavior and compatibility
Proof
swift test --filter OpenCodeGo: 108 tests passed across 11 OpenCode Go suites on the initial implementation.make check: passed after the review fix (formatting, SwiftLint, manifests, signing/package gates, and documentation links).No personal usage data or credentials are included in this change. A live authenticated endpoint capture is not attached because no
OPENCODE_API_KEYis available in this environment; all included network proof is deterministic request-contract coverage.Closes anomalyco/opencode#31084