mirror of
https://github.com/stablyai/orca.git
synced 2026-09-25 16:02:38 +00:00
* fix(runtime): stamp a runtime's own project setups as local, and report remote status about the remote (STA-4792) Two independent frame-of-reference bugs, both from code describing one machine while labelled as another. #15366 — projectHostSetup.* persisted the caller's host id verbatim. Those `runtime:<environment-id>` ids are minted by the calling client's own pairing store, so they name a machine only relative to that client. A client sending one is addressing this runtime, and runtimes do not proxy these calls onward, so the host it names is us. Storing the client's spelling made one machine look like a different host to every other client, hid its rows from them, and defeated the (projectId, hostId) duplicate check — two laptops paired to one server each created their own setup for the same checkout. Re-spell it as `local` at the RPC boundary. Rows written earlier keep their old stamp; readers already project `local` back to `runtime:<their-id>`, so the client-visible model is unchanged and no ids are rewritten. STA-4792 defect 4 — `status --environment <name>` hardcoded app.running:false to mean "no desktop on THIS machine" while every other field in the same object described the target, including a desktopWindowStatus echoed straight from it. The result contradicted itself and read as "that run was headless" when the remote GUI was up. `app` now describes the target, keyed off the one window status that requires a live renderer, and the result names its own subject so the frame can't be misread again. The remote pid is not knowable, so it stays null. STA-4792 defect 2 gets a regression test rather than a fix: routing already made the client remote, which is what stops a Windows destination being joined to the local cwd. The test pins the exact reported invocation. * fix(status): share the remote app projection with the SSH host passthrough, and name the version gap on project host setup Two review follow-ups. The SSH host passthrough answered `app.running: true` unconditionally for the Orca host a caller reached over SSH, claiming a desktop app even for a headless `serve`. That is the same defect as the paired-server path, one transport over, so the projection moved to shared and both now answer the question the same way. `--host runtime:<id>` routes project commands to a paired server, which means a client can reach a server that predates project host setup without meaning to. That answered a raw `method_not_found`, which reads as an Orca bug rather than a version gap; the CLI now names it the way the desktop already does. Reverted a third change: making the persistence duplicate check treat `local` and `runtime:*` as one machine. That assumption holds at the RPC boundary, where a `runtime:` host means the runtime being addressed, but not in the store, which also records independent provisioning metadata for machines that are not itself. An existing test covers exactly that, and it was right. The duplicate convergence therefore stays bounded to rows written after the normalization.
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import type { CliStatusResult, RuntimeStatus } from './runtime-types'
|
|
|
|
export function resolveDesktopWindowStatus(
|
|
status: RuntimeStatus
|
|
): CliStatusResult['app']['desktopWindowStatus'] {
|
|
if (status.desktopWindowStatus) {
|
|
return status.desktopWindowStatus
|
|
}
|
|
// Why: older desktop runtimes predate the explicit status but a positive
|
|
// Electron id still proves that a real window owns the graph.
|
|
return status.authoritativeWindowId !== null && status.authoritativeWindowId > 0
|
|
? 'available'
|
|
: undefined
|
|
}
|
|
|
|
// Why: a status fetched from another machine describes THAT machine, so `app` must too.
|
|
// `available` is the only desktop-window status that requires a live renderer owning the graph,
|
|
// which makes it the signal separating a real desktop app from a headless `serve`. Reporting a
|
|
// fixed running value while echoing the target's own window status produces a self-contradictory
|
|
// result, and readers acted on it — a remote GUI run was written off as headless (STA-4792).
|
|
// A pid is not knowable across the boundary, so it stays null.
|
|
export function projectRemoteAppStatus(status: RuntimeStatus): CliStatusResult['app'] {
|
|
const desktopWindowStatus = resolveDesktopWindowStatus(status)
|
|
return {
|
|
running: desktopWindowStatus === 'available',
|
|
pid: null,
|
|
...(desktopWindowStatus ? { desktopWindowStatus } : {})
|
|
}
|
|
}
|