Skip to content

fix: pr-bug-scan validated finding from #1878 - #1962

Merged
AmethystLiang merged 1 commit into
mainfrom
bot/pr-bug-scan-1878-1778872952
May 16, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
bot/pr-bug-scan-1878-1778872952

Conversation

@buf0-bot

@buf0-bot buf0-bot Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Automated fix-PR from pr-bug-scan for parent #1878.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: Pass null (not undefined) for pairingCode/environmentSelector when shouldIgnoreRemoteSelection is true, so RuntimeClient defaults do not fall back to ORCA_PAIRING_CODE/ORCA_ENVIRONMENT.
Blocked proof link: src/cli/index.ts:53-54 — undefined args no longer leak into RuntimeClient default parameters at src/cli/runtime/client.ts:35-39, so resolveRemotePairing/resolveEnvironmentPairingOffer never run for environment/serve commands
Typecheck: skipped

Proof (from validator)

  • C1 — proof_type: code_analysis
    • trigger: User has ORCA_ENVIRONMENT=stale exported in their shell (or ORCA_PAIRING_CODE) where stale is not present in the local environment store, then invokes any CLI command — including orca environment list, orca environment add, orca environment rm, or orca serve — that shouldIgnoreRemoteSelection was meant to exempt.
    • observable: Every CLI invocation aborts in new RuntimeClient(...) (before dispatch reaches any handler) with a RuntimeClientError such as 'No environment matches selector "stale"', regardless of whether the command was supposed to be exempt from remote selection.
    • path:
      • src/cli/index.ts:47-49 — when shouldIgnoreRemoteSelection is true, pairingCode/environmentSelector are forced to null
      • src/cli/index.ts:53-54 — typeof null === 'string' is false, so the constructor receives undefined rather than null
      • src/cli/runtime/client.ts:35-39 — default-parameter values = process.env.ORCA_PAIRING_CODE ?? process.env.ORCA_REMOTE_PAIRING ?? null and = process.env.ORCA_ENVIRONMENT ?? null re-activate because the arg is undefined
      • src/cli/runtime/client.ts:42 — resolveRemotePairing(userDataPath, remotePairingCode, environmentSelector) runs in the constructor body, eagerly
      • src/cli/runtime/client.ts:199-201 — when environmentSelector is truthy, calls resolveEnvironmentPairingOffer(userDataPath, environmentSelector) which throws RuntimeEnvironmentStoreError for unknown selectors (translated to RuntimeClientError in src/cli/runtime/environments.ts:69-75)

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

Pass null (not undefined) for pairingCode/environmentSelector when shouldIgnoreRemoteSelection is true, so RuntimeClient defaults do not fall back to ORCA_PAIRING_CODE/ORCA_ENVIRONMENT.
@AmethystLiang
AmethystLiang merged commit 08c2463 into main May 16, 2026
7 of 8 checks passed
@AmethystLiang
AmethystLiang deleted the bot/pr-bug-scan-1878-1778872952 branch May 16, 2026 00:00
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant