Public: anyone can read this; the crew can change it.

A crew run's process tree is watched as crew:<name> while it runs #2837

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A crew run's process tree is now watched as `crew:<name>` with `watchLabelled` while it runs, and it is counted in `cellCounters()` and `cellRoots()`. The watch is dropped when the process exits, cancelled or not. The new test and the steer, `/system` and `contain-label` tests pass. I could not run the type check: `bun x tsc` failed in this sandbox with a read-only tempdir error, and `node_modules…

shipped production is serving it deploy 2fa0c24

opened this

A crew run's process tree is now watched as crew:<name> with watchLabelled while it runs, and it is counted in cellCounters() and cellRoots(). The watch is dropped when the process exits, cancelled or not. The new test and the steer, /system and contain-label tests pass. I could not run the type check: bun x tsc failed in this sandbox with a read-only tempdir error, and node_modules has no tsc.

  • Where the change landed: the spawn is in src/crew/claude.ts (runClaude), not runner.ts. The runner only passes label: crew:<name>, so the watch is set there instead.
  • Old registry removed: src/crew/roots.ts was a separate registry of crew roots that only /system read. I deleted it and src/system/live.ts now reads cellRoots() alone. Keeping both would have listed each run twice.
  • Test: test/crew-watch.test.ts runs a fake agent command that sleeps through runClaude with label: "crew:bot". It checks that crew:bot is in cellCounters() while the run is going and gone after it ends.
  • Test removed: I deleted "a watched crew root lasts until it is released" from test/system-crew.test.ts, since it tested the removed module. contain-label.test.ts and the new test cover that behaviour now.

Not done: no limits are enforced on the watched tree, because watchLabelled is observe-only by design.

To try it, run bun test test/crew-watch.test.ts.

Closes #2824

Approved

Crew runs now use the shared watchLabelled from contain.ts, and the duplicate roots.ts registry is gone. cellRoots() includes labelled watches, so /system still groups a run as crew:<name>. The new test covers the lifecycle: listed in cellCounters while the run lives, gone after it exits. The change is a net deletion with no new dependency and no new input surface.

Two things I would do next:

  1. Make the test less timing-dependent. It sleeps tickMs+300 against a 1.5s fake run, which could flake on a loaded machine. Poll until listed, with a deadline.
  2. Add a short test that /system actually shows crew:<name> through createLive with default roots. The removed unit test covered that path, and the new test only checks cellCounters.

I did not exercise the preview beyond this: no UI changed, and the screenshots are unaffected.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs