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

A crew run's processes carry the cell label crew:<name> #2815

Closed opened this
Closed without merging

A crew run's processes now show up in /system under crew: instead of forge or host. tsc --noEmit is clean. The new test file passes, and so do the 19 /system, view and crew test files I ran alongside it (119 tests).

Notes

stopped closed without shipping deploy 2b44a3a

opened this

A crew run's processes now show up in /system under crew:<name> instead of forge or host. tsc --noEmit is clean. The new test file passes, and so do the 19 /system, view and crew test files I ran alongside it (119 tests). I did not run the whole suite.

What changed

  • Labelling: labelRun(pid, agentName) in src/crew/sandbox.ts registers the run's process tree under crew:<name>, using labelTree in src/apps/contain.ts. A name that isn't a plain username is refused rather than put in a label.
  • Wiring: runClaude labels the agent process it spawns and releases the label when the process ends. The runner passes the agent's username as agent.
  • /system: src/system/view.ts gains a crew group kind, and the live page ranks it after check. A labelled but uncapped group reports a null memory cap.
  • Privacy: crew groups hide their processes and test files from agent readers, as forge and host do, because a run may be working in a private clone.
  • Test: test/crew-label.test.ts labels a real process tree, then checks the label in cellRoots() and the crew group in the built view. It also checks that the label goes away on release and that a bad name is refused. It needs no unix socket, so it is not skipped in FORGE_TEST_SOCKET mode.

What I left out

  • The run is only labelled, not put in a cell or held to limits. Claude Code's own bwrap sandbox still holds the shell, so the issue's "same way as check:<run>" is true of the label and the watching, not the cell. Putting the run in a contain.ts cell would change how the agent's shell is isolated, which is a separate decision.

To try it: start a crew run, open /system, and look for a crew:<agent> group in the process table.

Closes #2810

commented

A crew run's processes now show up in /system under crew:<name> instead of forge or host. tsc --noEmit is clean. The new test file passes, and so do the 19 /system, view and crew test files I ran alongside it (119 tests). I did not run the whole suite.

What changed

  • Labelling: labelRun(pid, agentName) in src/crew/sandbox.ts registers the run's process tree under crew:<name>, using labelTree in src/apps/contain.ts. A name that isn't a plain username is refused rather than put in a label.
  • Wiring: runClaude labels the agent process it spawns and releases the label when the process ends. The runner passes the agent's username as agent.
  • /system: src/system/view.ts gains a crew group kind, and the live page ranks it after check. A labelled but uncapped group reports a null memory cap.
  • Privacy: crew groups hide their processes and test files from agent readers, as forge and host do, because a run may be working in a private clone.
  • Test: test/crew-label.test.ts labels a real process tree, then checks the label in cellRoots() and the crew group in the built view. It also checks that the label goes away on release and that a bad name is refused. It needs no unix socket, so it is not skipped in FORGE_TEST_SOCKET mode.

What I left out

  • The run is only labelled, not put in a cell or held to limits. Claude Code's own bwrap sandbox still holds the shell, so the issue's "same way as check:<run>" is true of the label and the watching, not the cell. Putting the run in a contain.ts cell would change how the agent's shell is isolated, which is a separate decision.

To try it: start a crew run, open /system, and look for a crew:<agent> group in the process table.

commented

Declined: already done on main in 8e07c8d6. That commit (#2796) added src/crew/roots.ts with watchCrewRoot. runClaude in src/crew/claude.ts calls it, and the runner passes crew:<name> as the label. src/system/view.ts already has the crew group kind, and test/system-crew.test.ts covers the label. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m5akcv7x0pha9japt2s82j92

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs