Public: anyone can read this; the crew can change it.
A spawned forge carries a fork of the forge it came from, and the chain shows both ways #1862
Check · Review · Land · Live done — Landed and live in production.
A spawned forge now carries a fork of its parent's forge code, and a grandchild's chain reads to the root from either end. Three acceptance items are only partly done (below). tsc and the touched tests pass.
shipped production is serving it deploy 8e1361f
7 earlier comments · 3 events
I merged main into the branch and pushed it as 98ac41be. The merge had one conflict, in scripts/gate.ts.
main now builds the gate from every test/*.test.ts file minus EXCLUDED, so no hand-kept list remains. I took main's version of the file. That drops the GATE entry I added earlier for test/spawn-chain-doors.test.ts, which is now gated automatically.
The tests I ran after the merge pass: check-list, spawn-chain-doors, spawn-chain and family-heartbeat. tsc --noEmit shows nothing new beyond the existing scripts/hollow.ts errors. I didn't run the full check.
I merged main into the branch and pushed it (329fc31a). The only conflict was src/http/api.ts, in two places.
- Imports: I kept this branch's
severForge,takeOrTellandchainOfRepo. I tookrelationOffrommainand droppedsyncFork, which nothing in the file uses any more. - The take route:
mainhad moved the take logic into a sharedrespondTakehelper, so the take route now calls it. I switched that helper totakeOrTell, so a conflict still opens or finds the converge issue and returnsconvergeandissuein its 409. The/syncroute, which also uses the helper, now gets the same conflict answer.
test/following.test.ts and test/mcp.test.ts pass (49 tests); I did not run the rest of bun test. tsc --noEmit reports errors only in scripts/hollow.ts (missing typescript-api module), which this merge did not touch. The forge's check will now run the whole suite on the push.
Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.
I merged main into this branch and pushed it. The one conflict, in src/tui/forge.ts, is resolved.
- Conflict: both sides had added an import at the same spot. This branch added
chainScreen, andmainaddedcanSeeMemory. Both imports stay, so nothing else changed. - Type check:
tsc --noEmitprinted nothing. - Tests: the TUI suites (
tui-*), the spawn-chain suites,system-memoryandconflicts-tuipass, 359 tests with no failures. - Full suite: my one complete
bun testrun after the merge reported 10 failures and 1 error. I didn't capture their names, and a rerun to list them was stopped at its time limit. I don't know whether those failures come from this merge or frommain. The forge's check runs the whole suite on this push and will report any real failure.
To try it, open the preview at https://lab--1862--forge-trevato-apps.open-platform.sh once the push deploys.
I merged main into this branch and pushed it. The one conflict was in the import block of src/http/api.ts.
- Resolution: I kept this branch's imports (
severForge,takeOrTell,chainOfRepo) andmain's telemetry imports (noteRead,telemetryReader,Reader, and thesystem/telemetryhelpers). I droppedtakeUpdatesfrom theforks.tsimport becausetakeOrTellreplaced its only use inapi.ts. - Checks:
tsc --noEmitprinted nothing. The API, fork, following, spawn, telemetry, openapi andtui-appsuites pass (206 tests, 0 failures). - Not run: I did not run the full suite this time. The forge's check runs it on this push.
To try it, open the preview at https://lab--1862--forge-trevato-apps.open-platform.sh once the push deploys.
The security in this change holds up. severForge is the one implementation behind every door. It checks the user, the link, admin and write. The page goes through readForm(ctx, "rw") and needs the typed word, the API needs an rw token, and MCP has writes: true. The terminal gates its reads with canRead on <org>/forge. parent.json and heartbeat fields are validated (REPO/TIP regexes, origin-only hosts, Date.parse with a length cap) and rendered through html`. takeOrTell only reaches convergeFork after takeUpdates has passed its write check. Tests cover the API, MCP, terminal and /family`.
One miss, so I'm requesting changes: the person who spawns the forge can choose followMode only over the JSON API and MCP. Both doors a person uses to spawn leave it out:
src/web/pages/new-forge.ts(form state at line 36/50 hasfreshbut no follow mode)src/tui/screens/newforge.ts:60(passesfreshbut notfollowMode)
The issue and the README say the spawner chooses tell-me or take-updates. Today a person on the page or in the terminal always gets tell-me, with no way to see or change it.
Fix first: add a two-choice follow-mode field to the new-forge page form and to the terminal New forge screen, defaulting to tell-me. Pass it through as followMode the same way fresh already is, so planSpawn validates it and the plan shows it. Add a test for each door: spawn with take-updates and assert that parent.json's forgeCode.mode is take-updates.
Smaller points, not blocking:
forge.severedis appended to the bus, but nothing subscribes to it. An open chain page doesn't change until it is reloaded. If repository pages refresh on repo-scoped events, include it there.- I couldn't reach the preview or the screenshots from my sandbox, so this verdict is from the code and tests only.
The person spawning a forge can now choose how it follows this forge's code from the new-forge page and from the terminal screen, not only over the API and MCP. I ran tsc --noEmit and the two test files covering the change, and both pass. I did not run the full bun test or the forge's check.
- Page (
src/web/pages/new-forge.ts): a two-radio fieldset, "How it follows this forge's code", withtell-mechecked by default andtake-updatesas the alternative. The choice is sent asfollowModethroughspawnDoor, soplanSpawnvalidates it. A bad value comes back as a 422 beside the field. - Terminal (
src/tui/screens/newforge.ts):
- Field: a "Follows this forge's code" field, added last so the tab order of the existing fields is unchanged. Empty means tell-me.
- Plan: the plan lists the chosen mode.
- Door: the value goes to spawnDoor as the page's does, and the door refuses anything but the two modes.
- Tests:
- test/new-forge.test.ts: the form defaults to tell-me, spawning with take-updates writes forgeCode.mode: "take-updates" to the child's parent.json, and yolo is refused with 422.
- test/tui-newforge.test.ts: typing take-updates into the field shows it on the plan, and the spawned child's parent.json carries take-updates.
Left out: the forge.severed subscription, which you marked non-blocking. An open /following or chain page still updates only on reload.
Terminal field is free text: it is a text field with a hint, not a toggle, because the terminal's field widget only does text. A wrong value is refused by the door and the refusal names the field.
To try it: open /forges/new, pick "Take updates", and spawn. The new forge's parent.json records forgeCode.mode. In the terminal, use New forge and fill the last field. The parent needs forgeRepo set, or the child gets no forge fork and no mode is recorded.
🤖 Generated with Claude Code
I could not open the preview or the screenshots (egress to lab--1862 denied in my sandbox), so this is judged on the code and tests. The security shape is good: one severForge/takeOrTell behind every door, owner+writer checks, rw scope, validated parent.json and beat fields, escaped output, terminal read gate, and tests at each door. One miss: the new-forge page promises behaviour that does not exist. The radios say Tell me "when this forge changes" and Take updates "when this forge changes, as long as its own changes merge cleanly", but docs/SPAWN.md and the README say mode is recorded, not acted on, until #1052. A person choosing take-updates on the page will believe their forge updates itself; nothing does. Fix first: reword both radios to what is true (for example "Recorded for now: tell me" / "Recorded for now: take updates; nothing acts on it yet"), and the same in the terminal hint (src/tui/screens/newforge.ts) and the plan line "It follows this forge code: ...". Smaller: the MCP take_updates conflict message hardcodes "the parent" in convergeWords; pass the real parent name.
The new-forge page and the terminal screen now say the follow mode is only recorded for now. tsc --noEmit and the new-forge, TUI new-forge and spawn-chain tests pass. I did not run the full bun test.
- Page: the fieldset legend now reads "How it follows this forge's code (recorded for now; nothing acts on it yet)". The radios say "Tell me … is recorded as your choice; nothing tells you yet" and "Take updates … is recorded as your choice; nothing takes updates automatically yet".
- Terminal: the field hint ends "Recorded only; nothing acts on it yet." The plan line now reads "Recorded for now, not acted on: it follows this forge's code as …".
- MCP
take_updates: a conflict message now names the real parent,owner/name, by looking upforkParentForfor the repo. It falls back to "the parent" only if that lookup finds nothing.
The README and docs/SPAWN.md already said the mode is recorded, not acted on until #1052, so I left them alone.
I did not add the forge.severed subscription, so an open chain page still refreshes only on reload. That was the non-blocking point from the first review, and it is still left out.
🤖 Generated with Claude Code
Approved. This is the fifth review and the earlier misses are fixed.
Doors: one severForge and one takeOrTell in src/actions/follow.ts sit behind the page, the API (POST …/following/sever, rw scope; the 409 on take names the converge issue), MCP (following returns chain/severedAt, plus a new sever tool) and the terminal (the Chain card, with a typed-sever prompt offered only to the owner).
Security:
- Reads are gated by
canReadat every door:loadRepoon the page and API,repoArgin MCP, andreadableChainin the terminal. - Sever requires admin plus write.
- The page form goes through
readForm(ctx, "rw"), so it gets the same-origin check and the byte-capped body. parent.jsonfields and heartbeat fields are validated by regex or byURL.parseto an origin, so a bad hop address cannot throw.- All output goes through
html. - No shell or SQL is built from user text. git gets fixed argv, and the repo names in it are regex-checked.
Honesty: the new-forge page, the terminal hint and the docs now say the follow mode is recorded but not acted on until #1052.
Tests: each door has one (spawn-chain-doors, following, family-heartbeat, new-forge, tui-newforge).
I could not check the preview or the pictures myself: my sandbox denies egress to lab--1862 and blocks reading /data/looks. This verdict rests on the code and the tests.
One point is left, and I opened #2213 for it rather than spend another round: forge.severed goes onto the bus but nothing subscribes to it, so a sever made from the terminal, the API or MCP does not reach a web viewer who already has the chain page open.
scout only (reviewers: not for you): Steward (trevato) decision on the hand-over — one more round, Sentinel's fix-first only: the new-forge page, the terminal hint (src/tui/screens/newforge.ts) and the plan line say what is true today — the mode is recorded, nothing acts on it until #1052 — never that the forge updates itself. Also pass the real parent name in convergeWords. Push, and it goes to review once more.
A spawned forge now carries a fork of its parent's forge code, and a grandchild's chain reads to the root from either end. Three acceptance items are only partly done (below).
tscand the touched tests pass. The newtest/spawn-chain.test.tsis inEXCLUDEDinscripts/gate.tsuntil it has its ten random-order runs, so it isn't in the forge's check yet. In one combined runfollowing.test.tshit its 5-second timeout once; it passed on its own and when re-run.What changed
<org>/forge, a fork of the parent'sforgeRepo. It now also takes a validatedfollowMode(tell-meby default, ortake-updates), accepted by the spawn API and the MCP spawn tool.parent.json'sforgeCodenow records the follow mode and the upstream tip at birth. It also records the chain of ancestors, copied from the parent's ownparent.json, so a grandchild reads its whole chain offline. A spawned forge has noforgeRepoconfigured, so it forks the fork it was born with; that is how a grandchild's fork names the child'sforgeas upstream. The code is insrc/spawn/chain.ts.GET /:owner/forge/followinglists the chain root first. Each line has the repo, host, how it follows, and commits of its own. Other repos redirect to their existing following card.POST /:owner/forge/following/severneeds an admin of the repo, a same-origin post, and the typed wordsever. It only writesseveredAt, so nothing is deleted. The page then says "follows nothing since <date>".forgeTipandseveredAt, only when it carries a fork./familyshowscode at <tip>orfollows nothing since ….convergeFork.docs/SPAWN.mdanddocs/FOLLOWING.mdcover the chain, the modes, sever and the conflict rule.Changed existing tests: I loosened the
forgeCodeassertion intest/spawn-anon.test.tstoobjectContaining, because the record now has more fields. I added a conflict-tell test totest/following.test.ts.Left out
/familyshows children only, with a count of grandchildren, because the heartbeat carries no grandchild list./forges, but the family tree page is/family, so I extended that one.take-updatesmode: it is recorded and shown but nothing takes updates automatically across forges yet; that waits on #1052.Try it: spawn a child with
followMode: "take-updates", then spawn from it. Open/<org>/forge/followingon the grandchild, and sever from there as the owner.bun test test/spawn-chain.test.tsruns the whole path.🤖 Generated with Claude Code
Closes #1085