Repository navigation
refactor(orcad): every snapshot state op fits the gateway exec budget in shell; the state lock sends its script once - #30744
Conversation
… in shell; the state lock sends its script once
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
Before Orca updates its server on a remote machine, it saves a copy of your settings and sessions so that a rollback has something to go back to. The commands that save, put back, clear and compare that copy were long shell scripts, and some SSH gateways cut long commands short (#30491). This change makes every one of them short enough to pass whole. It loops over the saved items once instead of writing out each item's full path, and it stops sending the same script twice.
What Changed
User-visible: nothing changes when things work. On hosts behind gateways that cut exec requests, the snapshot, restore, clear and compare commands no longer get truncated. Every one is now under the 6 KB budget, uncompressed, even with a very long home path and a held update fence.
One loop over the members. Previously each command repeated a test and an
rm/mv/difffor every snapshot member, and each repeat carried the full quoted path, which the nestedsh -cquoting multiplies. Now each command assignsroot,stage,dirandarchiveonce and runs a singlefor m in orca-profile-index.json orca-data.json profiles profile-move-intentsloop.FAILED;One script, sent once (folded in from the closed refactor(orcad): the activation snapshot runs on the candidate's Node; state ops send their script once #30741).
serializedStateMutationCommand, the lock, fence and 15-minute deadline that every state change runs under, repeated its whole script in both branches ofif command -v timeout. The deadline is now a word list, so the script crosses the wire once.Shorter slot selection. The slot runtime and entry selections assign
orcad_slot=once instead of repeating the long slot path, which also trims the launch command.Measured worst-case wire bytes (budget 6,144):
The capture, restore, clear and wrapper ceilings are deleted from the byte-budget ratchet.
Why
Round 4 item R4-10b had planned to move these ops onto a Node program inside the server build (decision D-J). Measured, the shrunk shell is smaller than the Node version of every op: capture 5,675 vs 5,815, restore 5,258 vs 5,744. The shell also has to stay anyway, for older server builds and for rollback. A Node version would have meant a second implementation of each op, slot-capability tracking and a new journal field. So the lead revised D-J to keep one shell implementation and #30741 was closed. The archive format (
state.tar), the on-disk lock protocol and every verdict are unchanged, so older desktops on the same host interoperate as before.Linked Issue
Part of the SSH/remote hardening round 4 (R4-10b). Related: #30491. Supersedes #30741.
Visual Proof
N/A: there is no UI change. This only changes the remote host commands.
Testing
orcad-state-snapshot-shell.test.ts,orcad-state-snapshot-space.test.ts) run capture, restore, clear, prune and the lock on/bin/sh. They include a capture and restore through a gateway that cuts exec requests at 10 KiB and merges stderr. The decoder-fallback test now checks that a capture passes whole through a 6 KiB cut.daemonorlogs, and extraction before removal.src/main/managed-serverandsrc/main/ssh, single worker.37d76d0c(the head adds only a test).mvfail for one member: restore reportsFAILED, keeps the stage, and a rerun restores. A mutation check (dropping theok=; breakguard) makes it fail.Review
Agent skill upstream boundary
Notes