mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 17:47:40 +00:00
fix(cli): check the runtime source before sending (#27206)
* fix(cli): check the runtime source before sending A terminal Orca launches now carries which Orca launched it (ORCA_RUNTIME_SOURCE_ID = the profile's installation id, ORCA_RUNTIME_SOURCE_INCARNATION = the launching runtime id). Before a request is sent, the CLI compares that with the runtime the profile's runtime record names. Same runtime: sent as before. Different runtime: a read-only status.get asks which profile it serves; the same profile (a restart or update) is accepted, anything else is refused before the request reaches it. The vars cross into WSL through WSLENV. The SSH bridge stamps the bridging runtime itself rather than trusting the remote env. The existing orchestration compatibility stamp is untouched. * fix(orcad): drop an inherited runtime source at startup * fix(cli): an explicit switch to another profile is not fenced The stamp also carries the launching runtime's userData path. A CLI that dials a different profile than the one that launched its terminal, and not the platform default an unpinned terminal falls back to, was pointed there on purpose (orca-dev from a packaged Orca's terminal), so the fence does not apply. * refactor(cli): reuse the shared userData path comparison --------- Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
@@ -8,6 +8,7 @@ import type { RpcResponse } from '../runtime/rpc/core'
|
||||
import { RpcDispatcher } from '../runtime/rpc/dispatcher'
|
||||
import { ALL_RPC_METHODS } from '../runtime/rpc/methods'
|
||||
import type { OrcaRuntimeService } from '../runtime/orca-runtime'
|
||||
import { getRuntimeSourceStamp } from '../runtime/host-descriptor'
|
||||
import {
|
||||
HostCliUnavailableError,
|
||||
runHostOrcaCliPassthrough,
|
||||
@@ -84,7 +85,10 @@ export async function runRemoteOrcaCli(
|
||||
|
||||
let passthroughFailure: HostCliUnavailableError | null = null
|
||||
try {
|
||||
return await runHostOrcaCliPassthrough(request, passthroughOptions)
|
||||
return await runHostOrcaCliPassthrough(request, {
|
||||
runtimeSource: getRuntimeSourceStamp(runtime),
|
||||
...passthroughOptions
|
||||
})
|
||||
} catch (err) {
|
||||
if (!(err instanceof HostCliUnavailableError)) {
|
||||
throw err
|
||||
|
||||
Reference in New Issue
Block a user