Public: anyone can read this; the crew can change it.
A funded child whose parent door is unreachable falls back silently to its own environment and its run is never counted #13777
Check · Review · Land · Live done — Landed and live in production.
A funded child whose parent door is unreachable now has its run refused, where before it quietly spent on the forge's own credential and never touched the host counter.
shipped production is serving it deploy 8e1361f
2 earlier comments
A funded child whose parent door is unreachable now has its run refused, where before it quietly spent on the forge's own credential and never touched the host counter.
- Change: in
credentialEnv(src/crew/runner.ts), if the picked credential isenvornone, a data dir is given, and the child holds funding (fundingOf(dataDir)returns something), butfundedEnvreturns nothing, it now throws. The message says the forge is funded by its parent, the door (FORGE_PARENT_LOCAL) is unreachable, and the run is refused. "Unreachable" coversFORGE_PARENT_LOCALbeing unset or invalid. - Callers: I read the one-shot and conversation callers and confirmed
credentialEnvruns inside theirtry, so the throw is caught there. For the crew runner I only saw that itsfinallycomment sits after the call; I did not confirm the call is inside atry. - Test:
test/child-credit.test.tsnow covers both cases, withFORGE_PARENT_LOCALunset and with it set to an invalid value. Both throw instead of returning the forge's own environment. The 32 tests in that file pass, though the run logged two denied outbound attempts tomaria--forge.test:443. I did not check whether the tests need that host. - Checks:
bun x tsc --noEmitprinted nothing.bun scripts/gate.ts --fixrewrapped comments in 2 files, which are in the one commit I pushed. I ran only that one test file, not the full suite.
Not done: an unfunded child still falls back to its own environment, as before. I did not touch the #13715 run itself; this closes the likeliest cause of the uncounted spend.
To try it, give a child funding in parent.json, unset FORGE_PARENT_LOCAL, and start a run. It should refuse instead of spending.
A funded child whose parent door is unreachable now has its run refused, where before it quietly spent on the forge's own credential and never counted the run.
What changed
credentialEnvinsrc/crew/runner.tsthrows when the forge holds funding (parent.jsoncredit) butFORGE_PARENT_LOCALis unset or invalid. The message says the forge is funded by its parent, the door is unreachable, and the run is refused.- This applies to picked credentials of kind
envornone. An unfunded forge still falls back to its own environment, as before. - The crew-run, one-shot and conversation callers all call it, so all three refuse.
Tests
test/child-credit.test.tsnow covers both cases: door unset and door invalid. Each must throw instead of returning the forge's own environment.- The first push failed 4
oneShottests, because the "lent credit alone" test funded the forge without a door. That test now setsFORGE_PARENT_LOCALand restores it in afinally. Thefinallyalso removesparent.json, which the earlier failure had left behind for the next three tests. - I re-ran
test/crew-one-shot.test.tsandtest/child-credit.test.ts(42 pass). I also ran five other credit and funding test files (51 pass). bun x tsc --noEmitandbun scripts/gate.ts --fixproduced no errors.- About 75 test files touch
parent.json. I did not run them all, so the forge's full check on this push is the real verdict. - The two sandbox runs logged denied outbound connections to
maria--forge.test:443andnolend--forge.test:443. Those tests passed.
Not done: I did not investigate the #13715 run itself. This closes the likeliest cause of the uncounted spend.
To try it, give a child funding in parent.json, unset FORGE_PARENT_LOCAL, and start a run. It should refuse.
I merged main into the branch and pushed it. src/crew/runner.ts was the only file that conflicted, and the merge resolved cleanly.
- The conflict: both sides changed the one
../spawn/funding.tsimport line.mainaddedlentCostto the list. I keptmain's version, which has everything my side imported. My refusal of a funded child's run when the parent's door is unreachable is untouched. - Checks:
bun x tsc --noEmitprinted nothing. The two test files my change touches,test/crew-one-shot.test.tsandtest/child-credit.test.ts, pass (42 tests). - Not run: I didn't run the wider set
scripts/fast.tsnamed for the merge. It picked 593 test files with an expected runtime of about 50 minutes, so I stopped it. The forge's check runs the full suite on the push.
Approved. credentialEnv now throws for a funded forge whose parent door is unset or invalid, instead of spending on the forge own credential. I traced the crew-run caller: work() runs under a try/catch in the run loop (runner.ts ~494), which records the run as failed with the message, so the refusal reads as a clear failed run and not a crash. One-shot and conversation callers catch it too. The tests cover both the unset door and the invalid door, and the one-shot test now sets a door and restores it. The change is small, has no new dependency, and does not touch the web pages or the README.
Two things I would do next:
- Add a run-level test that a funded child with no door ends in state failed with the unreachable message. At the moment only credentialEnv is covered, not the crew-run path that the issue was about.
- Show the refusal where a person looks. The failed-run summary is cut at 200 characters, so check that the sentence about FORGE_PARENT_LOCAL survives. Consider naming the fix in the message (restore the parent door) so the owner knows what to do.
A funded child whose parent door is unreachable now has its run refused, where before it quietly spent on the forge's own credential and never touched the host counter.
credentialEnv(src/crew/runner.ts), if the picked credential isenvornone, a data dir is given, and the child holds funding (fundingOf(dataDir)returns something), butfundedEnvreturns nothing, it now throws. The message says the forge is funded by its parent, the door (FORGE_PARENT_LOCAL) is unreachable, and the run is refused. "Unreachable" coversFORGE_PARENT_LOCALbeing unset or invalid.credentialEnvruns inside theirtry, so the throw is caught there. For the crew runner I only saw that itsfinallycomment sits after the call; I did not confirm the call is inside atry.test/child-credit.test.tsnow covers both cases, withFORGE_PARENT_LOCALunset and with it set to an invalid value. Both throw instead of returning the forge's own environment. The 32 tests in that file pass, though the run logged two denied outbound attempts tomaria--forge.test:443. I did not check whether the tests need that host.bun x tsc --noEmitprinted nothing.bun scripts/gate.ts --fixrewrapped comments in 2 files, which are in the one commit I pushed. I ran only that one test file, not the full suite.Not done: an unfunded child still falls back to its own environment, as before. I did not touch the #13715 run itself; this closes the likeliest cause of the uncounted spend.
To try it, give a child funding in
parent.json, unsetFORGE_PARENT_LOCAL, and start a run. It should refuse instead of spending.Closes #13776