Repository navigation
Read OpenCode Go usage from the selected account - #24770
Conversation
Co-authored-by: kespineira <kespineira@users.noreply.github.com> Co-authored-by: kevimux <kevimux@users.noreply.github.com>
Align the new Japanese account copy with the existing catalog repair policy.
Preserve current main dependency upgrades and the reviewed account source. Resolve the lockfile by adding only the existing smol-toml package as a direct root dependency.
dd0a29e to
1c5b940
Compare
239716f to
2a8a26c
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — one optional documentation nit.
Reviewed changes
- Selected-account credential lookup —
resolveOpenCodeGoApiKeynow snapshotsprocess.env, restores the System baseline through the hostManagedDataAccountService, then applies the selectedopencodeprofile when no explicitenvironmentis passed. ThesettingsOverrideand explicit execution context keep precedence, invalid/unreadable selection metadata rejects the lookup, and the process environment is not mutated. - Regression coverage — a new host-service-backed suite exercises System→selected→System for v1/v2, opaque inline-baseline restoration, malformed/unknown/unreadable metadata refusal with manual-key precedence, and unchanged inherited env. I reverted the production hunk and re-ran it: 7 of 8 cases fail pre-patch, matching the PR claim.
I verified the sequencing matches applyManagedDataAccountEnvironment and confirmed both the new and existing opencode-go-api-key-source.test.ts suites pass.
ℹ️ Nitpicks
src/main/rate-limits/opencode-go-api-key-source.ts:194— theinput.environmentJSDoc ("Process environment to read; injectable for tests") now understates the contract: passing it also bypasses managed-account selection, which is the behavior this PR adds. A sentence noting that would help a future caller avoid passingprocess.envand silently disabling selection. The@returnsalso omits that the function can now throw when selection metadata is unreadable or invalid.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Preserve host filesystem-error reporting, both account providers, and all unrelated main entries.
…ative discovery cancellation
Retain complete reviewed account enrollment/removal, WAL-snapshot admission, durable quarantine, current providers and locale labels. Shared discovery keeps native cancellation third and selected environment fourth. Reviewed-full-source: 8913157
Use account rm as the canonical removal command and keep account remove as an alias. Preserve the existing accounts.removeData RPC and the full original 63-path account component. Original-Account-Source: cf71ae4 Frozen-Account-Base: 08ee7ba Frozen-Integrated-Main: 53f9ea7 Private validation source only; no ref or publication.
Preserve the complete reviewed account component, current main translations and capabilities, and original contributor ancestry.
Scan private removal backups before quarantined cleanup, reuse the existing state schema to validate the exact UUID, and preserve registered or unmarked profiles. Mark account rm as destructive using the existing typo recovery policy. Retain the full original account component and public author ancestry. Account-PR: 24636 Original-Account-Source: cf71ae4 Reviewed-Public-Parent: 6abaf73 Frozen-Integrated-Main: 53f9ea7 Private source only; no ref or publication.
…ecovery Compare validated account UUID identities without changing stored IDs or filesystem paths. Protect registered originals and quarantines, including explicit retry variants, and accept equivalent UUID spelling in a valid removal backup. Retain the complete account component and published contributor ancestry. Private source only; no index, ref, or public mutation.
…okup Compose the complete two-file caller change onto the frozen reviewed account, credential and native component tree. Restore the execution host original account through its existing private service before applying the selected OpenCode environment and probing its backend. Preserve the current fourth environment argument, filesystem error callback and cancellation seam. Original-Public-Head: 2a8a26c Original-Reviewed-Source: 0291f5c958042ff039958d4ec650bf32d073e65a Frozen-Account-Composite: e8e2e22
Keep a ten-minute bound only for node-pty rebuilt on Windows ARM CI hosts; all other node-gyp calls retain five minutes. Cold setup in two completed ARM jobs left compilation less than a minute.
…tion Preserve the complete account contribution and interrupted-removal safety corrections. Join additive main commands, per-spawn jcode environment cleanup and catalogs without replacing either side.
…ion fix Preserve all 64 validated account postimages and the current main CI contract.
Private full component composition on frozen main5e. Retains all published account/caller ancestry and complete owned scope. The sole relay overlap preserves main launch-token ownership and account XDG restoration.
Private full component composition on frozen main5e. Retains all published account/caller ancestry and complete owned scope. The sole relay overlap preserves main launch-token ownership and account XDG restoration.
Preserve the fully reviewed source postimages on mainb601. Only two unowned browser test-driver paths changed since validated main5e.
Preserve the fully reviewed source postimages on mainb601. Only two unowned browser test-driver paths changed since validated main5e.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughWhen no environment is injected, Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change. Complete the required public CI checks before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Credential lookup now follows the selected account without changing the host environment, and explicit overrides retain precedence. The remaining uncertainty is whether an inherited API key should remain usable when the selected account has no stored credential. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

ELI5
OpenCode Go usage follows the account selected in Orca. Choosing System uses the host's original account even when Orca inherited a managed profile. A saved key override still wins.
What Changed
Before identifying OpenCode's credential backend or reading its store, the caller copies the host environment, restores the original account through the existing account service, and applies the selected OpenCode profile. Invalid account metadata rejects the lookup. Explicit execution context retains its precedence.
Why
The account service already owns private authentication references and System restoration. Reusing it keeps this lookup consistent with actual OpenCode launches without creating another credential store or changing the host environment.
Linked Issue
Refs #8145, #9362 and #18561. The account, credential and native dependencies are merged (#24636, #24615 and #24647). This fixes selected-account lookup only. The broader Devin/OpenCode account workflow in #18561 remains open.
Visual Proof
N/A — backend credential lookup only; no renderer or input interaction changes. These values come from fresh, captured OpenCode 2.0.16 requests and production caller results:
The requests used private placeholder credentials and a loopback server returning 401. This is captured backend evidence, not a rendered usage screen or a paid model request.
Testing
On macOS arm64, the installed OpenCode 2.0.16 enrolled credentials through its real login prompt in private PTYs. Production account import, selection, launch environment, backend detection and credential lookup then exercised System → managed → System. The old caller reproduced the mismatch above; the corrected caller matched all actual request headers. HOME, userData, all four XDG directories and temporary files were isolated. No conversation store was imported and the host environment remained unchanged.
234 tests across 15 relevant files pass, including the original eight caller regressions and 49 focused credential/caller assertions. Seven of the eight original regressions fail before the correction. Node/CLI/web typechecks, changed-line quality checks, formatting, RPC generation, localization and source ratchets pass. Windows, Linux, WSL and SSH execution were not repeated in this local check. Public CI remains required.
Review
The complete original two-file change and its author history are preserved. Current credential lookup and native database discovery remain intact, including filesystem-error reporting, cancellation and the selected environment. The independently tested caller tree is
aa0f0afdf8f7b1fd1a8806eebef380accf193bde.The publication
2d9003031695ed5f9b654cfcfe969b61223fda5dnow targets main after account PR #24636 merged asc2dba120727a6839e02899117de342034aee61f6. The complete source tree is byte-for-byte identical to the previously tested caller sourcea3ab2a9e4c352078d0294af466a8131bf46c7c33: both caller files retain their reviewed contents, and all 32,245 entries outside those two files match the merged main. Both the previous caller head and current main remain ancestors.The combined implementation passed 518 tests across 29 files, all four typechecks and six quality gates on source
1845f0bd550e95dd9bd413cb31207c6424b957bd. The unchanged current tree also passed 42 PR-contract tests and the RPC catalog check ona3ab2a9. Genuine installed OpenCode requests and the earlier 234-test caller proof remain qualified to the unchanged lookup code. Fresh normal CI on this main-targeted publication passes: 16 successful checks and 16 intentionally skipped checks, with no pending, failed or cancelled checks.Agent skill upstream boundary
Notes
The host running OpenCode owns account selection. Explicit environment/backend context still bypasses local account lookup. Folder workspaces and existing remote behavior are preserved; this does not establish a new SSH or Devin login result.
Checklist