fleetwire: the on-box hand-over wraps compound steps in sh -c over ssh — the remote shell re-parses the words, sh -c git prints usage and the flip faults (Retry then faults at the mv) #2188
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#2188
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
tu-ia rented founding, app 2026.11.3426 (
a5025990), 2026-11-10 13:40 — the gateway deploy completed (control plane live, Files / Document editing / Calendar provisioned, all doors over valid TLS) and the finish leg faulted at the hand-over:Why
Fleet.PushConfigRepo's on-box branch (fleet.go) runs its idempotent steps asssh <target> <words…>, and three of them are wrapped as{"sh", "-c", "<multi-word command>"}. ssh joins its argv with spaces and the remote login shell re-parses the line, so the box runs—
sh -c git(git with no subcommand → usage, exit 1), then the||fallbackremote set-urlon a repo with no origin →No such remote, exit 2. The two earliersh -c "[ -d … ] || …"steps "passed" the same way by accident:sh -c '['fails, so the||branch (mv,git init --bare) ran bare in the login shell. The step order also means a Retry on the same box faults at step 1:[ -d /srv/idss/config ]is never evaluated,mv /srv/idss/founding-config …runs unconditionally and the staging dir is gone.TestPushConfigRepo_OnBoxHandsOverTheWriterWithoutAPushasserts the joined words (flatten) and so could not see the re-parse. Every other remote step in fleetwire (supply.go'smkdir -p … && …) already passes the words bare for the remote shell — the on-box flip is the odd one out.Fix
Pass the three compound steps as bare words (no
sh -c), exactly as supply.go does; add a test that refuses any ssh step of the shapesh -c <string with a space>. On tu-ia the two remaining steps (remote add origin,systemctl restart idss-control-plane) were applied by hand at 13:41 so the control plane composes whole over/srv/idss/config; the app-sideawaitWholeComposition+Replicatestill need a Retry on a fixed build.Related: #2185, #2186, #2187, final-review I1, ADR 0102, ADR 0032,
internal/fleetwire/fleet.go,internal/fleetwire/fleet_test.go,internal/fleetwire/supply.go.Triage ruling
Category: bug · State: ready-for-agent
Ruled by agent under ADR 0174 — veto anytime. Confirmed the report against the
code and routed it to the swarm. This is a two-way door: the change is a
revertible edit to
internal/fleetwire/fleet.go+ a new unit test, provable bygo test ./internal/fleetwire/.... It touches no protected.sandcastle/path, no host credentials, no design tier, no member-facing trust surface, and
no security posture — nothing on the one-way-door list.
Claim confirmed in the code
fleet.go:250,251,255— the on-box branch wraps three compound steps as{"sh", "-c", "<multi-word command>"}.Target.sshArgs(fleet.go) appends the remote words to thesshargv, sosshjoins them with spaces and the remote login shell re-parses theline.
{"sh","-c","git -C … remote add origin … || …"}reaches the box assh -c git -C … remote add … || …:sh -c gitruns git with no subcommand(usage, exit 1), the
||fallbackremote set-urlthen hits a repo with noorigin →
No such remote 'origin', exit 2. Exactly the live fault on tu-ia.[ -d … ] || …steps (mv,git init --bare) only "passed" becausesh -c '['fails and the||branch ran bare — so the mv runsunconditionally, and a Retry on the same box faults at step 1 once the
staging dir is gone.
supply.gois the correct idiom: every remote step passes bare words with"&&"/"||"as their own argv elements (e.g.fleet.go:299already does"rm","-rf","…","&&","git","clone",…), letting the remote shell parse theoperators.
TestPushConfigRepo_OnBoxHandsOverTheWriterWithoutAPush(fleet_test.go) checks
strings.Contains(flatten(r.calls), want), andflattenjoins with spaces — so the joined string contains eachwantsubstring whether the words are bare or
sh -c-wrapped. The test cannot seethe re-parse.
Agent brief
Goal: the on-box config-repo hand-over survives the remote shell and a Retry
is idempotent.
Do:
internal/fleetwire/fleet.go, rewrite the three{"sh","-c", …}steps inPushConfigRepo'srepo.OnBoxbranch (themv, the[ -d …config.git ] || git init --bare, and theremote add origin … || remote set-url) as barewords, operators (
||) as their own argv elements, matchingsupply.go.Preserve the conditional semantics so the
[ -d … ]guards are evaluated onthe box (the whole point: a Retry must skip the already-done mv / init).
fleet_test.go) that refuses any ssh step of the shapesh -c <string containing a space>— i.e. no remote step may hand the boxa multi-word command as a single
sh -cargument. Assert over the rawr.callsargv, not the space-joinedflattenoutput, so the re-parse isvisible.
TestPushConfigRepo_OnBoxHandsOverTheWriterWithoutAPushgreen (the requiredgit …/systemctl restartsubstrings and the forbidden push/clone).Verify:
go test ./internal/fleetwire/...passes; the new test fails beforethe fleet.go edit and passes after.
Watch: the mv step must stay idempotent across a Retry (guard evaluated on
the box, not lost to a re-parse) — that is the Retry-faults-at-step-1 half of
the bug, not just the final
remote add.Pointers:
internal/fleetwire/fleet.go(PushConfigRepo,Target.sshArgs),internal/fleetwire/supply.go(bare-words idiom),internal/fleetwire/fleet_test.go(
flatten, the on-box test). Related: #2185, #2186, #2187, ADR 0102, ADR 0032.swarm-claim host=elitebook-distributed-server-03 run=63207
(automated multi-host claim — lowest live claim id works this ticket)
Fix on main as
a7475418(GOTCHAS #415, STATUS line): the three compound steps go to ssh as bare words; the on-box flip test refuses any multi-wordsh -cbody (3 hits on the old code, 0 after).go test ./internal/fleetwire/green. tu-ia's box was finished by hand at 13:41 (remote add origin, control-plane restart over/srv/idss/config); a matching app build is in progress for the Retry that runsawaitWholeComposition+Replicate.⏩ independent reviewer for #2188 — verdict
unauthenticatedreview JSON
close-report for #2188 — status
success✅ close-report gates passed — every claim verified against the pushed worker branch
sandcastle/worker/20261110-185205-b1cef5(pre-land — the host promotes it tomainonly after its post-run verify, #193/#283); issue closed.envelope
🚨 Reopened — a push-mode close did NOT land on
main(#283). close-report closed this issue against the pushed worker branch, but the host's post-run verify rolled the land back (the promote did not advance main (a no-op push to main)), soorigin/mainnever carried the commits (efa95565b00ae8cfc838abc182b073c78a6fc2d7). The gates-passed comment above is therefore NOT true ofmain. Reopening and relabellingready-for-sessionso the work is redone where it can land; the commits are parked on a rescue branch for triage (see this run's alarm).Close report — ruled by agent under ADR 0174 (veto anytime).
The code deliverable this ticket names — pass the on-box flip's three compound steps to ssh as bare words (no
sh -c), and add a test that refuses any ssh step of the shapesh -c <string with a space>— is already landed onmainand proven. It landed as commita74754184aa63e5a4bc37447a4a7b0ab5c357742(a prior push-mode standing session that pushed the fix tomainbut left this ticket open).What's on
main(HEADcbb50b54, ==origin/main):internal/fleetwire/fleet.go:256-264— themv,remote add origin … || set-url, and bare-repo-init steps now reach ssh as bare words the box's login shell runs directly, matching supply.go'smkdir -p … && …convention. TheFIRST the movecomment names #2188 and whysh -c "<compound>"is never used here.internal/fleetwire/fleet_test.go—TestPushConfigRepo_OnBoxHandsOverTheWriterWithoutAPushnow scans every recorded ssh step and errors on a multi-wordsh -cbody (3 hits on the old code, 0 now).STATUS.mdanddocs/GOTCHAS.md#415 updated in the same commit.Proof (this session, HEAD
cbb50b54):go test ./internal/fleetwire/ -run TestPushConfigRepo_OnBox→okgo test ./internal/fleetwire/(full package) →okmain).Scope note — the tu-ia operational Retry is not a deliverable of this code ticket. The brief records that on tu-ia the two remaining on-box steps were applied by hand at 13:41 so the control plane composes whole over
/srv/idss/config, and that the app-sideawaitWholeComposition+Replicate"still need a Retry on a fixed build". That Retry is a live-rail operation against the rented deploy — this standing session holds no door to drive it, and it is enabled (not blocked) by the now-landed fix. Flagging it as operational follow-up rather than claiming it done.Closing: the fleetwire bug named in the title is fixed, landed, and proven.
Verified on tu-ia: app 2026.11.3430 (
cbb50b54, carriesa7475418), Retry at 21:54 local 2026-11-10 — the on-box flip ran its bare-word steps,authority flipped to the control-plane APIat 22:01:05, the mirror replica pulled (clan-config at 22:01:04,idss/apex=tech.tuia.co), the box's/srv/idss/confighasorigin, control plane restarted over it, zero failed units. Hand-off opened (passkey + recovery kit). Closing.