Repository navigation
Commit 045c4f9
fix(t3x): derive and verify the autobuild agent's PATH, and correct the runbook interval (#41)
Two traps from #41 that bite before any of the install-race work, both fork-owned
(`scripts/t3x/**`, `docs/t3x/**`), zero upstream seam.
## 1. Regenerating the plist would silently downgrade the toolchain
`--print-launchd` hardcoded its PATH. The live agent's is wider — it carries the
fnm node directory, which the generator never knew about — so anyone following
the runbook to regenerate the agent would quietly hand it a different PATH than
the one that has been building successfully.
`c33e5a361` already back-ported the `~/.cargo/bin` half of that gap, and that is
the half with a loud failure: no cargo means `spawn cargo ENOENT` every tick,
backing off forever. The node half is worse precisely because it is quiet. On
this machine the hardcoded list still resolves node — to Homebrew's, which is
v26.7.0, while `package.json`'s `engines.node` is `^24.13.1`. The build does not
break. It succeeds against a toolchain nobody chose, and installs the result.
So the PATH is now derived and then proved:
- `derive_agent_path` resolves node, pnpm, cargo and git, following each symlink
to a stable directory. That matters: a version manager's shim lives in a
per-shell directory (fnm's is `~/.local/state/fnm_multishells/<pid>_<stamp>/bin`)
that is deleted when the shell exits, so a shim path baked into a plist is a
PATH entry that stops existing. A directory is added only when nothing already
on the list provides that tool — which is what keeps corepack's `pnpm`, whose
symlink lands in `.../corepack/dist` rather than a bin dir, from contributing
an ephemeral entry: the node installation's own bin holds the shim and is
already there.
- `verify_agent_path` then runs each tool from an EMPTY environment, because that
is what launchd gives the job — a check that inherits this shell's PATH proves
nothing. It refuses to emit (exit 2) if a tool is unreachable, or if node's
major does not match `engines.node`. `--force` emits anyway.
On this machine the derived PATH matches the live agent's entry-for-entry.
`--diff-launchd` is the missing feedback loop: launchd keeps the copy it was
bootstrapped with, so a fix to the emitter never reaches a running agent and
nothing reports the gap. It compares settings and ignores comments, so the notes
hand-written into the live plist do not read as differences.
Also emits `COREPACK_ENABLE_DOWNLOAD_PROMPT=0`, which the live plist has and the
generator did not: corepack provides pnpm here against a pinned `packageManager`,
and with no tty a download prompt has nobody to answer it.
## 2. The runbook documented a 2-minute loop
`--interval`'s default was written as `60` (it is `43200`), the TL;DR said "every
60s", and all three examples passed `--interval 120`. Following them installs a
two-minute quit/replace/relaunch cycle on an app hosting live Claude sessions and
serving `:3773`. Corrected, and the install examples now show the flags the agent
actually runs with, including `--ref origin/main`.
Verified under /bin/bash 3.2 (what the plist invokes, and where expanding an
empty array under `set -u` is an error): clean emit with zero stderr, `plutil
-lint` OK, both refusal paths exit 2 emitting nothing, `--force` overrides, and
`--diff-launchd` reports only the differences that are real.
Refs #41
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>1 parent 1a223dc commit 045c4f9
2 files changed
Lines changed: 272 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
| |||
197 | 205 | | |
198 | 206 | | |
199 | 207 | | |
200 | | - | |
| 208 | + | |
| 209 | + | |
201 | 210 | | |
202 | 211 | | |
203 | 212 | | |
204 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
205 | 219 | | |
206 | 220 | | |
207 | 221 | | |
| |||
222 | 236 | | |
223 | 237 | | |
224 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
225 | 271 | | |
226 | 272 | | |
227 | 273 | | |
228 | 274 | | |
229 | 275 | | |
| 276 | + | |
| 277 | + | |
230 | 278 | | |
231 | | - | |
| 279 | + | |
| 280 | + | |
232 | 281 | | |
233 | 282 | | |
234 | 283 | | |
| |||
268 | 317 | | |
269 | 318 | | |
270 | 319 | | |
271 | | - | |
| 320 | + | |
272 | 321 | | |
273 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
274 | 326 | | |
275 | 327 | | |
276 | 328 | | |
| |||
0 commit comments