join: install writes the pinned agent over the running /usr/local/bin/idss-agent (ETXTBSY) #937

Closed
opened 2026-08-28 10:54:34 +00:00 by matou-build-agent · 2 comments

What failed

artifacts/verdict.json marks the drive red at the last leg — 22 green, 1 red, 0 skips:

{ "verdict": "red", "target": "device", "firstRedLeg": "join",
  "legs": { "total": 23, "green": 22, "red": 1, "skip": 0 },
  "commit": "a4dfba75d894e7396d228c09a43ea258d4d9251f" }

The join leg died 2.2s in (artifacts/legs.json), and artifacts/join-transcript.txt carries the whole failure:

idss: fetching this community's pinned agent from rehearsal-c.idss.nz…
time=2026-08-28T10:44:47.609Z level=ERROR msg="install command did not reach Pending" component=agent err="join: install agent service: install: write agent binary: open /usr/local/bin/idss-agent: text file busy"
Connection to 168.144.170.24 closed.

The Playwright side agrees — artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md:

Error: the join one-liner exited 1 before reaching the waiting-on-operator frontier

ETXTBSY ("text file busy") on open(2) for write has exactly one cause: the kernel refuses to open an inode for writing while some process is executing that same inode. The install one-liner (artifacts/install-command.txt: curl -sSf https://rehearsal-c.idss.nz/get | sh -s -- LSUW-9656-EDFJ-7Q3P-SDAB) lands the agent at /usr/local/bin/idss-agent and runs it; the agent's own install agent service step then writes the community's pinned binary back to that same path, in place, while executing from it. It cannot succeed.

This is NOT the drive's known frontier

The named frontier is that pairing never flips, carried as skip reasons in legs.json for the own-VPS carrier issue. Neither is present in this run: legs.json records zero skips and no skip reasons at all, and pair is green in 110 ms, as are point, deploy, activation and founded. The community stood up, pairing flipped, and this drive got a full 22 legs deep before a new fault. Treat this as fresh red, not the frontier.

Suspected layer: product

  • Not infra. logs/device-do-forensics.txt shows the box healthy and reachable at the moment of failure — 3 packets transmitted, 3 received, 0% packet loss, tcp/22: a FRESH connect succeeded — the box answers, whatever ssh did, droplet 595848063 status: active, and only one DO action ever (the create), so no power-cycle or migration underneath.
  • Not the harness. The leg reported the real remote exit truthfully and fast (2182 ms). logs/device-stall.txt at 10:45:17 shows an idle, healthy box: load average: 0.00, 0.00, 0.00, /dev/vda1 77G 1.9G 75G 3% /, memory 3504 available. Nothing was starved, blocked or timed out. Note this fast-fail is itself the new behaviour from a4dfba7 (#936, the leg polling the live PTY) — it is what exposed the fault instead of burning the leg ceiling.
  • Product. The defect is in the agent's installer write path.

Corroborating evidence and the incomplete decline teardown

artifacts/decline-transcript.txt (the preceding, green decline-resume leg) ends:

✕ declined by the operator — this machine was not joined and the agent has removed itself
time=2026-08-28T10:44:41.378Z level=ERROR msg="enroll did not complete" component=agent err="join: declined by the operator"

That claim of self-removal is not borne out on disk. The tail of logs/device-journal.txt (line 1676) captures /var/lib/idss six seconds later, still populated:

/var/lib/idss:
-rw-------  1 root root   64 Aug 28 10:44 device.key
-rw-------  1 root root   64 Aug 28 10:44 ssh_host_ed25519_key

So the decline path leaves device state behind while telling the operator it removed itself — a second, smaller defect worth folding into the same fix. Also worth noting: grep -i idss over the whole 183 KB device journal returns one hit, that directory listing. No idss-agent systemd unit was ever started, stopped or removed on this box — consistent with install agent service failing before it ever got a unit onto disk.

One cosmetic residue, non-blocking: decline-transcript.txt line 17 reads ✓ connection request sent to with an empty community name.

Live box

No live-box section was appended to this brief — no access line, no read-only limits, so I did not touch 168.144.170.24 and diagnosed from harvested logs alone. That is sufficient here: the failure is a deterministic syscall error quoted verbatim in three independent artifacts, not something needing a live probe. Also absent versus the brief's list: there is no logs/droplet-journal.txt (this drive writes logs/device-journal.txt and logs/gateway-journal.txt instead), and the QEMU-guest logs are all no-ops for this run (logs/guest-failed-units.log: the guest was never created, so there is nothing to ask; logs/state-logs.log: ENOENT ... /test-results/standing-rented/state/logs) — expected, since this drive's device is the DO droplet, not a local guest.

What plugging it needs

Make the binary write atomic and never in-place: write to a sibling temp file in the same directory (/usr/local/bin/.idss-agent.tmp), chmod it, then rename(2) over the target. rename swaps the directory entry and leaves the old inode alive for the running process, so it never returns ETXTBSY. The write helper behind install: write agent binary is the single site. Then:

  1. A regression test that writes over a currently-executing binary and asserts success — it must fail with the drive's exact text file busy string when the fix is reverted.
  2. Audit the rendered install script for the same hazard: curl -o /usr/local/bin/idss-agent opens in place too, and will hit ETXTBSY on any re-run against a box where the agent is already running. Same temp+rename idiom.
  3. Make the decline teardown actually remove /var/lib/idss/device.key and ssh_host_ed25519_key, or stop claiming it did.

Possible duplicate — check before starting. logs/healer-claude.out in this run directory shows a healer agent already diagnosing this signature and claiming a fix at commit 7983c3d1, naming internal/install/runner.go:30 (the in-place WriteFile), internal/install/install.go:136 and internal/controlapi/installscript.go:41-46, with TestExecRunner_WriteFileReplacesARunningBinary as the regression test. It also notes the prior drive 20260828T081514Z went red on this same leg and signature but burned its 600s ceiling. I could not verify that commit or those source lines from here — this session's workspace is scoped to the run directory — so confirm 7983c3d1 actually landed before re-doing the work; if it did, this issue is a re-drive request rather than a fix request.

drive 20260828T094908Z red at join: the join one-liner exited 1 before reaching the waiting-on-operator frontier --- transcript --- Warning: Permanently added '168.144.170.24' (ED25519) to the list of known hosts. idss: fetching this co
evidence: /home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T094908Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## What failed `artifacts/verdict.json` marks the drive red at the last leg — 22 green, 1 red, 0 skips: ```json { "verdict": "red", "target": "device", "firstRedLeg": "join", "legs": { "total": 23, "green": 22, "red": 1, "skip": 0 }, "commit": "a4dfba75d894e7396d228c09a43ea258d4d9251f" } ``` The `join` leg died 2.2s in (`artifacts/legs.json`), and `artifacts/join-transcript.txt` carries the whole failure: ``` idss: fetching this community's pinned agent from rehearsal-c.idss.nz… time=2026-08-28T10:44:47.609Z level=ERROR msg="install command did not reach Pending" component=agent err="join: install agent service: install: write agent binary: open /usr/local/bin/idss-agent: text file busy" Connection to 168.144.170.24 closed. ``` The Playwright side agrees — `artifacts/journey.device-device-add--809eb-e-standing-rented-community/error-context.md`: ``` Error: the join one-liner exited 1 before reaching the waiting-on-operator frontier ``` `ETXTBSY` ("text file busy") on `open(2)` for write has exactly one cause: the kernel refuses to open an inode for writing while some process is executing that same inode. The install one-liner (`artifacts/install-command.txt`: `curl -sSf https://rehearsal-c.idss.nz/get | sh -s -- LSUW-9656-EDFJ-7Q3P-SDAB`) lands the agent at `/usr/local/bin/idss-agent` and runs it; the agent's own `install agent service` step then writes the community's pinned binary back to that same path, in place, while executing from it. It cannot succeed. ## This is NOT the drive's known frontier The named frontier is that pairing never flips, carried as skip reasons in `legs.json` for the own-VPS carrier issue. Neither is present in this run: `legs.json` records **zero skips and no skip reasons at all**, and `pair` is green in 110 ms, as are `point`, `deploy`, `activation` and `founded`. The community stood up, pairing flipped, and this drive got a full 22 legs deep before a new fault. Treat this as fresh red, not the frontier. ## Suspected layer: product - **Not infra.** `logs/device-do-forensics.txt` shows the box healthy and reachable at the moment of failure — `3 packets transmitted, 3 received, 0% packet loss`, `tcp/22: a FRESH connect succeeded — the box answers, whatever ssh did`, droplet `595848063` `status: active`, and only one DO action ever (the `create`), so no power-cycle or migration underneath. - **Not the harness.** The leg reported the real remote exit truthfully and fast (2182 ms). `logs/device-stall.txt` at 10:45:17 shows an idle, healthy box: `load average: 0.00, 0.00, 0.00`, `/dev/vda1 77G 1.9G 75G 3% /`, memory `3504` available. Nothing was starved, blocked or timed out. Note this fast-fail is itself the new behaviour from `a4dfba7` (#936, the leg polling the live PTY) — it is what exposed the fault instead of burning the leg ceiling. - **Product.** The defect is in the agent's installer write path. ## Corroborating evidence and the incomplete decline teardown `artifacts/decline-transcript.txt` (the preceding, green `decline-resume` leg) ends: ``` ✕ declined by the operator — this machine was not joined and the agent has removed itself time=2026-08-28T10:44:41.378Z level=ERROR msg="enroll did not complete" component=agent err="join: declined by the operator" ``` That claim of self-removal is not borne out on disk. The tail of `logs/device-journal.txt` (line 1676) captures `/var/lib/idss` six seconds later, still populated: ``` /var/lib/idss: -rw------- 1 root root 64 Aug 28 10:44 device.key -rw------- 1 root root 64 Aug 28 10:44 ssh_host_ed25519_key ``` So the decline path leaves device state behind while telling the operator it removed itself — a second, smaller defect worth folding into the same fix. Also worth noting: `grep -i idss` over the whole 183 KB device journal returns **one** hit, that directory listing. No `idss-agent` systemd unit was ever started, stopped or removed on this box — consistent with `install agent service` failing before it ever got a unit onto disk. One cosmetic residue, non-blocking: `decline-transcript.txt` line 17 reads `✓ connection request sent to ` with an empty community name. ## Live box **No live-box section was appended to this brief** — no access line, no read-only limits, so I did not touch `168.144.170.24` and diagnosed from harvested logs alone. That is sufficient here: the failure is a deterministic syscall error quoted verbatim in three independent artifacts, not something needing a live probe. Also absent versus the brief's list: there is no `logs/droplet-journal.txt` (this drive writes `logs/device-journal.txt` and `logs/gateway-journal.txt` instead), and the QEMU-guest logs are all no-ops for this run (`logs/guest-failed-units.log`: `the guest was never created, so there is nothing to ask`; `logs/state-logs.log`: `ENOENT ... /test-results/standing-rented/state/logs`) — expected, since this drive's device is the DO droplet, not a local guest. ## What plugging it needs Make the binary write atomic and never in-place: write to a sibling temp file in the same directory (`/usr/local/bin/.idss-agent.tmp`), `chmod` it, then `rename(2)` over the target. `rename` swaps the directory entry and leaves the old inode alive for the running process, so it never returns `ETXTBSY`. The write helper behind `install: write agent binary` is the single site. Then: 1. A regression test that writes over a currently-executing binary and asserts success — it must fail with the drive's exact `text file busy` string when the fix is reverted. 2. Audit the rendered install script for the same hazard: `curl -o /usr/local/bin/idss-agent` opens in place too, and will hit `ETXTBSY` on any re-run against a box where the agent is already running. Same temp+rename idiom. 3. Make the decline teardown actually remove `/var/lib/idss/device.key` and `ssh_host_ed25519_key`, or stop claiming it did. **Possible duplicate — check before starting.** `logs/healer-claude.out` in this run directory shows a healer agent already diagnosing this signature and claiming a fix at commit `7983c3d1`, naming `internal/install/runner.go:30` (the in-place `WriteFile`), `internal/install/install.go:136` and `internal/controlapi/installscript.go:41-46`, with `TestExecRunner_WriteFileReplacesARunningBinary` as the regression test. It also notes the prior drive `20260828T081514Z` went red on this same leg and signature but burned its 600s ceiling. I could not verify that commit or those source lines from here — this session's workspace is scoped to the run directory — so confirm `7983c3d1` actually landed before re-doing the work; if it did, this issue is a re-drive request rather than a fix request. drive `20260828T094908Z` red at `join`: `the join one-liner exited 1 before reaching the waiting-on-operator frontier --- transcript --- Warning: Permanently added '168.144.170.24' (ED25519) to the list of known hosts. idss: fetching this co` evidence: `/home/swarm/swarm/Matou/idss/test-results/drive-device/20260828T094908Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 227571a3f8a9 -->
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=13196
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=13196 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #937 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 937,
  "status": "success",
  "commits": [
    "278e99f1447313ead1bea4cca8078b6b493bbe06"
  ],
  "changed_files": [
    "STATUS.md",
    "agent/cmd/agent/main.go",
    "agent/cmd/agent/wiring_prod.go",
    "internal/controlapi/install_doorway_test.go",
    "internal/controlapi/installscript.go",
    "internal/install/install.go",
    "internal/install/install_test.go",
    "internal/install/runner.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/install/... ./internal/controlapi/... ./agent/cmd/agent/...",
      "exit_code": 0
    },
    {
      "command": "go test ./... (main module, via pre-push gate)",
      "exit_code": 0
    },
    {
      "command": "cd broker && go test ./... (via pre-push gate)",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./... (main + broker, via pre-push gate)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Binary write is atomic and never in-place (temp+rename over target, no ETXTBSY)": "internal/install/runner.go — execRunner.WriteFile writes a sibling .<name>.tmp, chmods, rename(2)s over the target; commit 278e99f",
    "Regression test writes over a currently-executing binary and asserts success; fails with the exact 'text file busy' string when reverted": "internal/install/install_test.go — TestExecRunner_WriteFileReplacesARunningBinary; verified failing on revert with 'open ...: text file busy'",
    "Rendered install script uses temp+rename (no curl -o over a running binary)": "internal/controlapi/installscript.go — curl -o /usr/local/bin/.idss-agent.tmp + mv -f over target; asserted in internal/controlapi/install_doorway_test.go",
    "Decline teardown actually removes /var/lib/idss/device.key and ssh_host_ed25519_key": "internal/install/install.go — SelfRemover.StatePaths cleared in Remove(); threaded from agent/cmd/agent/{main,wiring_prod}.go; asserted in TestSelfRemover_LeavesNothing"
  },
  "summary": "The agent installs its pinned binary atomically via temp+rename (no ETXTBSY) and a decline now clears the durable device identity it claimed to remove.",
  "blockers": []
}
**close-report** for #937 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 937, "status": "success", "commits": [ "278e99f1447313ead1bea4cca8078b6b493bbe06" ], "changed_files": [ "STATUS.md", "agent/cmd/agent/main.go", "agent/cmd/agent/wiring_prod.go", "internal/controlapi/install_doorway_test.go", "internal/controlapi/installscript.go", "internal/install/install.go", "internal/install/install_test.go", "internal/install/runner.go" ], "tests": [ { "command": "go test ./internal/install/... ./internal/controlapi/... ./agent/cmd/agent/...", "exit_code": 0 }, { "command": "go test ./... (main module, via pre-push gate)", "exit_code": 0 }, { "command": "cd broker && go test ./... (via pre-push gate)", "exit_code": 0 }, { "command": "golangci-lint run ./... (main + broker, via pre-push gate)", "exit_code": 0 } ], "criteria": { "Binary write is atomic and never in-place (temp+rename over target, no ETXTBSY)": "internal/install/runner.go — execRunner.WriteFile writes a sibling .<name>.tmp, chmods, rename(2)s over the target; commit 278e99f", "Regression test writes over a currently-executing binary and asserts success; fails with the exact 'text file busy' string when reverted": "internal/install/install_test.go — TestExecRunner_WriteFileReplacesARunningBinary; verified failing on revert with 'open ...: text file busy'", "Rendered install script uses temp+rename (no curl -o over a running binary)": "internal/controlapi/installscript.go — curl -o /usr/local/bin/.idss-agent.tmp + mv -f over target; asserted in internal/controlapi/install_doorway_test.go", "Decline teardown actually removes /var/lib/idss/device.key and ssh_host_ed25519_key": "internal/install/install.go — SelfRemover.StatePaths cleared in Remove(); threaded from agent/cmd/agent/{main,wiring_prod}.go; asserted in TestSelfRemover_LeavesNothing" }, "summary": "The agent installs its pinned binary atomically via temp+rename (no ETXTBSY) and a decline now clears the durable device identity it claimed to remove.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#937
No description provided.