GeezerVison is showing github.com — fix(server): restore OpenCode Go limits for Console API keys by Benglennon123 · Pull Request #21007 · pingdotgg/t3code
Conversation
Benglennon123
commented
Oct 17, 2026
•
edited by juliusmarminge
Loading
Uh oh!
There was an error while loading. Please reload this page.
OpenCode 2 can run Go through a connected Console API key while its separate Go key has expired. T3's limits probe ignored that Console connection and reported “OpenCode Go could not read usage.”
Read the selected public Console API key from OpenCode's database read-only, ahead of the separate Go key. Match OpenCode's credential selection order and explicit OPENCODE_DB path; skip in-memory databases. Select one connection before interpreting its credential so OAuth, inactive, or self-hosted connections cannot expose an older Console account. Retry with a distinct Go key only on 401/403, and fingerprint the key that produced the successful response. Inline auth overrides and disabled/external-instance guards remain in place. The usage guide now describes API-key Console connections.
Taken over from @Benglennon123's #21007, preserving the original commit and merging main. Compared credential ordering, database paths, and public-server metadata against the official OpenCode 2.0.28 and 2.0.32 producers. The rebuild corrects creation-order selection and explicit public Console metadata; review also caught the wrong-account risk from ignoring OPENCODE_DB.
Verification on Linux:
pnpm exec vp test run packages/provider-opencode/src/server/status.test.ts packages/provider-opencode/src/server/usage.test.ts: 35 passed in two existing files. The single added SQLite regression was rewritten without adding test cases: original PR 28 status tests, merged baseline 29, final 29. It covers Console precedence, 401/403 fallback, non-auth failures, credential exclusions, legacy ordering, inline auth, custom databases, unchanged database bytes, and successful-key identity. It fails against main; the custom-database case also fails against the first rebuild.
- Scoped provider typecheck, targeted lint, formatting, and diff checks pass.
- Two independent whole-PR review rounds with Claude Opus 5.5 and Codex GPT-6 Sol; the second round is clean after the database-path correction.
- Ran the production reader with real temporary SQLite files and the real Fetch HTTP client against an isolated loopback server. The transport asserted the unchanged public destination before redirecting to the fixture server. All credentials and usage responses were synthetic; no real account credentials were read or sent. Before/after on matching data:
main: Console connected + expired separate Go key
requests=[legacy], unavailable=probeFailed, windows=[]
head: requests=[Console], unavailable=none, windows=[session:17, weekly:33, monthly:16]
401/403: requests=[Console, legacy], successful-key fingerprint matches legacy
500: requests=[Console], unavailable=probeFailed, no retry
custom DB: selects Console there even when default DB contains another account
inline override: requests=[inline]
disabled/external instance: no credential requests
The headless pass also checked inactive/OAuth/self-hosted exclusions and :memory: handling; database files were unchanged. Screenshots do not apply to this server-only change.
Not verified: acceptance by the live Console/Go service, a running client with a real account, custom-channel OpenCode builds without an explicit database override, macOS, Windows, iOS, Android, or Electron desktop. A human should verify a real Console API-key account with an expired Go key before landing. The earlier approval discussion deferred Console OAuth; this PR adds no OAuth support, endpoint, or setting. Approval for this API-key credential path remains a human decision. No merge performed.
Tests: GPT-6 Astra; implementation: GPT-6.1 Sol; independent reviews: Claude Opus 5.5 and GPT-6 Sol; integration and preparation: GPT-6.1 Sol. Codex harness in T3 Code, with Claude used only for review.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — The PR narrowly restores OpenCode Go limit reporting and includes targeted regression coverage, but it changes production handling of Console API credentials by reading them from SQLite and sending them to the usage service. The authentication and sensitive-data implications require human review.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 17, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Warning
Review limit reached
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 7 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used all 10 included reviews currently available.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6b7cf157-4b2f-4ef5-a461-e6ed3653f7d2
📥 Commits
-
Reviewing files that changed from the base of the PR and between 3cb5b4f and 31a3f32.
📒 Files selected for processing: 3
-
docs/user/usage.md
packages/provider-opencode/src/server/status.test.ts
packages/provider-opencode/src/server/usageLimits.ts
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0a505897-5a85-40b9-b002-84c98589bc07
📥 Commits
-
Reviewing files that changed from the base of the PR and between 13aa882 and 3cb5b4f.
📒 Files selected for processing: 3
-
docs/user/usage.md
packages/provider-opencode/src/server/status.test.ts
packages/provider-opencode/src/server/usageLimits.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
-
The OpenCode Go usage probe can read a Console API key from OpenCode’s local database. It tries that key before the Go API key and falls back to the Go key after HTTP 401 or 403. The usage guide clarifies which credentials are accepted.
Changes: OpenCode Go usage credentials
| Layer / File(s) |
Summary |
Read Console credentials from SQLite packages/provider-opencode/src/server/usageLimits.ts |
The code reads eligible opencode key records from the local database. It excludes records with a server override and handles database errors without returning a Console key. |
Use Console credentials with Go-key fallback packages/provider-opencode/src/server/usageLimits.ts, packages/provider-opencode/src/server/status.test.ts, docs/user/usage.md |
The probe tries the Console key first and retries with the Go key after HTTP 401 or 403. Tests cover credential selection and fallback. The usage guide clarifies the accepted credentials. |
Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant GoUsageProbe
participant OpenCodeDatabase
participant UsageEndpoint
GoUsageProbe->>OpenCodeDatabase: Read an eligible Console key unless inline auth overrides lookup
OpenCodeDatabase-->>GoUsageProbe: Return the Console key or no key
GoUsageProbe->>UsageEndpoint: Request usage with the Console key when available
UsageEndpoint-->>GoUsageProbe: Return usage or HTTP 401/403
GoUsageProbe->>UsageEndpoint: Retry with the Go key after HTTP 401/403 when it differs
Loading
Suggested reviewers: maria-rcks, nexxeln
Merge Risk: ⚪ Minimal · up to 3cb5b
-
No issue identified that should block merging the Console API-key usage fix after normal checks.
Security architecture risk: 🔵 Low · up to 3cb5b
-
The change uses an additional local credential source but retains the existing HTTPS destination, local-instance restrictions, and read-only behavior. No new credential-disclosure or authorization-bypass path was established. Compatibility with all supported OpenCode credential formats remains unverified.
Retained concerns
No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- observed — The additional secret accessed is the selected Console key under the effective local OpenCode data directory. Instance overrides can change that directory, while empty instance configuration inherits the process environment; isolation is not created by this reader. The selected key is sent to the existing fixed opencode.ai usage endpoint.
Trust Boundaries and Controls
- observed — Disabled instances and any nonempty external server URL return before credential access. Neither the supplied server URL nor credential metadata determines the HTTP destination. Inline authentication remains an explicit database-lookup override.
Resilience and Maintainability Implications
- observed — Each probe closes its database handle before issuing HTTP requests, and fallback modifies only local request state. The surrounding probe retains its five-second Effect timeout. Shared snapshot handling can retain last-good limits after probeFailed unless the existing account-switch check detects a change; that retention policy is unchanged by this PR.
Hardening Proposals
- proposed — Document and validate the supported OpenCode producer contract for credential type, active-row selection, and self-hosted server metadata. This would strengthen confidence that future upstream schema changes cannot silently alter which credential is transmitted.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
The description fully explains the problem, implementation, scope, verification results, limitations, and test evidence. However, the required maintainer approval for the Console API-key path is not p… |
Add a link to explicit maintainer approval of the direction and scope, including the approval comment. If the change qualifies as an obvious focused fix without prior approval, explain why it qualifies under the repository requirements. |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
| Title check |
 |
The title clearly and concisely identifies the main change: restoring OpenCode Go limits for Console API keys. |
Full details: Description check
-
Explanation
The description fully explains the problem, implementation, scope, verification results, limitations, and test evidence. However, the required maintainer approval for the Console API-key path is not provided; the description states that approval remains a human decision.
Resolution
Add a link to explicit maintainer approval of the direction and scope, including the approval comment. If the change qualifies as an obvious focused fix without prior approval, explain why it qualifies under the repository requirements.
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Taking over this one. I’ll verify the Console credential format and precedence, keep the reader scoped to local instances, and refresh the regression and headless proof before pushing to this branch.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vedprakash2302
added a commit
to vedprakash2302/Cody
that referenced
this pull request
Oct 20, 2026
Brings in upstream through pingdotgg#22159 (069e63b).
- Superseded: partial-clone remotes (pingdotgg#16316 parses the promisor annotation). Dropped Cody's git/remoteUrls.ts and its test.
- Superseded: Tailscale SSH remote open with the server's username (pingdotgg#18092 adds username to tailscale targets). Dropped the tailscale-ssh kind, the user field and its login pattern check, and Cody's tests for them.
- Superseded: worktree bases fetched from their own remote (pingdotgg#21032 resolveWorktreeBaseRemote/fetchWorktreeBaseCommit). Dropped Cody's prepareWorktreeBase and its strict-fetch env.
- Adapted: Cody's pickers send full refs (refs/remotes/t3/main, refs/heads/x). resolveWorktreeBaseRemote now reads them, so a picked remote ref stays apart from a same-named local branch. GitWorkflowService.worktree.test.ts covers it through the service.
- OpenCode usage limits: kept Copilot limits alongside upstream's Console Go key lookup and key fallback (pingdotgg#21007); Cody keeps the readOpenCodeUsageLimits name.
- Worktree base labels follow upstream's "(remote)" marker and "Start from remote" copy while still reading full refs.
- Muse fixtures keep Cody's final-answer instruction inside upstream's new PR-watch text.
- Desktop tests: Cody scheme and app id in upstream's new Linux icon and Windows entry-point cases; the splash startup test's update mock returns a state because Cody's auto-install listener subscribes at startup.
- Kept Cody's longer checkpoint summary timeout on upstream's configurable diff output limit.
Uh oh!
There was an error while loading. Please reload this page.
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|