* refactor: separate execution route and child exit owners
* refactor: move browser data into defining feature owners
* refactor: give runtime RPC entry its shutdown implementation
* refactor: use defining process types and colocate host telemetry test
* docs(process-host): point piped child contract to Node owner
* docs(process-host): clarify both piped contract owners
A suspended recipe VM kept getting reconnect attempts: shared-control
socket retries, health probes and SSH logins. Providers that resume a VM
on a new SSH login or connection woke it again, so suspend saved nothing
(#36363).
While a VM's record is suspended (or its resume failed) and no wake is
under way, Orca now makes no background dial to it:
- SSH: connect and the reconnect ladder refuse that VM's own SSH host,
which covers tunnels, managed-server checks, census and browser bridge.
- Shared control: no retry after close, and no socket open, including a
retry timer armed before the sleep.
- Status probe: answers asleep without dialing.
A wake (opening the workspace, Resume) is pending before it dials, so the
wake's own connect passes. Afterwards the server's control socket and
status are reopened.
A VM recorded as up whose SSH host Orca gave up reaching (the reconnect
ladder used every attempt) may have been stopped or reclaimed by its
provider. Before, opening the workspace did nothing for it (#34089). Now
it runs the recipe's resume and reconnects. If that fails, the record is
left as it was, so normal reconnects go on.
Fixes#36363
Refs #34089
* refactor(main): organize SSH transport and managed server owners
* Remove orphan deploy readiness fixture and shrink test baselines
* refactor(wsl): import lock records from their defining owner
* refactor(wsl): use the canonical deferred update contract
* refactor: import journal queue state from defining owners
* refactor(shared): organize execution and automation owners
* fix: retain type imports used by surviving test cases
* refactor: finish work item owners and refresh validation metadata
* test: infer reconnect status fixture type
* test(claude): resolve source files beside same-named directories
* test(runtime): group repository creation mock registrations
* refactor(main): organize runtime implementation owners
* test: retire wall-clock CLI title recovery case
* refactor: route new folder mutation to runtime store owner
* test: import folder mutation store contract from its owner
* fix(ssh): finish the move to the managed server once the last bridged relay terminal exits (#29626)
When a host stayed connected and unmoved only because the legacy relay
bridge served relay-era terminals, nothing retried the move after they
ended. The registry now notes relay-proven exits and, once the bridge
serves no pane (live or unverifiable) and owes no stop, runs one
automatic connect through the existing decision path. Lost contact keeps
panes unverifiable, so it never triggers the retry.
* fix(ssh): keep a bridged host as it was when the automatic move retry is refused (#29626)
The retry now runs as a quiet automatic connect. Its attempt shows no
setup progress, so the kept bridged status is never replaced mid-way.
A refusal or failed decision republishes the kept connected status
instead of an error, and never abandons the reused transport or stops
the bridge. It also refuses to run when it would replace a pending
transport, or once the host is no longer connected and bridged. Only a
finished move publishes a new status.
* fix(ssh): keep a quiet move retry from changing what the user or host already has (#29626)
- A user's connect joining a quiet retry upgrades it to an ordinary
connect, so refusals surface and progress shows; a quiet refusal no
longer clears move-anyway consent.
- A quiet retry rotates the provider authority only once its move
succeeds, so a refusal cancels no in-flight provider requests.
- On refusal, re-read the host status and republish only a still-bridged
host, as connected only while its transport is connected.
- Exits are tracked per bridge, so a replaced bridge's exit never counts
for its successor.
* refactor: key move-retry exits by a named bridge type
* perf(terminal): send idle remote keystrokes without the 8ms debounce
Remote terminal input batching was a pure trailing debounce, so every
isolated keystroke waited 8ms before leaving the renderer. Send input at
once when the batcher is idle and coalesce only what arrives inside the
following window. Recovery-hold replay keeps the trailing path so a
synchronous flush cannot re-enter the still-buffering hold.
* perf(ssh): disable Nagle on loopback sockets carrying orcad RPC
The SSH forward listener, the stdio bridge listener, and the remote
bridge's connect to orcad relay WebSocket RPC (keystrokes and echo).
ws sets TCP_NODELAY on its own sockets, but these relay sockets did not,
so small writes could wait behind an unacknowledged segment.
* perf(terminal): decode terminal frame payloads as views, not copies
Every message buffer is fresh and consumers decode the payload
synchronously or retain it read-only; the only in-place rewrite touches
header bytes.
* fix(terminal): send idle remote keys at once only to input-acking hosts
On hosts without input acks, an immediately sent key travels as a stream
frame while a following accepted write (Ctrl+C, paste) goes as a separate
terminal.send RPC on another socket, so the host could apply them out of
order. Keep the trailing batch there so both still leave as one RPC.
* fix(ssh): keep the managed tunnel's TCP forward when a slow ProxyCommand delays its login
`ssh -L` binds its local listener only after its own login. The managed
tunnel gave that login 750ms plus a 5s channel check, then judged the
forward "never listened", killed it and switched the whole connection
generation to the per-socket stdio bridge. Through a slow ProxyCommand
(Coder `ssh --stdio` on Windows, without ControlMaster) the login often
takes longer, so the working forward was discarded and every socket paid
a fresh proxied SSH login, leaving the server Unreachable (#38636).
Give the listener the same 30s budget a system SSH connect gets, keep
the short wait for the channel answer once it listens, and stop waiting
as soon as the forward process exits so a refused login still falls back
at once with ssh's own exit reason.
Refs #38636
* test: give the slow-login forward test its timeout reason and real-socket wait exception
* fix(ssh): keep old relay channels off the host's own SSH connection
Each old relay still running a shell held one exec session on the target's
connection. At sshd's MaxSessions (default 10) every later exec failed, so the
host stuck at Connecting with 'Could not detect the remote platform: (SSH)
Channel open failure: open failed'.
* test: say why the session-limit repro needs a longer timeout
* test: note why the relay channel fakes are cast
* test: move the many-relays repro into the existing legacy relay bridge suite
* refactor: organize remaining terminal pane features by owner
* refactor(terminal): consolidate replay guard type imports
* refactor(terminal): retarget notification mocks and generated consumer import
* refactor(terminal): repair benchmark owner lookup and stale mock export
A recipe VM workspace runs on its VM's own Orca server, so a phone, the CLI or
the desktop reaching it while the VM slept dialed a server that was not there
and failed. Only the host window's click ran the recipe's resume.
- The VM wake owner (WorkspaceSleepCoordinator) tracks the VM operations it
was asked for and answers where the VM stands: a pending wake or a running
suspend outranks the stored record.
- The host holds a request that opens the workspace (worktree.activate,
defined once in shared code) until the VM is up: three minutes for the
desktop and the CLI, and for a phone only as long as still lets the relay
connect inside the phone's 30-second deadline. A VM still up keeps a sleep
on its way from suspending it; a VM asleep or suspending wakes after what is
running, joining a wake already pending. The open answers waking only when
the hold runs out, wake_failed when the wake fails, and asleep when a Sleep
asked for while it was held won; that open then wakes nothing more. Other
requests answer waking or asleep instead of dialing nothing. A Sleep asked
for during a wake keeps its place in the lifecycle queue and starts once the
wake is done. A caller that gives up stops waiting and frees its queue
place; the wake goes on.
- An open of a server the user disconnected is refused before anything wakes
its VM, and cancelled if they disconnect while it waits. A wake carries the
SSH host's user hold from when it was accepted and every Disconnect since,
so its connect never lifts a hold; the VM still resumes and its new SSH
address is saved for the user's own Connect.
- A wake re-pairs a paired VM's server. The request that waited for it is
held to its caller's pairing as of before the wake (a stale caller is
refused before it can wake anything), then to exactly the pairing revision
the resume produced (including a re-pair its SSH reconnect made), whatever
process now serves it; any other change still
refuses it. A phone link still preparing for an open survives only the
re-pair its own wake made; any other retirement, or a user Disconnect, ends
it, and a link preparing for anything else is retired at once.
- The hold lives in the desktop's environment preparation, which its own calls
and subscriptions, the phone relay and the CLI all go through. A phone open
on a link to a server whose VM is not up gets a fresh link; the old link's
requests are answered waking or asleep. Further opens join a link already
waiting on the wake. A phone link's whole open (server preparation with any
hold, grant sync and the socket) shares one deadline inside the phone's
own, for every server.
- The CLI dials a VM directly, so `orca worktree activate` asks the desktop
(runtimeEnvironment.wakeRecipeVm) to open the VM and reads the server's
pairing again; the refusals (including runtime_manually_disconnected) keep
their codes over RPC, and a host without recipe VMs answers that one RPC
with method_not_found. Hosts that do this advertise
host.recipe-vm-wake.v1.
- A workspace this host runs on a recipe VM over its SSH target wakes on this
host's own activation, through the resume's explicit connect
(wakeWorkspaceVm -> resumeVm -> connectRuntimeOwnedSshTarget). That connect
runs whenever the VM is in SSH mode, even when its recipe had no resume step,
since suspend tore down the transport.
Fixes#36923
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
`ssh -G` prints `identitiesonly no` when ssh_config leaves it unset, so the
resolved value always won and a manual target's own IdentitiesOnly was ignored.
Manual targets now use IdentitiesOnly when either the target or ssh_config
enables it; ssh_config-backed targets are unchanged.
Co-authored-by: Martin Vlach <mr.huge@seznam.cz>
The upload chose between local tar's and the remote's errors partly by which
process exit Node observed first, so a missing local directory could surface
as the remote tar's truncated-stream error and be classed as host-answered.
It now waits for both, then blames the remote only when the pipe into ssh
failed, meaning the far end stopped reading before local tar's output ended
(a local tar SIGPIPE or write error always comes with that). Any other local
tar failure caused the remote EOF and is kept.
Fixes STA-13013
* fix(ssh): move automation run history beside the migration manifest
A host whose automations kept a lot of run output overflowed the 768 KiB
signed migration manifest, so every Connect was refused and the host was
locked out. Run history now travels as a capability-gated
`automation-run-history` blob: the manifest signs only its sha256 and
size, the destination imports the runs atomically with the catalog at
commit, and a host without the capability is refused before anything is
sent instead of importing automations without their runs. Journals and
manifests signed with inline runs are still accepted. The oversize error
now names the largest section with an action that trims it.
Fixes#37051
* refactor(ssh): read migration capabilities from their own client module
Keeps orcad-migration-catalog-client.ts within its line budget.
Refs #37051
* fix(managed-server): drop a cached update deferral once the host's active build moves
Status reads the host record every time but kept a local deferral until the
host's active version compared equal to or newer than the candidate. Two
builds of the same release differ only by content hash, which compareAppVersions
cannot order, so after the host moved the deferral could stay for days and
the UI kept reporting a pending update that described nothing.
Record the host's active version with the deferral; any change clears it.
This addresses the stale-cache part of the issue; the interrupted-transaction
retry and the supervised-update workflow are separate.
Refs #38400
* fix(managed-server): key a deferral to the host's activation, not just its version
A host that moves to another build and back between two status reads keeps
its version but gets a new activatedAt; the deferral it recorded no longer
describes that host. Compare active and activatedAt, the record identity the
activation code already uses for the same question.
Refs #38400
* fix(managed-server): drop a deferral whose candidate the host already runs
Refs #38400
---------
Co-authored-by: Pr1p <zwq19980411@gmail.com>
* fix(ssh): stop restarting a managed orcad that keeps crashing, and say why
orcad now reports, in its health, a previous run that died on this boot
without releasing its instance lock. Graceful stops (idle exit, explicit
stop, update activation, rollback) release the lock, and a reboot changes
the boot id, so none of those count. After 3 such exits in 10 minutes the
desktop stops waking the server until an explicit Connect, and shows the
reason with orcad.log's path and tail instead of timing out.
Refs #37538
* fix(ssh): count fatal stops and failed starts; brake every automatic wake
- A fatal orcad stop (uncaught exception) keeps its instance lock, so the
next start reports it.
- A launch that never becomes ready counts once, not again when the next
orcad reports it.
- The tunnel port-recovery wake goes through the same brake.
- macOS and Windows hosts use OS uptime as boot evidence.
- Connect also drops a cached serving verdict.
Refs #37538
* fix(ssh): serialize crash-loop brake admission per host
Refs #37538
* fix(ssh): count reported Windows launch failures toward the crash-loop brake
Refs #37538
* fix(orcad): read the Windows launch report when the launcher exits nonzero
Refs #37538
* fix(ssh): ignore brake accounting from wakes begun before a reconnect
Refs #37538
* fix(ssh): count only launches that failed readiness, not inspection failures
Refs #37538
* fix(orcad): keep the command error when a Windows launch left no report
Refs #37538
* fix(ssh): surface the crash-loop reason from tunnel port recovery
Refs #37538
* fix(ssh): take the brake's reset epoch when a wake is requested
Refs #37538
* test(ssh): keep the cast on its SAFETY line
Refs #37538
* fix(ssh): tighten what the crash-loop brake counts and when it lets go
- A Windows host-policy refusal is not counted; its own guidance stays.
- The braked detail names the last failed start.
- A latch set on a run that served is released once that run's lock shows
it stopped cleanly.
- The update path's already-active wake goes through the brake.
- The fatal-stop test drops its shutdown timer.
Refs #37538
* fix(ssh): brake only a new launch, and count the wake after an automatic release
Refs #37538
* fix(ssh): refuse a braked launch at the fenced launch decision itself
Refs #37538
* fix(ssh): a refused launch also skips fence recovery, which can relaunch
Refs #37538
* test(ssh): a refused launch leaves fence recovery alone
Refs #37538
* fix(ssh): count failed recovery launches; dedupe only runs that ran
Refs #37538
* fix(ssh): explicit Update and Restart re-arm the crash-loop brake; release it after a reboot
- Update and Restart are user actions like Connect: they clear the brake.
- An auto-update that meets the brake on an already-current host is a
skip, never a recorded update failure that would block retries.
- The brake releases once the latched run's lock comes from an earlier boot.
Refs #37538
* fix(ssh): every explicit server action re-arms the brake; count failed candidate launches in recovery
Refs #37538
* fix(ssh): only gated wakes can return launch-refused
Ungated callers (version adoption, stale-lock reclaim, WSL, restart) pass no
launch gate, so their wake type no longer includes a refusal they cannot get.
Refs #37538
* fix(ssh): reboot evidence also releases a brake raised by failed starts
Refs #37538
* fix(ssh): release the brake only on a new boot of the machine that answered when it engaged
A leftover lock's boot id cannot tell a reboot from a shared-home lock
written by another login node or one older than the loop.
Refs #37538
* fix(ssh): a braked host seen serving can be released by that run's clean exit
Refs #37538
* fix(ssh): identify the rebooted machine by hostname and machine id
Login nodes behind one hostname share it, so the hostname alone cannot tell
them apart. Without a machine id the brake does not auto-release.
Refs #37538
* fix(ssh): only an answered run counts as served; a reboot must postdate the brake
A clone with the same hostname and machine id that booted earlier is a
different backend, not a reboot. Boot and read times come from the host's
own clock.
Refs #37538
* fix(ssh): only an answer received after the brake engaged marks its run served
A control-socket pong up to 20 s old may come from a run that has since
exited cleanly; counting it would let failed starts release the brake.
Refs #37538
* fix(ssh): say what to do when a host's server setup stops on a known cause
A managed SSH host whose server setup deferred always showed "Orca couldn't
start its server on this host. Try connecting again.", even when a retry
can't help (full disk, an interrupted update needing Recover, another Orca
runtime on the host's data). The deferral code was dropped before it reached
the host status.
Carry the code as an optional field on the unserved status, keep the retry
line only for codes a later connect clears, and name the fix for the ones a
user can act on. Older hosts and thrown errors carry no code and keep the
retry line.
Refs #38347
* fix(ssh): drop the Recover advice a first setup can't act on
Connect already runs activation recovery before deploying, and an unregistered
host has no Recover control, so that code now points at Details. Soften the
live-runtime line, keep waiting causes in the warning tone, and test the
published code and its remedy rather than English copy.
Refs #38347
* fix(ssh): treat an unreadable server build as needing Details, not a retry
Refs #38347