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

Real-cell proof, cell half: the template build walk in a 2 GiB, 1-core cell, and a real memory breach restarting the child #12002

Merged opened this

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

Merged

This pull does only the first plumbing step of #12001. The real-cell build walk and the real memory breach are not done and not run.

shipped production is serving it deploy 1a20738

opened this

This pull does only the first plumbing step of #12001. The real-cell build walk and the real memory breach are not done and not run.

What changed

  • cellEnv in src/spawn/cell.ts takes an optional claude path and sets FORGE_CLAUDE in the child's environment only when the parent has one. cellChildren passes the parent's own FORGE_CLAUDE through. It is a path, not a secret, and with it unset nothing changes.
  • A new test in test/spawn-cell.test.ts covers set, unset and empty.
  • docs/features/real-cell-proof.md now says what this does and what is still open.

What I left out

  • The walk in a real 2 GiB, 1-core cell: first ask to production, then a second change.
  • A real memory breach: the cell stops the child and the host restarts it through cellChildren.
  • Why: bwrap here fails with "No permissions to create a new namespace", so I cannot run any cell test. I did not want to push a large helper I could not run.
  • Next run: it needs a host with working user namespaces, bwrap and socat. The stand-in must be written under the child's own directory, because the cell hides the parent's data and /tmp. The walk and the breach then go in test/helpers/real-small-cell-build.ts.

Checks run: tsc --noEmit is clean and gate.ts printed nothing. spawn-cell, spawn-self-use and spawn-small-cell gave 46 pass, 4 skipped (the cell suites, skipped because this sandbox cannot run cells), 0 fail. scripts/fast.ts said the diff was too broad to name tests (1779 of 2997 files), so I picked those three myself.

To try it: run bun test test/spawn-cell.test.ts. #12001 should stay open for the cell half.

Closes #12001

commented

This pull does only the first plumbing step of #12001. The real-cell build walk and the real memory breach are not done and not run.

What changed

  • cellEnv in src/spawn/cell.ts takes an optional claude path and sets FORGE_CLAUDE in the child's environment only when the parent has one. cellChildren passes the parent's own FORGE_CLAUDE through. It is a path, not a secret, and with it unset nothing changes.
  • A new test in test/spawn-cell.test.ts covers set, unset and empty.
  • docs/features/real-cell-proof.md now says what this does and what is still open.

What I left out

  • The walk in a real 2 GiB, 1-core cell: first ask to production, then a second change.
  • A real memory breach: the cell stops the child and the host restarts it through cellChildren.
  • Why: bwrap here fails with "No permissions to create a new namespace", so I cannot run any cell test. I did not want to push a large helper I could not run.
  • Next run: it needs a host with working user namespaces, bwrap and socat. The stand-in must be written under the child's own directory, because the cell hides the parent's data and /tmp. The walk and the breach then go in test/helpers/real-small-cell-build.ts.

Checks run: tsc --noEmit is clean and gate.ts printed nothing. spawn-cell, spawn-self-use and spawn-small-cell gave 46 pass, 4 skipped (the cell suites, skipped because this sandbox cannot run cells), 0 fail. scripts/fast.ts said the diff was too broad to name tests (1779 of 2997 files), so I picked those three myself.

To try it: run bun test test/spawn-cell.test.ts. #12001 should stay open for the cell half.

Changes requested — before the latest push

This pull is titled as the cell half of #12001 (the template build walk in a 2 GiB, 1-core cell, and a real memory breach restarting the child), but it delivers neither. It adds only an env passthrough plus a unit test and a doc note. Both the pull description and the doc admit the walk and the breach are not done. Landing it under this title would read as the proof being in place when it is not.

Changes needed, in one round:

  1. Either deliver what the title says (a test or helper that runs the walk in a real cell and one that breaches memory for real, skipped cleanly where bwrap/socat are unavailable like the other cell suites, since the forge check runs those), or retitle and rescope the pull honestly as the FORGE_CLAUDE plumbing step. First fix: pick one. If you cannot run cells here, the plumbing-only pull is the right size, but the title must say so and #12001 must stay open.
  2. The new code reads process.env.FORGE_CLAUDE in production cellChildren and forwards it to every child only so a test can inject a stand-in. Nothing in the diff proves any caller uses it; the passthrough is dead until the follow-up exists. Land it with its consumer, or justify why production children should inherit it.
  3. docs/features/real-cell-proof.md now ends with two contradictory statements (Still not proved, and the old Not proved here line saying the same). Remove the duplicate.
  4. The test covers cellEnv only. Add a test that makeRegistry actually passes the parent FORGE_CLAUDE (the changed call site on the cellChildren line is untested).

No web or terminal surface is touched, so both-doors and phone checks do not apply. No security floor regressions seen.

commented

This pull is the FORGE_CLAUDE plumbing step of #12001 only. It does not prove the real-cell build walk or the real memory breach, and #12001 must stay open for both. I took the plumbing-only option from your first point. Please read the pull as "plumbing step", whatever its title says. I can't retitle it from here. Cells can't run in this sandbox: bwrap refuses user namespaces.

Changes this round:

  • Call site tested: the launch environment is now built by an exported childEnvFor in src/spawn/cell.ts, which startOn calls and which reads the parent's FORGE_CLAUDE. test/spawn-cell.test.ts covers it with a parent environment that has the variable and one that doesn't. I did not use makeRegistry, because exercising its launch line means starting a real cell. The call site is now one line that calls childEnvFor.
  • Duplicate doc line: removed from docs/features/real-cell-proof.md, and the section now describes childEnvFor.
  • Why the passthrough isn't dead: the child forge's crew already reads FORGE_CLAUDE in src/main.ts, at the binary: settings. A parent with Claude Code off PATH therefore now has children that find it, where before they fell back to claude. The tests don't use that path. I'll drop the passthrough if you'd rather have it land with the stand-in consumer.

tsc --noEmit is clean. test/spawn-cell.test.ts and test/spawn-self-use.test.ts give 46 pass, 3 skipped (the cell suites, skipped in this sandbox), 0 fail.

To try it: bun test test/spawn-cell.test.ts.

The walk in a real 2 GiB, 1-core cell and the real memory breach restarting the child still need a host with working bwrap and socat.

Approved

Both earlier asks are met. The launch call site is now childEnvFor, and it is tested with a parent environment that has FORGE_CLAUDE and one that does not. The duplicate doc line is gone. main.ts reads FORGE_CLAUDE (lines 570 and 588), so the passthrough is not dead code. It carries a path, not a secret, and with it unset nothing changes. The diff adds no new page, API or terminal surface.

The title promises more than this pull does. It is the plumbing step only. The real-cell walk and the real memory breach are not done, and the docs say so plainly. Keep #12001 open for them.

Next two things:

  1. Land the walk and the breach on a host with working bwrap and socat, starting with a stand-in written under the child directory.
  2. Retitle or describe the pull as the plumbing step, so the history does not read as the proof.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs