Public: anyone can read this; the crew can change it.
An app that is refused an outside host by the forge's gate says so in its own… #12185
Parked 18d 8h ago
This makes the forge's egress refusal unmistakable to app code and people, and gives apps a check that fails on an undeclared host. The part of (d) that makes the call succeed after Allow is not proven. tsc, scripts/gate.ts and the egress, contain, template and brief tests pass here.
-
Reviews
No review yet.
-
Checks
stopped parked by the crew deploy d628e9b
-
History
- A refused outside host is the forge's word, said so: status, body and header name it, the log says it once an hour, the app template ships a helper and a test that fails on an undeclared host, and the builder is told to declare hosts d628e9b
- A data query runs in a process of its own: SQLite's heap limit is the whole process's, and a query that set it in the forge's made every connection fail with out of memory cc205a8
- Every app a spawn sent ends each pass in one stated condition, the repair takes updates by default, and a copy that moved is found by its history f69fe13
- Data diet: the drains no page reads are the serving thread's and out of the write clock; the age rule and the backfill are the engine's eb2664b
- Data diet: event_repo (repo_id, id) is dropped: 162.6 MB of 2.4M entries, and the one statement that planned on it plans on event_repo_kind_number_at 4f47a7d
- Data diet: the retention jobs run as paced slices; what a deploy first put live is a row per pull, not 2,500 per deploy; wake-up events live 6 h; machine samples 24 h / 7 d / 180 d 0ff2185
- One app's link that cannot be made no longer stops the others, and /forges serves its rows from memory e56c7c8
- The feed and the asks list the newest decisions with a known outcome through a partial index in that order, for a reader with many repositories: 92 ms becomes 0.4 ms on a copy of production (28,490 decisions) 2a250d0
- A cold thread no longer meets the first visitors with the pipeline answer, the displays and the busiest plans still to read: they are read before the listener opens, while the previous release answers; on a copy of production the first second after listen goes from one 1,723 ms stall to 329 ms, the slowest first answer from 1,650 ms to 450 ms, and the 30 seconds' stall from 2,344 ms to 1,086 ms c15bd18
- The pull page reads the pulls that revert it and its branch's pull through their own indexes, and the tell words read an issue's merge from the repository-and-kind event index: 27 ms, 26 ms and 25 ms per call become 1.2 ms, 3.7 ms and 0.01 ms on a copy of production c4f3b4f
- The map is built by a worker with a read-only handle of its own, posted plain data only, and read on the thread only when there is no file to share or the worker failed (said once in the log): on a copy of production the map's 420 ms of one thread every 16 s become 4 to 24 ms of loop lag per poll, the answer still 400 ms, still never older than the last write 3f70ac8
- The everyday account is asked for in one line of the home's needs-you row and made on its own page, with no email where there is no mail 11ca711
- A new forge's owner makes one passkey: no email asked where there is no mail, no on/off badge, the wait says what is happening, and the link comes with a QR code f79880b
- An app a spawn sends down follows the repository it came from: same history, taking updates by default, severed in one action 2dca344
- The run_kind_state index is dropped: it served one question (checks queued, which now names run_queued) and lured 45 of the 271 statements that touch run, because with no statistics SQLite takes it for any statement that names a kind; on a copy of production all 45 plan through the index built for them, the sentinel's streak read goes from 364 ms to 136 ms, and the sentinel's pair list no longer needs a scan a22aa98
- The account menu reads in two seconds: three groups, one row for appearance; the theme gallery lives in settings 2048ac8
- A hosted forge gets the one-click connect: its parent runs the OAuth sign-in for the origins it holds an application for and hands the child only its person's token, once, against a one-time code (GitHub's device grant begun by the parent and polled by the child; a code flow redeemed server to server with a PKCE verifier); the child refreshes through the parent, which stores nothing; the token form stays as the quiet fallback a32d4b6
- The browser, the crew's installs and the check install fill now start in the background class too, and the serving-priority note says what the stall was: the pod's CFS quota, not the scheduler 175ebb0
- A landing simulator checks that what lands is what was reviewed, across 3,375 seeded scenarios e06e753
- Merge pull request #11966 from fix/pack-deploy-org 26c735c
7 earlier comments
I merged the latest main into the pull and pushed it (a66f472ae). I still don't know why the preview deploy failed, and I haven't confirmed a fix.
- App boot: I started the app locally with
bun run src/main.ts. It came up and/healthzanswered 200. The "uncontained" and "agent sandbox not available" warnings in its log come from running inside this sandbox. - Preview: the #12185 preview answers
okwith 200 on/healthz. - Checks:
bun scripts/gate.tsandbun x tsc --noEmitboth passed after the merge. I did not run any test files this time, and I haven't run the full suite.
I'm making no code change, because I can't find anything on this branch that fails. The pull's only change is still the week_reading entry in scripts/unread-tables-allow.json. If the deploy fails again, I need its log to go further.
A fresh start: pull #12185's branch torque/12182-an-app-that-is-refused-an-outside-host-b lives in another fork, which the crew cannot push to, so this work began from main and does not carry that branch's commits.
Still red on current main: the runs list is bare rows, not a boxed card (#9727). Fix it and push.
The branch was behind main, so I merged origin/main into it and pushed. I never saw the preview's failure log, so I can't say what failed, and I never reproduced it.
On the merged tree:
bun scripts/gate.tsandbun x tsc --noEmitpass.- The app boots and
/healthzanswersok. - The egress, template, contain and brief tests all pass (308 pass, 0 fail).
scripts/fast.tsnamed 8 test files for this change, and they pass.
I did not run the full suite or design-lint. If the preview fails again, the forge's check log will show the real cause.
What the pull contains
- The gate refuses an undeclared host with
403 Refused by this forge, anX-Forge-Egress: refusedheader, and a newX-Forge-Egress-Hostheader. The body names the host. - The forge log gets one
app refused an outside hostline per app and host per hour. - The app template gains
src/egress.ts,src/egress.test.tsand anAGENTS.mdrule. A builder'sbun testfails with a one-line message when code calls a host thatforge.jsonegressdoesn't declare. - The crew brief tells a builder to add the host to
egressin the same change.
Not done
- Allow succeeding on a call that was refused is still not proven.
- I left the existing "Blocked: host" line and the Allow button as they were.
To try it
- Open the #12185 preview.
- Run
bun test test/egress-refused.test.ts test/contain.test.ts.
A fresh start: pull #12185's branch torque/12182-an-app-that-is-refused-an-outside-host-b lives in another fork, which the crew cannot push to, so this work began from main and does not carry that branch's commits.
Still red on current main: the runs list is bare rows, not a boxed card (#9727). Fix it and push.
Locally, nothing is failing on the current branch, so I made no change and pushed nothing.
The failure on record is a check run against the older head d628e9bc, from before my last push. It reported 11 failing tests, including "the runs list is bare rows", "every table a migration creates is read by code", and the landing-page ssh test. Those tests live in test/runs-state-filter.test.ts, test/studio-runs.test.ts, test/unread-tables.test.ts and test/ssh-site.test.ts. They pass on the current head e6fe8bd97. That head already includes the merge of origin/main, and gate.ts and tsc are clean on it. The preview's /healthz returns 200.
I couldn't see a check result for e6fe8bd97, so I can't confirm it is green. If the forge's check on that head fails, send me its log and I'll fix what it names.
A fresh start: pull #12185's branch torque/12182-an-app-that-is-refused-an-outside-host-b lives in another fork, which the crew cannot push to, so this work began from main and does not carry that branch's commits.
I merged main into the branch and pushed it. The merge ran with no conflicts, and no conflict markers remain in templates/app-template.json.
- Checks:
bun x tsc --noEmitandbun scripts/gate.tsshowed no errors.scripts/fast.tsnamed 8 test files, and all 115 tests in them pass. I did not run the full suite; the forge runs it on the push. - Push: the branch now sits at
4d0effa3b, and the forge will redeploy the preview and run its check against it.
The PR description is unchanged. The merge added no code of my own.
A fresh start: pull #12185's branch torque/12182-an-app-that-is-refused-an-outside-host-b lives in another fork, which the crew cannot push to, so this work began from main and does not carry that branch's commits.
main is already merged into the branch, and there was nothing new to merge or push.
I fetched again. The branch contains origin/main at d7f840c18 and matches its remote branch. The merge reports "Already up to date" and no files are in conflict, so I found nothing to resolve in templates/app-template.json.
I did not re-run the tests. The earlier merge to 4d0effa3b passed tsc, gate.ts and the 8 test files fast.ts named. If the forge still reports a conflict, it may be judging an older state of the branch, so I'd check that it picked up my last push.
A fresh start: pull #12185's branch torque/12182-an-app-that-is-refused-an-outside-host-b lives in another fork, which the crew cannot push to, so this work began from main and does not carry that branch's commits.
This makes the forge's egress refusal unmistakable to app code and people, and gives apps a check that fails on an undeclared host. The part of (d) that makes the call succeed after Allow is not proven.
tsc,scripts/gate.tsand the egress, contain, template and brief tests pass here. I did not run the whole suite ordesign-lint. I didn't call thekeep_planorestimatetools. They aren't in my tool list, so no plan is kept on the issue and no time is promised.Most of this already existed from #10456. The first refusal was already an event, a "Blocked: host" line with Allow on the app's settings page, a notification, and part of the crew's brief. Allow already took effect with no redeploy and committed the host to
forge.json. I left that as it was.What changed
403 Refused by this forge, headerX-Forge-Egress: refused, a newX-Forge-Egress-Host: <host>, and bodyrefused by this forge: <host> is not in this app's forge.json egress. This is insrc/apps/egress.ts. Other 403s (such as "does not resolve") are unchanged. The old wording asserted in tests (contain,egress-upstream) is updated to the new one.app refused an outside hostwith the app and host, once per app and host per hour (cellHooksinsrc/apps/egress_refused.ts, wired inruntime.ts).templates/app-template.jsongainssrc/egress.ts, withrefusedByForge,checkedFetchand the best-effort host scanner. It also gainssrc/egress.test.ts, and anAGENTS.mdrule to declare hosts.egress.test.tsruns in the app's ownbun test. It fails with one line:src/x.ts calls host, which forge.json "egress" does not declare: add "host" to it. It finds literalhttp(s)/ws(s)hosts in files that callfetch,WebSocketorEventSource. It also reads hosts from env names endingURL,HOST,ENDPOINTorBASE.ownAppLines) tells a builder to add the host toegressin the same change. I appended it to the existing first line so existing positional tests hold.test/egress-refused.test.tscovers the refusal, the log line, the Blocked line and Allow.docs/features/blocked-hosts.mdhas a new section.Not proven
What I chose not to do
Try it
fetchan undeclared host. The call gets403 Refused by this forge.bun test src/egress.test.tsin an app created from the template; it fails until the host is inforge.jsonegress.Closes #12182