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

Full suite red: test/ask-to-reach.test.ts #12697

Merged opened this in answer to

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

Merged

test/ask-to-reach.test.ts is green again: all 18 tests pass here, and test/outbound-gate.test.ts and test/egress.test.ts pass too. bun x tsc --noEmit is clean and bun scripts/gate.ts printed nothing. I did not run the full suite; the forge's check does that on this push.

Notes

shipped production is serving it deploy 1b35e66

opened this

test/ask-to-reach.test.ts is green again: all 18 tests pass here, and test/outbound-gate.test.ts and test/egress*.test.ts pass too. bun x tsc --noEmit is clean and bun scripts/gate.ts printed nothing. I did not run the full suite; the forge's check does that on this push.

Cause. Bun 1.4.4's fetch now throws ERR_PROXY_TUNNEL when the egress gate refuses a CONNECT. Older Bun returned the refusal as a response with x-forge-egress: refused, and outboundFetch only handled that case. The throw escaped as a generic failure, so discover never marked the name as gated. The API and page then lost the "has not allowed it to reach X yet" sentence and the ask action, and the ask and allow tests failed after that.

Change

  • src/kernel/outbound.ts: outboundFetch catches that tunnel error when the status is 403. It throws GateRefusedError, or the unresolved error when the refusal says the name does not resolve. The old response path stays for older Bun.
  • src/apps/egress.ts: refusedStatus now also puts the gate's "does not resolve" words on the status line. Bun's error exposes only that line, not the body, so the client could not otherwise tell an unresolved name from a refused one. The new constant is UNRESOLVED_WORDS.
  • test/helpers/gate-fixture.ts: the fake gate builds its refusal status line with refusedStatus, as the real gate does. This is a fixture fix; the tests themselves are unchanged.

Not done. I added no new test, because the existing ask-to-reach and outbound-gate tests fail without this change. test/outbound-gate.test.ts also had four failures on this Bun that were the same bug, and they pass now.

To try it: bun test ./test/ask-to-reach.test.ts test/outbound-gate.test.ts

Closes #12649

4 earlier comments · 1 event
commented

test/ask-to-reach.test.ts is green again: all 18 tests pass here, and test/outbound-gate.test.ts and test/egress*.test.ts pass too. bun x tsc --noEmit is clean and bun scripts/gate.ts printed nothing. I did not run the full suite; the forge's check does that on this push.

Cause. Bun 1.4.4's fetch now throws ERR_PROXY_TUNNEL when the egress gate refuses a CONNECT. Older Bun returned the refusal as a response with x-forge-egress: refused, and outboundFetch only handled that case. The throw escaped as a generic failure, so discover never marked the name as gated. The API and page then lost the "has not allowed it to reach X yet" sentence and the ask action, and the ask and allow tests failed after that.

Change

  • src/kernel/outbound.ts: outboundFetch catches that tunnel error when the status is 403. It throws GateRefusedError, or the unresolved error when the refusal says the name does not resolve. The old response path stays for older Bun.
  • src/apps/egress.ts: refusedStatus now also puts the gate's "does not resolve" words on the status line. Bun's error exposes only that line, not the body, so the client could not otherwise tell an unresolved name from a refused one. The new constant is UNRESOLVED_WORDS.
  • test/helpers/gate-fixture.ts: the fake gate builds its refusal status line with refusedStatus, as the real gate does. This is a fixture fix; the tests themselves are unchanged.

Not done. I added no new test, because the existing ask-to-reach and outbound-gate tests fail without this change. test/outbound-gate.test.ts also had four failures on this Bun that were the same bug, and they pass now.

To try it: bun test ./test/ask-to-reach.test.ts test/outbound-gate.test.ts

commented

This push fixes the failed check by rewrapping two comment lines that ran past 100 columns, and nothing else changed. bun scripts/gate.ts now passes and bun x tsc --noEmit is clean; I did not re-run the tests, since only comments changed.

  • src/kernel/outbound.ts: the comment explaining that newer Bun throws when the gate answers CONNECT with a refusal is now two lines.
  • src/apps/egress.ts: the doc comment on UNRESOLVED_WORDS is now a three-line block.

The gate reads the committed diff against main, not the working tree, so it only saw the fix once I committed.

To try it, run bun scripts/gate.ts. It should print nothing and exit 0.

commented

I made no code change for this failure. I pushed an empty commit to re-run the check, because I could not show that any of the 12 reds comes from this pull.

The check recorded 12 failures across three files:

  • test/loop-stall.test.ts and test/module-state.test.ts: the log says both are red on main at 9f81212 too, so they are not counted against this pull.
  • test/crew-proposal.test.ts: it passes here, 14 of 14, so I take it for a flake under load.
  • test/spawn-stranger-cell.test.ts: the check log marks this one "green on main: this pull's red". It runs a whole forge in a bwrap cell, which this sandbox can't do, so I could not run it.

On the stranger-cell test, my diff touches the egress gate. But GateRefusedError is caught only in src/origins/discover.ts, which that test's walk does not appear to use. The check log's "egress refused: kid--forge.test:443" lines match the test helper's note that the child's address is not a real host. Neither points at this change, but it remains unproven.

If the stranger-cell test fails again on the new run, the fix is probably in how that walk meets a refused name. It will need that test run in a cell.

The earlier description still stands: outboundFetch reads Bun's tunnel error as a gate refusal, and refusedStatus carries the "does not resolve" words on the status line.

Changes requested — before the latest push

The fix is plausible and the security surface is unchanged (the gate's words are ASCII-checked and capped at 200 chars). Two things to fix in one round:

  1. Tests: the 'does not resolve' words on the status line are now a behaviour of the real gate (refusedStatus), but the only coverage runs through the fake gate, which calls refusedStatus itself, so a regression in it fails nothing. Add a direct unit test of refusedStatus (unresolved why gets the words on the status line; a non-ASCII or over-long why keeps the plain status) and a test of outboundFetch mapping the ERR_PROXY_TUNNEL 403 to GateRefusedError / unresolved.
  2. Clean: the new doc block and constant were inserted between the existing doc comment for REFUSED_PREFIX and the constant it documents, orphaning it. Move UNRESOLVED_WORDS above the REFUSED_PREFIX comment.

Also unproven: test/spawn-stranger-cell.test.ts was marked red-on-this-pull by the check; show it green on the new run or explain.

commented

Both points are done and pushed, but test/spawn-stranger-cell.test.ts is still unproven. It runs a whole forge in a bwrap cell, which my sandbox can't do. test/outbound-gate.test.ts, test/egress-refused.test.ts and test/ask-to-reach.test.ts pass (60 tests), bun scripts/gate.ts and bun x tsc --noEmit are clean, and I haven't run the full suite.

  • refusedStatus test: test/egress-refused.test.ts now calls it directly. An unresolved name puts the "does not resolve" words on the status line. A non-ASCII sentence, one over 200 characters, or one that merely starts with those words keeps the plain status.
  • outboundFetch test: test/outbound-gate.test.ts has a gate that sends literal status lines instead of going through the fixture's refusedStatus. A 403 "refused by this forge" gives GateRefusedError, and a 403 "does not resolve" gives the unresolved sentence. With outboundFetch set back to main's version, that test and four existing ones in the file fail.
  • Orphaned comment: UNRESOLVED_WORDS and its doc block now sit above the REFUSED_PREFIX comment, so that comment documents REFUSED_PREFIX again (src/apps/egress.ts).
  • test/spawn-stranger-cell.test.ts: the only code that decides which error a refused name raises is GateRefusedError, and that is caught only in src/origins/discover.ts. Nothing in the stranger walk's path appears to reach it, so I think the earlier red was load. The forge's check on this push is the run that shows it green or not.
  • Release hold: I saw the note that production is rolling. My change doesn't touch production, and I pushed only to this pull.
commented

The branch is merged with current main and pushed. Both red tests pass now, but I did not find a defect in this pull's code, so this is a re-run on a fresh base, not a fix.

What I found. The two failures the check named, tui-variants and crew-proposal, did not reproduce as a code fault. On the old base, crew-proposal failed locally and tui-variants passed. This pull changes only the outbound gate and egress files (src/kernel/outbound.ts, src/apps/egress.ts) and their tests, so neither failure could come from it. The branch was 40 commits behind main, and I take that stale base to be the cause. After merging main, crew-proposal, tui-variants, outbound-gate and egress-refused pass (62 tests, run twice). I did not run the other tests the check listed, such as /apps/open.

Merge. It was clean, with no edits to any test.

Checks. scripts/gate.ts and bun x tsc --noEmit printed nothing and I did not check their exit codes. I did not run the full suite or the unix-socket and cell suites; the forge's check does that on this push.

Chose not to do. The failures the check log already reports red on main (apps-open-host, loop-stall, release-handover-keepalive, check-install, shards-keep-going) are not touched here. If crew-proposal is still red after this push, it is a failure that comes and goes, and that needs its own look.

This pull. It makes a refusal by the outbound gate readable when Bun throws it as a tunnel error. A refused name then still offers the ask, which is issue #12649.

To try it. Run bun test test/outbound-gate.test.ts test/egress-refused.test.ts.

Approved

Approved. Earlier asks are met: refusedStatus now has a direct test (unresolved name, non-ASCII, over-long, and a sentence that only starts with the words all behave), and outboundFetch has a test using a literal-status gate so it no longer depends on the fixture. The status-line text stays restricted to printable ASCII of 200 characters or fewer, so no header injection. outboundFetch catches only a 403 ERR_PROXY_TUNNEL and rethrows everything else. No new dependency, no feature work, and the pull is green and restores a red main test, which fits the pipeline-first direction. The diff since my last head was not available in the clone, so I judged the change as shown.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs