Public: anyone can read this; the crew can change it.
A forge made for a client can be sent again: a fresh link replaces the old one and the old one stops working #13181
Check · Review · Land · Live done — Landed and live in production.
A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (/forges/:name/claim-link, reissueClaimFor, MCP claimlink, the dead-link page), so I added the preview step and the receipt around it.
shipped production is serving it deploy 59903fa
5 earlier comments · 1 event
A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (/forges/:name/claim-link, reissueClaimFor, MCP claim_link, the dead-link page), so I added the preview step and the receipt around it.
What changed
- Preview:
previewReissueinsrc/actions/spawn.tsis read-only. It says who the link is for and that the earlier link stops at once. A claimed forge is refused, and it uses the same who-may-send gate as the reissue. - Client list: the row button is now Send a new link and opens the preview page. Only confirming there issues the link. Before, the row posted straight away.
- API and MCP:
POST /api/v1/forges/:name/claim-linkwith{ "dryRun": true }returns the preview. MCPclaim_linkwithoutrevealreturns it too, so no new tool and noactionvalue was added. Themcp-sizetest passes. - Receipt: the
forge.claim_reissuedevent now also names whom the link was for and what it replaced. - Tests:
test/forge-link-reissue.test.tscovers the preview changing nothing, the old link answering the dead-link sentence, the receipt row, API and MCP reissue, and a cross-origin post being refused.test/client-states.test.tspins the row button as a link. - Docs:
docs/features/forge-link-states.mddescribes the new flow.
Not done
- No new
access_link.tschange: it holds the personal sign-in links for a person's account, not forge claim links. A forge's link is oneclaimrow inside the child forge, and minting a new one replaces the old in one write. - Old-link expiry sentence unchanged: it was already in place and tested, so I left it.
- Terminal screen:
claim_link.tsstill reissues directly with no preview.
Checks and push
- Passed:
bun scripts/gate.ts,bun x tsc --noEmit,bun scripts/design-lint.ts, and the tests covering this change. - Pre-push hook: it asked for a
Try:commit, so there is an empty one. - No-look line: the gate wanted a
Looks:orNo look:line for thesrc/webchange. I usedNo look:because the page change is small.
Try it: open /forges, press Send a new link on an unclaimed forge, read the preview, and confirm. The link is shown once and the earlier one answers "this link does not work any more".
🤖 Generated with Claude Code
Fixed the two client-list failures and pushed. The first-view budget test is still failing, and I did not touch it.
- Cause: The earlier commit on this pull turned the client list's "Send a fresh link" button into a link to the preview page,
/forges/<name>/claim-link. Two assertions intest/client-list.test.tsstill looked for the old text and the old POST form on the row. - Fix: I changed those assertions to expect "Send a new link" and
href="/forges/maria/claim-link". The rest of that test still posts to the endpoint, since the preview page's confirm form uses the same POST route. - Checked here:
test/client-list.test.tsandtest/forge-link-reissue.test.tsboth pass (16 tests), andbun x tsc --noEmitis clean. I did not runscripts/gate.tsor the rest of the suite; the forge runs the full check on this push. - Not fixed: "each page stays inside its first-view budget" lives in
test/attention.test.ts. The forge's log reports it red on main too, with the same tests, and not counted against this pull. I did not run it here. - Egress lines in the log: The
maria--forge.test:443refusals come from the test children and need no change toforge.json.
The gate's 100-column comment rule failed on the merge of this pull into the newer main, so I merged main into the branch and rewrapped the comments. I pushed that as e05ae7987.
- Why it was missed: the gate passed on my branch alone and only failed once the new main was merged in.
- Rewrapped files:
bun scripts/gate.ts --fixrewrapped comments insrc/actions/spawn.ts,src/http/api/forges.ts,src/spawn/door.tsandsrc/web/pages/forges.ts. The gate now exits 0. - Checked here:
bun x tsc --noEmitis clean, and 25 tests pass acrosstest/client-list.test.ts,test/forge-link-reissue.test.tsandtest/client-states.test.ts. - Not run: the full suite, which the forge runs on the push.
test/attention.test.tswas red on main earlier and I left it alone.
The pull is still what the first two commits described. A forge's link can be sent again from the client list: the admin sees who it is for and what stops, confirms, and the new link replaces the old one and is shown once. This push changes only comment wrapping and merges main in.
The web, API and MCP preview-then-confirm flow is sound, and the old link dying is tested. Changes needed, in one round:
- FIRST: the terminal door is missing. The issue asks for the action on the client list, and AGENTS.md says what a person does on the page they can do in the terminal. The terminal client-list screen in src/tui/ has no Send a new link action with the same preview and confirm, and the author notes it was left out. Add it, gated like the page (admin or the forge owner only), and test it.
- Tests do not cover the gate: add cases for a non-admin non-owner getting forbidden on the preview page, the API dryRun and the MCP preview, and for a claimed forge being refused with the claimed message. A dryRun that leaked the for name to a stranger would pass today.
- src/web/pages/forges.ts forgeLinkForm:
seen.status === 200 ? 200 : seen.statusis just seen.status; thesaysfallback chain is also loose. Simplify. - src/actions/spawn.ts reissueClaim: the event payload
replaced: "the earlier link"is a constant that carries no information, so drop it or record something real. The extra childNamed read after the write should reuse the child read in the permission step. - docs/features/forge-link-states.md still says the stale-row button posts to claim-link the same as Send a fresh link; it now opens the preview. Fix that paragraph so it is not contradicted. Also add the terminal how-to there once item 1 lands.
- Preview GET on /forges/:name/claim-link opens the child database each time. Confirm this is cheap enough, or rate-limit it, since it is a read anyone signed in can trigger up to the permission check.
Box 1 note: it points at src/core/access_link.ts, but the author reasonably chose the existing reissue path, which is fine.
Sending a forge's link again now works from the terminal as well, with the same preview and confirm as the page, API and MCP. I ran the tests that touch this change and they pass, but not the whole suite. scripts/fast.ts named 2,331 files, about 197 minutes of tests, so I picked the covering ones by hand.
What changed, by review item
- Terminal door.
- src/tui/screens/claim_link.ts has a shared offerNewLink: it runs previewDoor (who it is for, what stops working), then a confirm dialog "Send a new link" / "Keep the old one", and only the confirm calls reissueDoor.
- Forges you sent has a new n key (admin only), with a picker of forges not yet claimed. The palette entry "A fresh claim link for a forge I sent" now goes through the same preview and confirm, so a forge's own sender can use it too.
- The gate is the same as the page, because both go through previewDoor/reissueDoor: admin or the account that sent the forge.
- Gate tests in
test/forge-link-reissue.test.ts:
- A signed-in person who is neither admin nor sender gets 403 on the preview page, on API dryRun, and on the MCP preview. None of the responses contains the for name.
- A claimed forge gets the "already claimed" message on the preview page and the API dryRun, and the API send is refused.
- A terminal test covers pick, preview, confirm, and the old link dying; it also checks the old link still works before the confirm.
- The MCP preview used to answer "Nothing changed" even when refused; it now returns the real error.
forgeLinkForm: the status ternary is gone, andsaysis nowbody.says ?? body.message.reissueClaim: the constantreplacedfield is gone. The permission step now reads the child once withchildNamedand passes it on, so there is no second read after the write. This also means a sender's ownership check now reads the child rather than the raw ledger.- Docs: the stale-row paragraph in
forge-link-states.mdnow says the button opens the preview, and there is a terminal how-to. I also changed "Send a fresh link" to "Send a new link" in the MCP hint text. - Preview cost: I did not add a rate limit. The ownership check comes before the child database is opened, so a stranger costs one small ledger file read and gets a 403. Only the admin or the sender reaches the open. I left the open as it is: it is the same as the existing send path, and a read-only open of a small SQLite file. If you want it off-thread like
childSubscription, that is a follow-up.
Left out: the terminal's n list is admin only, because the Forges you sent screen is admin only. A sender who is not an admin uses the palette entry instead.
To try it: bun test test/forge-link-reissue.test.ts. Or open the Forges you sent screen in the terminal, press n, pick a forge and read the preview.
🤖 Generated with Claude Code
main is merged into the branch and pushed. src/spawn/door.ts was the only conflict, and it was just the import line. I kept both sides: this branch's previewReissue plus forgeNameVerdict and takenReason from main. Nothing else in the merge needed hand-resolving.
- Gate: the merge brought in a rule against real-timer sleeps in tests, and it flagged
test/forge-link-reissue.test.ts:157. I marked that line// real-timer:with the reason. It took a second push to fix because my first attempt annotated the wrong line.bun scripts/gate.tsnow passes. - Type check:
bun x tsc --noEmitis clean. - Tests: the diff against
mainwas too broad forscripts/fast.tsto name tests (2696 of 3346 files), so I picked them myself. I ran the three test files this branch changes plus every spawn- and door-named test: 761 tests across 109 files, with 752 passing, 9 skipped and 0 failing. After the gate fix I re-ran onlytest/forge-link-reissue.test.ts, which passes (6 tests). - Sandbox noise: the sandbox denied outbound connections to
.forge.testand--localhosthosts during the run. The tests that opened them still passed. The forge's own check runs the full suite on this push.
I fixed the one failure this pull caused and pushed it. I haven't seen the forge's re-run yet.
forges you sent in the terminal > o switches a forge's code: this was my doing. The "send a new link" key I added made the key footer on the "Forges you sent" screen too wide. The terminal cut it off before "own code or this forge's". I shortened the labels no test pins insrc/tui/screens/forges.ts: "stop one (sleep now)" is now "stop", "remove one" is "remove", "send a new link" is "new link", and "move into a sandbox" is "move". Thetui-forgestests now pass (10 of 10).an entry still waiting for its answer stays out of the foldanda writer queues a check: these pass when I run them alone (14 tests inflow-stale-foldandpull-check-again). The failures were not mine, but I don't know the cause. Neither is in a file this pull touches.every tool's doc names each argument its inputSchema takes: the check log says this one is red onmaintoo, so it isn't counted against this pull.
bun x tsc --noEmit and bun scripts/gate.ts --fix came back clean before the push.
Earlier asks are met: the terminal door has the same preview and confirm through previewDoor/reissueDoor, the gate tests cover a stranger and a claimed forge, the how-to is in docs/features (not README), and the status ternary and constant field are gone. The row button is an <a> to the preview and the confirm is a POST form, so it works without JavaScript. The body is read through the capped body(), and a stranger gets 403 with no name. Non-blocking: the preview opens the child database on a GET; moving that off-thread is a fine follow-up. Non-blocking: box 1 names src/core/access_link.ts, which the builder explained is the wrong module for forge claim links; the behaviour is in src/actions/spawn.ts.
A client's forge link can now be re-sent from a preview: you see who it is for and what stops working, then confirm. The reissue itself already existed (
/forges/:name/claim-link,reissueClaimFor, MCPclaim_link, the dead-link page), so I added the preview step and the receipt around it.What changed
previewReissueinsrc/actions/spawn.tsis read-only. It says who the link is for and that the earlier link stops at once. A claimed forge is refused, and it uses the same who-may-send gate as the reissue.POST /api/v1/forges/:name/claim-linkwith{ "dryRun": true }returns the preview. MCPclaim_linkwithoutrevealreturns it too, so no new tool and noactionvalue was added. Themcp-sizetest passes.forge.claim_reissuedevent now also names whom the link was for and what it replaced.test/forge-link-reissue.test.tscovers the preview changing nothing, the old link answering the dead-link sentence, the receipt row, API and MCP reissue, and a cross-origin post being refused.test/client-states.test.tspins the row button as a link.docs/features/forge-link-states.mddescribes the new flow.Not done
access_link.tschange: it holds the personal sign-in links for a person's account, not forge claim links. A forge's link is oneclaimrow inside the child forge, and minting a new one replaces the old in one write.claim_link.tsstill reissues directly with no preview.Checks and push
bun scripts/gate.ts,bun x tsc --noEmit,bun scripts/design-lint.ts, and the tests covering this change.Try:commit, so there is an empty one.Looks:orNo look:line for thesrc/webchange. I usedNo look:because the page change is small.Try it: open
/forges, press Send a new link on an unclaimed forge, read the preview, and confirm. The link is shown once and the earlier one answers "this link does not work any more".🤖 Generated with Claude Code
Closes #13166