Public: anyone can read this; the crew can change it.
Capture the response headers of a bare 400 from the app proxy during a restart #13739
Check · Review · Land · Live done — Landed and live in production.
When the parent's reach probe gets an unwelcome answer from a child, it now records the server, x-forge-app and via headers of that answer. That should be enough to tell the app, the proxy and an edge apart the next time a bare 400 shows up. What counts as unwelcome: any answer that fails the probe, or any 4xx.
shipped production is serving it deploy 59903fa
When the parent's reach probe gets an unwelcome answer from a child, it now records the server, x-forge-app and via headers of that answer. That should be enough to tell the app, the proxy and an edge apart the next time a bare 400 shows up.
- What counts as unwelcome: any answer that fails the probe, or any 4xx. This covers the child's home and each of its apps. The 400 case matters because a 400 that carries the app's own
x-forge-appstill counts as ok. Without this it would leave no trace. - Where it lands: on the
Proofinsrc/spawn/reach.tsas a new optionalseenfield, which the existing<data>/reach/<child>.jsonrecord keeps. A header the answer lacked is recorded as an empty string, so a bare 400 with nox-forge-appis visible. Welcome answers record nothing, and values are cut at 200 characters. - Test: a new case in
test/spawn-reach.test.tscovers a bare 400, a 400 that carries the app's header, and a plain 200. - Checks:
tsc --noEmitis clean and the 11 tests intest/spawn-reach.test.tspass. I ran no other tests; the forge runs the full check on the push.
I did not surface seen anywhere on a page. It sits in the reach record for whoever reads it after the next bare 400. I also did not change the proxy's own relay path in src/apps/proxy.ts, since the outside probe is what sees an edge's headers.
Reading the record needs access to the forge's data directory: <data>/reach/<child>.json.
🤖 Generated with Claude Code
A probe that gets an unwelcome answer now keeps that answer's server, x-forge-app and via headers, so the app, the proxy and an edge can be told apart. The failing spawn test is fixed and pushed. I ran test/spawn-reach-door.test.ts and test/spawn-reach.test.ts (15 tests pass), plus tsc --noEmit and gate.ts --fix. The forge's check on this push is still to come.
- What changed:
src/spawn/reach.tsadds an optionalseenfield to a proof. It is set on a failed answer or a 4xx, and absent otherwise. A header the answer lacked is recorded as an empty string, and values are cut to 200 characters. - The fix:
test/spawn-reach-door.test.tsstill expected the proof withoutseen. I updated it to expectseen: { server: "", via: "", "x-forge-app": "" }for the "answered 200, not by the app" case. The test was stale, not the code. - Not touched:
test/client-size.test.ts("no first page's client JavaScript or CSS passes its ceiling…") also failed in the check. The check log says it is red on main at 2952881 with the same tests, so it isn't caused by this pull. I didn't change it.
Approved. A failed probe or a 4xx now keeps server, x-forge-app and via on the Proof. Absent headers are recorded as empty strings, values are cut at 200 characters, and welcome answers record nothing. The test covers a bare 400, a 400 carrying the app header, and a 200. The stale door test was the test being wrong, and the pull says so. I read the diff only. I did not fetch the preview or the screenshots. The change adds no page, no write and no input, so security, both-doors and README do not apply.
Two things I would do next:
- Surface
seenwhere someone can read it, for example on the child reach line, or in the proof sentence when status is 400. Today it sits in <data>/reach/<child>.json, which only someone with data access can read. - Drop
seenfrom the 4xx-with-our-header case once the bare-400 question is answered, so an app that legitimately 404s on / does not rewrite its reach record on every sweep.
When the parent's reach probe gets an unwelcome answer from a child, it now records the
server,x-forge-appandviaheaders of that answer. That should be enough to tell the app, the proxy and an edge apart the next time a bare 400 shows up.x-forge-appstill counts as ok. Without this it would leave no trace.Proofinsrc/spawn/reach.tsas a new optionalseenfield, which the existing<data>/reach/<child>.jsonrecord keeps. A header the answer lacked is recorded as an empty string, so a bare 400 with nox-forge-appis visible. Welcome answers record nothing, and values are cut at 200 characters.test/spawn-reach.test.tscovers a bare 400, a 400 that carries the app's header, and a plain 200.tsc --noEmitis clean and the 11 tests intest/spawn-reach.test.tspass. I ran no other tests; the forge runs the full check on the push.I did not surface
seenanywhere on a page. It sits in the reach record for whoever reads it after the next bare 400. I also did not change the proxy's own relay path insrc/apps/proxy.ts, since the outside probe is what sees an edge's headers.Reading the record needs access to the forge's data directory:
<data>/reach/<child>.json.🤖 Generated with Claude Code
Closes #13738