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 19, 2026, 12:55 AM ET / 04:55 UTC. ClawSweeper reviewWhat this changesAdds an OpenCode Go API-key usage source, overlays its quota windows onto local cost history, preserves cookie-derived balance data, and documents the revised source order. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep open: current main lacks the OpenCode Go API-key usage source, and the patch appears coherent with existing provider patterns. It still needs redacted authenticated after-fix runtime evidence before merge. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s provider pipeline combines local usage history, provider APIs, and browser-cookie web sources into one usage snapshot for the menu app and CLI. This PR adds OpenCode Go’s authenticated API as an authoritative quota source while retaining existing local and web paths. flowchart LR
A[Provider settings and credentials] --> B[Source selection]
B --> D[OpenCode usage API]
B --> E[Cookie web usage]
C[Local SQLite history] --> F[Usage overlay]
D --> F
E --> F
F --> G[CodexBar app and CLI]
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: Retain the provider-scoped implementation, then add redacted authenticated terminal output or runtime logs from the rebased head showing successful API windows and safe fallback behavior before merge. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug report: this PR adds a new API-backed source. The missing real-world validation is an authenticated after-fix proof requirement, not a current-main bug reproduction. Is this the best way to solve the issue? Yes, subject to live proof: the provider descriptor reuses the existing credential projection and local/web overlay seams instead of creating a parallel provider path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a32989c750e6. 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 (8 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 |
2f42b83 to
d467b54
Compare
|
Rebased onto current The integration preserves #2987’s estimated-confidence and manual-token behavior while adding the authenticated API overlay and retaining Zen balance. The original worktree’s unrelated local edits were not touched. SwiftFormat and Tracking issue: #3065. — 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