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

Every forge one admin sends shares a single budget of 30 wakes an hour #13920

Merged opened this in answer to

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

Merged

The parent's own questions to a child now spend no wake budget. The rest of the issue was already on main in d73d76814, so this pull adds only that last piece. Already on main (d73d76814): a wake counts against the forge's owner once it is claimed, and against the forge itself until then.

Notes

shipped production is serving it deploy 4adf612

opened this

The parent's own questions to a child now spend no wake budget. The rest of the issue was already on main in d73d76814, so this pull adds only that last piece.

Already on main (d73d76814): a wake counts against the forge's owner once it is claimed, and against the forge itself until then. It never counts against whoever sent it.

What this pull changes:

  • Reach probe: proveChild (src/spawn/reach.ts) now sends the child's status token in x-forge-parent on the home probe only, which is the call firstProof makes at spawn.
  • Wake gate: wakeGate (src/spawn/host.ts) reads the child's statusToken from its ledger. It compares it in constant time with the header. When they match, the wake is neither checked against nor counted in the per-person budget.
  • Still applied: the awake ceiling and the per-address door limit still apply to those requests. A wrong or missing token is an ordinary stranger's request and spends a wake as before.

Left out on purpose: the token is not sent to a child's apps. App code could read it, and the probes of those apps ride on the same wake as the home probe anyway.

Tests: a new test in test/wake-budget.test.ts sets the limit to 1 and wakes an unclaimed forge three times with the token. All three are granted. A wrong token spends the one wake, and the next plain wake gets 429. It would fail without the change. The wake-budget, forge-sleep and spawn-reach tests pass (39), and tsc --noEmit is clean.

Not run: scripts/fast.ts said the diff was too broad to name, and the full suite timed out in the sandbox, so I ran only the four test files above. The forge's check runs the rest.

To try: set forges.wakes_per_person_hour to 1 and send a forge. The spawn's firstProof and the reach sweeps no longer draw on the budget.

Closes #13813

commented

The parent's own questions to a child now spend no wake budget. The rest of the issue was already on main in d73d76814, so this pull adds only that last piece.

Already on main (d73d76814): a wake counts against the forge's owner once it is claimed, and against the forge itself until then. It never counts against whoever sent it.

What this pull changes:

  • Reach probe: proveChild (src/spawn/reach.ts) now sends the child's status token in x-forge-parent on the home probe only, which is the call firstProof makes at spawn.
  • Wake gate: wakeGate (src/spawn/host.ts) reads the child's statusToken from its ledger. It compares it in constant time with the header. When they match, the wake is neither checked against nor counted in the per-person budget.
  • Still applied: the awake ceiling and the per-address door limit still apply to those requests. A wrong or missing token is an ordinary stranger's request and spends a wake as before.

Left out on purpose: the token is not sent to a child's apps. App code could read it, and the probes of those apps ride on the same wake as the home probe anyway.

Tests: a new test in test/wake-budget.test.ts sets the limit to 1 and wakes an unclaimed forge three times with the token. All three are granted. A wrong token spends the one wake, and the next plain wake gets 429. It would fail without the change. The wake-budget, forge-sleep and spawn-reach tests pass (39), and tsc --noEmit is clean.

Not run: scripts/fast.ts said the diff was too broad to name, and the full suite timed out in the sandbox, so I ran only the four test files above. The forge's check runs the rest.

To try: set forges.wakes_per_person_hour to 1 and send a forge. The spawn's firstProof and the reach sweeps no longer draw on the budget.

commented

I merged main into the branch and pushed it. The one conflict was in src/spawn/reach.ts.

What I changed

  • main had added a home argument to proveChild, so a home proof already made can be reused. I kept that and made the fallback probe home ?? proveHome(fetcher, child, token), so it still carries the parent's status token and spends no one's wakes.
  • Beyond the conflict, I also made firstProof send the token on its home probes (the initial one and each retry). Those probes would otherwise have counted against the wake budget.
  • tsc --noEmit ran with no errors printed.
  • bun scripts/gate.ts --fix ran, but I only looked at the last lines of its output and don't know whether it changed anything.
  • bun test test/spawn-reach.test.ts test/spawn-reach-door.test.ts test/wake-budget.test.ts passes (24 tests).
  • I did not run the full suite. scripts/fast.ts reported the diff reaches 2378 test files, which is too broad to run here, so the forge's check on this push covers the rest.

🤖 Generated with Claude Code

Approved

Does what the issue left open: the parent's own reach probes (home only, never app code) carry the child's status token, and wakeGate compares it in constant time (hashed, timingSafeEqual) and skips the per-person budget; awake ceiling and door limits still apply. The test fails without the change and covers the wrong-token case. No page, TUI or docs surface is touched, so the both-doors and README rules do not apply. Next two things: (1) cache statusTokenOf per probe sweep or read it once, since proveChild and firstProof each read the ledger; (2) add a test that an app probe never carries x-forge-parent, to pin the token-never-to-app-code choice.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs