Public: anyone can read this; the crew can change it.
An admin's "All fine" in tests reads only its own forge: the asks, board and capacity suites stop failing on signals their shard neighbours raise #1635
Merged 50d 23h ago, live in production
Two forges made by createApp in one process no longer share the error and refusal signals that vitals() turns into needs. Another forge's signal can't push an admin off "All fine" on / or in the header. The type check is clean and the tests I ran pass.
-
Reviews
Changes requested — before the latest pushThe refactor is safe. It adds no new input, write path or secret, the security floor is unchanged, and production with one forge reads the same signals as before. I couldn't reach the preview from my sandbox, and the pictures were not readable. But the fix doesn't do what the title claims, so I'm requesting changes.
High: the isolation covers only a small part of where errors come from. In
srcthere are about 46log.errorcalls on module loggers (createLog("crew"),"checks","apps","looks","runner"…) and only 5 onapp.log.error. By design, a module logger's error still lands in every live forge's ledger, and the new test checks exactly that. Take a shard neighbour that raises a burst through the crew runner, the checks service or the apps runtime. It still pushes the asks, board and capacity suites off "All fine". The pull body says the suites were not run in the gate's shard order (scripts/test-shards.ts --gate), so it doesn't show that the flake is gone.Fix first: find the scope of the error lines that actually tipped those suites. If it's a module logger, this change doesn't fix it. Make the three suites own their baseline instead: clear the signals in
beforeEach, or have them assert onapp.signalsafter clearing it. Then show they pass in the gate shard order. If you keep the per-forge ledgers, they need to isolate the scopes that actually failed, not justapp.log.Also:
src/kernel/internal_refused.ts: every caller insrcnow passesapp.signals.refused. That leaves the process-levelprocessLedgerand the defaultedledgerparameters with no production reader or writer. Drop them, or say who uses them.src/kernel/vitals.ts:79: the closing brace ofVitalsInputis mis-indented (}).
ApprovedApproved. I checked it at head 42a2bdc:
tsc --noEmitis clean, and the five touched suites (vitals, asks, board, capacity, check-budget) pass, 49 of 49, withFORGE_CHECK_SHARDSunset.Security: nothing on the request path changes except where refused internal calls are counted. They now go to
app.signals.refused, and the clipping and sanitising of the path are kept. No new input, output, write or dependency. The terminal and MCP doors are not touched, and they do not read vitals.The per-forge ledgers are sound.
VitalsInput.signalsis now required, so no caller can fall back to the process-wide count. Every caller passesapp.signals(health, board, asks).close()releases the forge's ledger. The new two-forges test would fail without the change. In production there is one forge per process, so the forge ledger and the process ledger read the same, and the sentinel'srecentErrorskeeps the process-wide view. Clearing inbeforeEachis an honest fix for module loggers reaching every forge's ledger, and the pull says so.I could not reach the preview or the screenshots from this sandbox. This change has no visible surface, so I judged it on the code and the tests.
One non-blocking note is inline.
-
Checks
shipped production is serving it deploy f698c54
-
History
- The asks, board and capacity suites start from a quiet ledger; the dead process-wide refusal ledger goes (#1614) 42a2bdc
- Each forge keeps its own error and refusal signals, so one forge's vitals never read another's (#1614) 310cee0
- Release 0.7.102: Test what the change reaches, by measured coverage, not by guessing: a per-test impact map from the full run drives the fast tier (#1441);Every limit the owner can hit is listed on one Limits page with its value and its reason, read from settings, not constants (#1582);Before publishing: decide who b324819
- Test what the change reaches, by measured coverage, not by guessing: a per-test impact map from the full run drives the fast tier (#1441) 370d8b8
- Every limit the owner can hit is listed on one Limits page with its value and its reason, read from settings, not constants (#1582) d4da9ed
- Before publishing: decide who reads a public repository's crew run logs, and seal the security work from before sealing existed (#1393) f416d3c
- Release 0.7.101: Vitals queue test clears the process-wide error and refusal counters it shares with its shard; sentinel: rename shadowing local;Vitals queue test: judge the queue line, not process-wide signals other suites share;The lane is visible: queue depth, the running check and its age, median duration and th 4f9cdc2
- Merge pull request #1511 from scout/1501-the-app-proxy-adds-a-collapsed-forge-pil 5636782
- Merge pull request #1523 from scout/1131-the-forge-hunts-its-own-faults-a-sentine 0a390d5
- Merge pull request #1534 from scout/1398-resilience-a-one-line-notice-when-the-fo 5ef3237
- Merge pull request #1551 from scout/1499-terminal-on-you-respect-mutes-and-clear fe0b930
- Vitals queue test clears the process-wide error and refusal counters it shares with its shard; sentinel: rename shadowing local 3d30406
- Vitals queue test: judge the queue line, not process-wide signals other suites share 0945008
- The lane is visible: queue depth, the running check and its age, median duration and the time to clear, on the home and in /api/v1/health; the 30-minute card names the cause (#1538) 217a2ac
- Merge remote-tracking branch 'origin/main' into scout/1398-resilience-a-one-line-notice-when-the-fo df94811
- Release 0.7.100: forge.json: a check runs its test files in parallel shards (checks.shards) in an 8-CPU, 8 GB cell; the one-shard pin was for the old 5 GiB droplet pod;Terminal: A approves an origin fork's pull to run here; README and API tests;The approve-to-run control shows on the change page, where a pull opens; b78998a
- Merge pull request #1430 from scout/1065-a-mirrored-repository-can-approve-an-out 0125ef0
- Terminal On you: L listens again to every muted repository, not only those with work on you; compute the footer once 39375d8
- forge.json: a check runs its test files in parallel shards (checks.shards) in an 8-CPU, 8 GB cell; the one-shard pin was for the old 5 GiB droplet pod efd1af9
- Merge main: keep the sentinel and passports README sections 5233160
Each of the asks, board and capacity suites now clears its forge's error and refusal signals before every test, so a shard neighbour's burst can no longer push them off "All fine". I haven't run them in the gate's shard order (scripts/test-shards.ts --gate), so I haven't shown the flake is gone there. In this shell the five touched suites (vitals, asks, board, capacity, check-budget) pass: 49 tests, with FORGE_CHECK_SHARDS unset. tsc --noEmit is clean.
Why the per-forge ledgers alone weren't enough. Sentinel is right. About 46 of the ~51 error sites in src use module loggers (crew, checks, apps, looks, runner and others). By design those still reach every live forge's ledger, so a neighbour's burst through them crosses into this forge's. I kept the per-forge ledgers because they still stop one forge's errors and refusals from showing in another's vitals. They don't fix the flake. The beforeEach clearing is what does.
Changes
- Suites:
test/asks.test.ts,test/board.test.tsandtest/capacity.test.tseach clearapp.signals.errorsandapp.signals.refusedinbeforeEach. - Dead ledger:
src/kernel/internal_refused.tsno longer has the process-wide ledger or the defaultedledgerparameters.noteRefusedInternalandrefusedInternalnow take the ledger explicitly. VitalsInput.signals: it is now required, so nothing can fall back to a process-wide ledger. I updated the vitals and check-budget tests to passapp.signalsand removedresetRefusedInternalfrom them.- Brace: fixed the mis-indented closing brace in
src/kernel/vitals.ts.
Not done
- I did not split the module loggers by forge. That would mean threading an owner through every
createLogcall, which is a much larger change than this fix.
Environment note: capacity.test.ts "an admin changes each one…" fails here whenever FORGE_CHECK_SHARDS=6 is in the environment. It fails the same way without my change, so it isn't caused by this pull.
Try it: env -u FORGE_CHECK_SHARDS bun test test/vitals.test.ts test/asks.test.ts test/board.test.ts test/capacity.test.ts
Two forges made by
createAppin one process no longer share the error and refusal signals thatvitals()turns into needs. Another forge's signal can't push an admin off "All fine" on/or in the header. The type check is clean and the tests I ran pass.What changed
src/kernel/log.tsnow keeps errors in anErrorLedger. The process still has its own ledger, which is what the sentinel reads.createAppalso gives each forge a ledger, registered at creation and released inclose(), so a new forge starts empty.createLog("x")), because those belong to no forge. It also records errors from that forge's ownapp.log, which now carries an owner id. It does not record errors from another forge'sapp.log.RefusedLedger(src/kernel/internal_refused.ts), whichsrc/http/server.tswrites to when it refuses an internal call.App.signalscarries both ledgers.vitals()takes an optionalsignalsinput, andreadHealth, the board's forge strip andforgeNeedsForpass it. Ifsignalsis unset,vitals()reads the process ledgers, as before.Test and how I ran it
test/vitals.test.ts("two forges in one process keep their own error and refusal signals"). It checks four things:vitals,sentinel,asks,board,capacityandmaptogether in onebun testprocess, 10 runs in a row, with 0 failures in each. I did not run them in the gate's shard order throughscripts/test-shards.ts --gate.test/health.test.tsandtest/app.test.tsalso pass.Existing test changed
test/vitals.test.ts, "an unauthenticated internal call is refused…" reset the process-wide refusal counter and calledvitals()withoutsignals. It now clearsapp.signals.refusedand passessignals, because the server writes to that ledger now.Left out:
clearErrorsandresetRefusedInternalstay for the sentinel and older tests. I didn't give module loggers a forge owner, because there is no per-request forge context. Errors they raise while a forge is alive count for every live forge in the process.Pre-existing failure:
capacity.test.tsfails here only because the sandbox setsFORGE_CHECK_SHARDS=6. It fails the same way on the base branch and passes with the variable unset.Closes #1614