Files
loki/scripts
68afac5ccb fix(deploy): the runner's dependencies ship with the code that imports them (#343)
fleetcrown-reindex has been dying every night at 03:30 on
`Cannot find module 'bip-kit'` — imported via src/lib/thoughts-content.ts.
The module is not the bug. The bug is that the deploy re-syncs the runner's
src/ on every ship and has never once shipped its manifest.

/opt/fleetcrown/runner/package.json is a snapshot from original provisioning:
31 dependencies, no bip-kit. Meanwhile src/ arrives fresh every deploy. So the
moment any file under src/ gains a new import, the runner breaks at its next
run — and the deploy reports green, because nothing checks.

- package.json, package-lock.json and vendor/ now sync alongside the code.
  vendor/ is part of the manifest, not an extra: package.json carries
  "@orangecat/sdk": "file:vendor/...tgz", so bumping that version without
  shipping the tarball fails the install for a path that exists only locally.
- When any of them actually changed, install on the box and mark the runner
  changed so the new deps reach a fresh process via the existing
  drain-then-restart (which waits for in-flight agents first).
- A failed install FAILS the deploy. Warn-and-continue is exactly how this
  stayed invisible for weeks: the runner was broken and the pipeline was green.

Two things this must not do, both found by testing against the real box:

- NOT `npm ci`, and NOT `--omit=dev`. tsx is a devDependency and it is the
  runner's own ExecStart (node_modules/.bin/tsx). `ci` deletes node_modules
  wholesale, so for the duration of the install the cloud builder's runtime
  does not exist; `--omit=dev` deletes it outright. Incremental install keeps
  the always-on executor runnable throughout.
- HUSKY=0 is required, not cosmetic. package.json's `prepare` runs husky, the
  runner dir is not a git repo, and without the opt-out npm exits 127 — which,
  given the failure is now fatal, would have broken every future deploy.

Verified with a REAL install in a scratch dir on the box, not a dry-run: a
dry-run passes `prepare` vacuously because husky is never installed, so it
cannot see the 127 at all. Full install returned exit 0, "HUSKY=0 skip
install", 864 packages, with both bip-kit and tsx present — so this resolves
the reindex crash and keeps the runner alive. Scratch dir removed; box disk
unchanged at 15G free.

The box is deliberately NOT patched by hand: three visitor-feedback runs are
executing on it right now, and this deploy remediates it through the drain
path instead.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 21:56:10 +00:00
..