Skip to content

feat(link): try the WebSocket upgrade when the Child has no answer from its Home yet (closed gate) - #8682

Merged
lidge-jun merged 11 commits into
devfrom
feat/link-websocket-advert-unknown-try
Nov 13, 2026
Merged

lidge-jun merged 11 commits into
devfrom
feat/link-websocket-advert-unknown-try

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Scope: the TypeScript Child (src/client/), once its release gate opens. The lightweight ocx-child keeps the old rule, trying only on a cached on (native/ocx-child/src/link_ws_advert.rs, relay.rs); bringing it the same rule is an item in the gate-opening devlog unit (open PR #8679, item 11; not on dev yet).

A Child decides whether Codex's Responses WebSocket upgrade may try its Home from a memory cache of the Home's last verified advertisement (src/client/link-ws-advertisement.ts). Until now only a cached "on" let the upgrade try. A Child that had just started (a restart, an update, a new link) had no entry, so its first upgrade got today's 426 at once, and codex-rs then stays on HTTP for the rest of that session. Nothing runs a relay-auth preflight before the listener accepts, so after a restart the first upgrade usually arrives before anything has taught the cache. The measurement with the pinned Codex (#8681) shows that this, not the restart's length, is what moves a turn that would otherwise fit Codex's retry budget off the WebSocket.

Now the cache has three states. linkWebsocketAdvertisement(linkId) returns "on" or "off" from the last answer applied for the link, and "unknown" when this process has applied none (also after the entry is evicted past the 256 kept). The relay's default rule is "try unless the cache says off" (src/client/link-websocket.ts). The upgrade's own preflight still decides: openLinkWebsocket goes on only when its own verified, nonce-bound answer on that same connection says on, and that answer is applied to the cache under the existing ordering rule.

Behaviour once the Child's release gate is open:

Child state Before After
Gate closed (every build today) 426, no I/O unchanged
Child-local opt-out 426, no I/O unchanged
Cached "off" 426, no I/O unchanged
Cached "on" tries unchanged
No answer yet, Home advertises 426, no I/O tries; 101 when the Home says on
No answer yet, old Home or switch off 426, no I/O each upgrade tried before the first answer applies (at most 4 setting up at once) costs one preflight round trip, then the same 426 byte for byte and a link_ws_fallback:not_advertised diagnostic; while that off entry stays cached, later upgrades get 426 with no I/O
No answer yet, tunnel still connecting (restart) 426, no I/O waits at the tunnel gate up to 3 s; then 101 when the tunnel connects and the Home's own answer is on, the transient 503 when the tunnel is still connecting, or 426 when the Home answers off, the preflight fails or the tunnel fails
Draining (restart) 503 unchanged

Cost: until the Home's first answer is applied, each upgrade pays up to three tunnel-gate proofs (connected() calls) and one preflight, within the bounds the code already has: a tunnel hold of up to 3 s, a preflight limit of 5 s, a whole-setup budget of 8 s, and at most 4 upgrades in setup at once (a fifth gets an immediate 426, counted as cap; 8 sockets open or setting up in all). A preflight that gets no verified answer (Home unreachable) applies nothing, so the state stays unknown and the next upgrade tries again. The one new cost is latency: while the Home is unreachable, a new session can wait up to 8 s for its answer, where it got the 426 at once before: 5 s or more when the Home stays silent at the preflight behind a connected tunnel, 3 s and then a 503 while the tunnel is still connecting, and no wait when the tunnel has failed or the preflight is refused or reset. Security is unchanged: a try still passes the no-Origin check, the link key, the caps, the tunnel gate and the Home's verified answer, and it adds only a preflight that any relayed HTTP request already causes.

Measurement it makes real

tests/e2e-style/link-websocket-child-restart.test.ts in #8681 (lane G) models this rule as its try-when-unknown variant: the replacement Child's advertised seam tries on every upgrade. In that scenario the Home always advertises, so the replacement's cache is only ever unknown or on. This change behaves identically there, and its four try-when-unknown cases (restart 1 s and 5.5 s, stream_max_retries 3 and 5) become the real Child's behaviour. Per that measurement, the running turn stays on the WebSocket for every 1 s restart and for the 5.5 s restart at 5 retries; at 3 retries a 5.5 s restart still ends that turn on HTTP. The close-at-drain half of its both variant is not built; its today variant keeps its explicit seam, so it still measures the old rule.

What keeps it inert

wanted() checks the Child's release gate (linkWebsocketChildReady(), false in every build until the gate-opening change) before it reads the cache. With the gate closed it returns false before the new state is consulted, so the ingress answers today's 426 with no I/O, no counting and no diagnostic, exactly as before. HTTP relaying, byte accounting and the Home are untouched.

Tests

  • tests/clients/link-ws-unknown-try.test.ts (new) runs a real Child listener in front of the raw-TCP stand-in Home, with an empty cache and no probe beforehand. Cases:
    • an advertising Home: the upgrade gets 101 and frames flow both ways;
    • an old Home: exactly one preflight connection and today's 426 body; the second upgrade is 426 with no connection and no second diagnostic;
    • a tunnel still connecting: the upgrade waits and gets 101;
    • a tunnel still connecting when the hold ends: 503 and no Home connection;
    • controls that pass on the tests-first commit (9fe9a57c5): a closed gate, the opt-out and a cached off each answer 426 with no connection.
  • tests/clients/link-ws-advertisement.test.ts: one new unit case. The state is unknown until an answer is applied, undefined is off, and eviction returns a link to unknown while its watermark still refuses an older answer.
  • Failed first: on the tests-first commit (9fe9a57c5: the read-only accessor added, wanted() unchanged), the four "try" cases failed: 426 where 101 or 503 was expected, and no preflight against the old Home. The controls and the unit case passed there. On the base itself, the suites also fail to load the new accessor.

Verification

  • bun run typecheck: exit 0

  • bun run privacy:scan: exit 0

  • bun run structure:check: exit 0

  • TMPDIR=/tmp bun scripts/test.ts --parallel=2 over every Child link WebSocket file (tests/clients/link-ws-*.test.ts, client-machine-listener, tests/e2e-style/link-websocket-release-gate.test.ts, tests/e2e-style/link-ws-child-home.test.ts): exit 0, 166 pass, 7 skip (the opt-in release-gate scenarios), 0 fail

  • same runner over link-ws-unknown-try, link-ws-advertisement, link-boundary, client-link-relay, the layout tests and the file-size, structure and import-cycle ratchets: exit 0, 169 pass, 0 fail

  • T6-7a-2 at 41da4de22 (the two later commits change one comment and one structure sentence): TMPDIR=/tmp bun scripts/test.ts --parallel=2 over link-ws-advertisement, link-ws-unknown-try, client-machine-listener, link-ws-relay, link-boundary, the layout test and the file-size and structure ratchets: exit 0, 134 pass, 0 fail. At the final head: bun run typecheck, bun run structure:check and bun run privacy:scan each exit 0.

NOT RUN: the full suite, test changed (CI runs it), tests/e2e-style/link-websocket-rss.test.ts, the opt-in release-gate scenarios with the pinned Codex, macOS and Windows.

Left as a documented limit

The restart's ordering is unchanged: the replacement ocx start is spawned only after the old listener's drain ends, and connections are refused in between. Until lane G has measured that window, the claim for the gate-opening change at Codex's default 3 retries is: a Child restart ends a running turn's WebSocket session, the turn completes over HTTP, and the next session returns to the WebSocket. The two options for shortening the window (spawn the replacement once the listener stops accepting, or pre-start it and let it wait for the port) go into the gate-opening devlog unit once it is on dev.

Review

T6-7a-1: one round with gpt-6.1-terra at xhigh, read-only: no P0-P2. It confirmed that a closed gate returns before the cache is read; that Origin, credentials, caps and the tunnel gate come before the Home preflight; that the upgrade needs its own verified, nonce-bound on; and that the ordering rules are unchanged. Its one P3 (the structure sentence overstated the one-preflight cost) was fixed.

T6-7a-2 answers the final review of 041dd3ac7, one commit per finding:

  • the drain exception no longer swallows the opt-out (only a cached off goes to the 503 while draining);
  • only a preflight without a verified answer leaves the link unknown (a setup that fails after a verified answer has already applied it);
  • the restart test title and its assertion say unknown;
  • the machine-listener.ts comment points at wanted()'s rule, including the drain exception;
  • the coverage list names link-ws-unknown-try;
  • a cached off holds, while its entry stays cached, until a newer preflight replaces it, also after a Home key change on the same link id.

A second terra round on those fixes found no P0-P2. Its two P3s (eviction, and the drain exception in the comment) are fixed.

Checklist

  • Test-first: the new cases failed on the tests-first commit (9fe9a57c5) for the stated reason
  • New test file registered in scripts/test-layout/layout-clients.json and tests/fixtures/test-layout-expected.json
  • structure/remote-link.md updated for the owned area
  • Inert while the Child's release gate is closed

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Nov 13, 2026
@lidge-jun
lidge-jun marked this pull request as ready for review November 13, 2026 10:14
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 10:14
@lidge-jun
lidge-jun merged commit 4aa5dc4 into dev Nov 13, 2026
36 checks passed
@lidge-jun
lidge-jun deleted the feat/link-websocket-advert-unknown-try branch November 13, 2026 10:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T10:15:42.875830Z e4ce0c2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lidge-jun added a commit that referenced this pull request Nov 13, 2026
…the restart measurement; the old rule stays for comparison
lidge-jun added a commit that referenced this pull request Nov 13, 2026
lidge-jun added a commit that referenced this pull request Nov 13, 2026
…t, and make the fingerprints test assert the exact count after each change of state (#8679)

* docs(devlog): what opening the link WebSocket gates of both Children still needs

* docs(structure): the ocx-child link WebSocket paragraph states its two present limits and no open work

* docs(ocx-child): drop the design-addendum labels from the link WebSocket comments and point open work at the devlog unit

* test(server): the fingerprints test waits for a change of state and asserts the exact mark count after it

* docs(devlog): the restart items from measurements with the pinned Codex (refused counts like a 503)

* docs(link): the ocx-child control deadline limit applies to a pong on the same leg, including a ping from Codex

* docs(devlog): record that the 9.2 controlled validation and the U15 measurement are skipped

* test(server): say which wrong counts the fingerprints test reports as a mismatch and which still time out

* docs(ocx-child): drop the lane labels that point outside the repository

* docs(structure): a failed local upgrade Bun already opened counts as a stop, and the Child is stricter on its own oversized close

* docs(devlog): the counting item names the two comments left and the 1015 decision

* docs(devlog): the restart item carries the refused window, its two fixes and the claim until one is measured

* docs(link): the restart drain keeps the WebSocket only within Codex retry budget, and the restart claim is conditional

* docs(devlog): name the rule that lets the next session try at once

* docs(devlog): state the restart claim as conditions for completing the turn and for returning to the WebSocket

* docs(devlog): ocx-child still answers 426 until it has learned the advertisement; bring it the try-when-unknown rule

* docs(devlog): item 11 names the drain exception for a cached off

* docs(devlog): item 6 names the third comment, at the failed server.upgrade

* docs(devlog): item 4 names the drain exception for a cached off

* docs(devlog): an HTTP resend that still reaches the old listener gets the relay's 503, whose retry budget is not measured

* docs(link): the machine listener comment says a cached off still tries while the relay drains

* docs(structure): a cached off is replaced only by a verified answer, and the route-intent poll is a preflight too

* docs(structure): the retry figure is a measurement of the pinned codex-rs, with its source

* docs(devlog): items 3, 4 and 11 say the try-when-unknown rule has landed in #8682

* docs(structure): drop the lane label from the TypeScript Child link WebSocket paragraph

* docs(devlog): reaching the replacement over HTTP depends on how Codex handles the old listener's 503

* docs(devlog): the route-intent poll is one source of the first answer, not the only one

* docs(link): the drain comment keeps the WebSocket session only within Codex's retry budget

* docs(structure): a cached off counts draining during a restart drain

* docs(link): a failed local upgrade Bun had opened also counts as a stop, besides the handshake fallback

* docs(devlog): item 4 lists the parity report and the readiness probe among the first answers

* docs(devlog): the restart claim keeps its budget condition, and the HTTP 503 retry is read from the Codex source
lidge-jun added a commit that referenced this pull request Nov 13, 2026
lidge-jun added a commit that referenced this pull request Nov 13, 2026
…assertion, the gate scenarios through the real Child, a Child restart measurement, and the Autobahn client conformance run (#8681)

* test(link): record the attested digest of the pinned Codex for the link WebSocket release gate

tests/fixtures/link-gate-codex.json now carries the sha256 of codex-rs built at
openai/codex 88c58562580aa4abe2da6ce4d7676bf171682230 for x86_64-unknown-linux-gnu,
and its note records who built it, when, with which toolchain, target and command.
With this digest, a run of tests/e2e-style/link-websocket-release-gate.test.ts with
that binary is labelled release evidence; any other binary stays a smoke check.
The revision is unchanged. structure/remote-link.md no longer says the fixture
records none, and states that the digest attests one Linux x86_64 build.

Nothing opens the gate: linkWebsocketTransportReady() stays false.

* test(link): assert the pinned Codex sends no Origin on its link WebSocket upgrade (U11)

Design T4 U11 needed a release-gate test that Codex's WebSocket client sends no
Origin header; until now the gate showed it only indirectly (the Home refuses an
upgrade carrying one). The relay stand-in now records the Origin header of every
upgrade Codex sends, before forwarding it, and the gate's drain scenario asserts
that every upgrade of both sessions arrived without one.

The release-gate labels, the codex exec runner and the fixture turns move
unchanged into tests/helpers/link-gate-codex.ts, so the real-Child scenarios that
follow label their runs with the same digest check. The gate's scenario bodies
are unchanged; runCodex takes an optional stream_max_retries, default 3 as before.

* test(link): hash and run the same copy of the pinned Codex in the release gate (#8668 review P2-1)

The gate hashed OCX_LINK_GATE_CODEX relative to the working directory and then
spawned the value as given, which Bun looks up on PATH for a bare name. With
OCX_LINK_GATE_CODEX=codex, the attested bytes saved as ./codex and another codex on
PATH, every title said "release gate" while the PATH binary ran; the file could
also be replaced between the hash at module load and the spawns.

The value is now resolved once to an executable regular file (anything else is
refused and the scenarios are skipped), copied read-only into a scratch
directory, and that copy is both hashed and spawned by absolute path
(tests/helpers/link-gate-binary.ts). tests/e2e-style/link-gate-codex-binary.test.ts
covers a bare name with another codex on PATH, a replacement after hashing, and
refused values, with two small scripts instead of Codex; all three cases failed
against the earlier behaviour. structure/remote-link.md describes the copy and
says the smoke rule once, for each Codex scenario's title (P3-1).

* test(link): name #8668 and the build directory in the pinned Codex attestation note

The note now says the attestation was made in #8668, and lists another build
directory among the things that may change the digest (rustc embeds absolute
paths). Review P3-2.

* test(link): make the pinned-Codex copy test portable and clean the copy up on every path

Review of the previous commit:
- tests/e2e-style/link-gate-codex-binary.test.ts used #!/bin/sh scripts and a
  colon-separated PATH, which the Windows shards cannot run. The stand-ins for
  Codex are now copies of the running Bun executable named codex (codex.exe on
  Windows); each prints its own process.execPath, so a run shows which file
  executed. PATH is joined with path.delimiter, and the execute-permission case
  is POSIX-only. Against the earlier behaviour the bare-name case reports the
  PATH copy (bin/codex) where the hashed file (work/codex) was expected.
- The copy keeps the file's name, so an extension a platform needs stays.
- The gate registers the scratch cleanup before copying, and removes the
  scratch directory at once when the value is refused or preparing it throws.

* test(link): run the pinned-Codex release-gate scenarios through the real Child relay

tests/e2e-style/link-websocket-child-gate.test.ts drives the pinned Codex through
the real TypeScript Child listener and relay (lane T6) in front of a real Home,
where the gate file uses a test-only stand-in. It is opt-in on
OCX_LINK_GATE_CODEX and labelled exactly as the gate file. Scenarios:
- the switch goes off under a running turn: both requests of the turn run on the
  Child's one socket, and the next session's upgrade is answered 426 by the Child
  (not_advertised) and completes over HTTP;
- the drain past its deadline: the tool result's create is fenced and never
  reaches the upstream, and the same request completes over HTTP;
- design 11.2-8 (a): with the Child's own 101 carrying the 8 MiB limit, a larger
  request goes over HTTP while the socket is open;
- a Home restart mid-turn: the turn completes after Codex reconnects (logged:
  the cut request ends 502 on the socket and Codex completes on a new socket).
It observes the Child's link WebSocket diagnostics and the Home's request-log
rows. Which side closes a fenced socket first is a race between the Home and
Codex exiting, so the close is asserted without its side.

* test(link): prove through a TCP tap that the oversized request never went on the real Child's socket

The real-Child 11.2-8 (a) scenario asserted only that a socket opened, that no
upgrade fell back and that the Home saw one HTTP row; an oversized message the
Child refused with 1009 before the Home, followed by an HTTP retry, would have
passed it too. A TCP tap between Codex and the Child now records each
connection's request head, the Child's answer head and the bytes Codex sent after
its request head. The scenario asserts that the Child's 101 carries
x-codex-websocket-max-message-bytes at the 8 MiB limit, that Codex wrote less
than the limit on every upgraded connection, and that the whole body went on one
POST connection of its own. Raising the Child's limit to 64 MiB makes Codex send
8,408,470 bytes on the socket and the scenario fail.

* test(link): pin the 8 MiB the real Child must advertise to the design value, not the Child constant

The 11.2-8 (a) scenario took its expected header value and its size threshold from LINK_CHILD_WS_LIMITS.localMessageBytes, the constant the Child itself uses, and matched the header as a substring. It now parses x-codex-websocket-max-message-bytes and requires exactly 8388608 (design T4 6.1), and uses that fixed value for the request size and the byte checks.

* test(link): type the TCP tap chunks in the real-Child release-gate scenarios

bun check reported the tap callbacks taking string | Buffer; they receive Buffers. No behaviour change.

* test(link): measure a real Child restart under a running pinned-Codex turn, today and with T6's two proposed fixes

tests/e2e-style/link-websocket-child-restart.test.ts restarts the real
TypeScript Child between the two requests of a pinned-Codex turn, in the order
the runtime follows since #8658: the tunnel gate's onStopping drains the relay
(sockets close 1001, upgrades get 503), the old listener stays bound for the
drain phase, stops (refused), and a replacement binds the same port with no
advertisement remembered. Variants model lane T6's proposals before they
exist: the listener closing when the drain starts, and the replacement treating
"no advertisement since start" as "try" (the relay's advertised seam), and both.
Each runs with stream_max_retries 3 and 5, for a 5.5 s and a 1 s restart.

The cases assert only that the turn completes; the transport it ends on, the
503s, the replacement's 426s and Codex's retry notices are printed as one JSON
line per case. The restart phases are wall-clock waits against an external
process, by design. runGateCodex gains an optional stderr line callback.

* docs(link): say that only the Codex scenarios are skipped without the pinned binary (#8668 review P3-3)

structure/remote-link.md and the gate file comment said every case is skipped when OCX_LINK_GATE_CODEX is absent; the pin test always runs.

* test(link): give the codex on PATH other bytes, so the digest tells it from the hashed file (#8668 review P3-4)

Both stand-ins were copies of the same Bun executable, so the digest assertion could not tell work/codex from bin/codex. The PATH-side file now holds other bytes (mode 0755; the gate must never run it), and the test asserts the digest differs from its hash. Against c28e59a behaviour the bare name runs that PATH file (ENOEXEC), a replaced file is what runs (ENOEXEC), and a directory throws EISDIR while hashing; a 0644 file was already refused.

* test(link): reflink the pinned-Codex copy where the file system can (#8668 review P3-5)

The copy now uses COPYFILE_EXCL | COPYFILE_FICLONE, so the 1.6 GB binary costs no space on APFS, btrfs or XFS, and an interrupted direct run leaves nothing large behind there. Checked on Bun 1.4.4: with FICLONE the exclusive flag still refuses an existing destination (EEXIST) and keeps it; on ext4 the copy falls back to an ordinary one. A new case makes the first copy writable and requires EEXIST for a second copy into the same scratch directory; without COPYFILE_EXCL it fails.

* docs(link): describe the Child restart measurement in the release-gate paragraph

* test(link): mark the restart measurement turn when Codex actually exits

The codex exit mark was written after the replacement Child was bound and the run awaited, so a turn that ended early (over HTTP through the draining Child) had its boundary at the bind. It is now marked when the process exits, and the first-session counts stop there.

* test(link): mark the restart turn at the Codex process exit itself, not after its output is collected

runGateCodex resolves once the process exited and its stdout and stderr were read; the restart measurement marked the exit there, which output draining could delay. runGateCodex gains an onExit callback fired from child.exited, and the measurement uses it to bound the first session.

* test(link): the Autobahn fuzzingserver client conformance run for the Child link WebSocket leg (design 3.3)

tests/clients/link-ws-autobahn.test.ts drives every fuzzingserver case through the Child's own 101 check and a real HomeLeg, with an echo stub in place of Codex that sends one message at a time as Codex does. It is opt-in on a running fuzzingserver (OCX_LINK_WS_AUTOBAHN_URL) and its report directory (OCX_LINK_WS_AUTOBAHN_REPORTS), and it judges each case against reviewed rules in tests/fixtures/link-ws-autobahn-expectations.json: deflate cases unimplemented (the Child offers no extension), a Home message over 4 MiB + 64 KiB or over 4,096 data frames closed 1009, other binary messages closed 1003, everything else OK, NON-STRICT or INFORMATIONAL. Against crossbario/autobahn-testsuite@sha256:519915fb...3074 all 517 cases land in their class.

* test(link): make the Autobahn harness enforce every condition its verdict rests on

Review of 559c34c: a refusal (1003, 1009) now also requires, from the case report, that the Child sent nothing but a close frame and that the close was clean with no handshake or drop timeout; the deflate cases require UNIMPLEMENTED with a clean OK close; each run uses its own agent name, so a report left in the directory by an earlier run cannot supply the verdict, and a control exchange that does not close 1000 fails the run; setting only one of the two variables fails and names the other; the run prints the expectations sha256, the agent and the server.

* test(link): accept the fuzzingserver control close without a status code (1005)

The fuzzingserver ends getCaseCount and updateReports with a close frame that carries no code, which Bun reports as 1005; a dropped connection (1006) or any other code still fails the run.

* test(link): fail an Autobahn refusal case whose report has no valid frame statistics

A missing or malformed rxFrameStats was read as no frames, which would pass the no-data check; it now fails the case, and a refusal must also show the Child's close frame.

* test(link): commit the recorded Autobahn run and refuse a fuzzingserver off loopback (#8681 review P2-1)

structure/remote-link.md described a pinned image and a loopback binding that nothing in the tree started or checked. tests/fixtures/link-ws-autobahn/ now holds the fuzzingserver spec (every case) and run.sh, the recorded run: it starts crossbario/autobahn-testsuite@sha256:519915fb...3074 with that spec, publishes it on 127.0.0.1:9001 only, waits for it, runs the test, removes the container and writes provenance (commit, clean tree, Bun, image, expectations and spec sha256, command, exit) and the report tarball with its sha256. The test refuses an OCX_LINK_WS_AUTOBAHN_URL whose host is not loopback, and the structure sentence cites the script.

* test(link): pin the Autobahn case set (#8681 review P3-1)

The expectations file records caseCount 517 and the run asserts the server reports exactly that many cases, and that every rule matches at least one case of the run, so a different suite or a stale rule fails instead of passing on a subset.

* test(link): require a clean close in every Autobahn class and check the stated limits against the Child (#8681 review P3-2)

The comment said the clean close is checked for every class, but the pass class did not use it; it now does. The expectations file states the Home message and fragment limits its 1009 rules are written for; the run now asserts they equal LINK_CHILD_WS_LIMITS.

* test(link): keep the pinned-Codex copy for the whole process and remove it at exit (#8681 review P3-3)

The copy lives once per module registry. Each file removed it from its afterAll, so a plain multi-file bun test (one shared registry) removed it under the next file, whose scenarios then failed with spawn ENOENT while titled release gate (reproduced: real-Child file then gate file, 7 failures). The helper now removes it once, when the process exits, and at once when the value is refused or preparing it throws; the per-file afterAll calls are gone. The same two files in one run now pass 12 of 12, and a plain process that loaded the helper leaves no copy behind.

* test(link): title the real-Child drain scenarios with what they assert (#8681 review P3-4)

The titles said the idle socket is fenced and the next create is fenced on the socket, but the assertions accept a close from either side, and Codex closed first in every recorded run. The titles now say what is asserted: the turn finishes on the socket (or its tool result never reaches the upstream over it), the socket closes from either side, and the request completes over HTTP. The fence itself is shown by the stand-in scenarios in the gate file.

* test(link): require exactly one socket in the real-Child 11.2-8 (a) scenario (#8681 review P3-5)

At least one upgraded connection allowed a loop in which Codex ignores the advertised limit, is cut under 8 MiB per attempt and ends on HTTP with every assertion passing. The scenario now requires exactly one upgraded connection through the tap and exactly one link_ws_open record.

* test(link): end the waits on Codex exiting first, and say where the scenarios wait on time (#8681 review P3-6)

The restart measurement waited for the tool result to reach the Home, and the real-Child Home restart for the first request, without racing Codex exiting: a binary that fails early cost the 180 s bound per case, with no stderr. untilOrExit (tests/helpers/link-gate-codex.ts) ends such a wait at once with Codex exit code and the tail of its stderr, and leaves nothing behind when Codex exits after the event. With a fake codex that exits 3 at start, both cases now fail within a second naming it. The helper header no longer says the scenarios never sleep: the restart phases are wall-clock waits by design.

* docs(link): say what a Child restart drain does to the Codex session, as measured (#8681 review P3-7)

structure/remote-link.md said the drain 503 lets Codex keep its WebSocket session for the replacement instead of falling back to HTTP. With the pinned Codex every 503, like a refused or dropped connect, spends one stream retry, and the four today cases of the restart measurement ended the interrupted turn on HTTP. Only that clause of the sentence changes.

* test(link): end the stand-in Home restart wait on Codex exiting first

Review of G-2-3: the gate file Home restart scenario still awaited the first request without racing Codex exiting. It now uses untilOrExit, as the helper header says every wait on an event does; with a fake codex that exits 3 at start it fails within a second naming its stderr.

* test(link): end untilOrExit when the Codex run itself rejects before the event

Review of G-2-3: a rejected run (its output could not be read) was swallowed, so the wait held until the test bound. It now rejects the wait when it comes before the event, and is still handled after it. Checked with three probe cases (rejecting run, early exit, late settle): all pass with no unhandled rejection.

* test(link): describe the real-Child drain cases by what they observe, not by a fence they do not establish

Review of G-2-3: comments in the real-Child file still said the create was fenced; the assertions accept a close from either side and establish only the upstream and transport outcomes. The comments now say so and point to the stand-in scenario for the fence.

* test(link): connect to an IPv6 loopback fuzzingserver without the URL brackets

Review of G-2-3: the loopback check accepts http://[::1]:9001, whose URL.hostname keeps the brackets, which node:net cannot connect to. The case runner now strips them. The recorded runs use 127.0.0.1 and are unaffected.

* test(link): name try-when-unknown as the Child's rule since #8682 in the restart measurement; the old rule stays for comparison

* docs(structure): the restart measurement names try-when-unknown as the Child's rule since #8682

* test(link): run try-when-unknown through the relay's default rule in the restart measurement; count the replacement's answers around its fetch

* test(link): say what --isolate does to the pinned Codex copy

* test(link): run.sh refuses a used run directory and stops when the fuzzingserver never answers

* docs(structure): the Autobahn run.sh is the recording script

* test(link): the real-Child switch case says the 426 is answered without forwarding the upgrade

* docs(structure): the measured restart outcomes are from one Linux x86_64 machine, printed, not asserted

* docs(devlog): gate-opening item 4: #8681 already runs the restart scenarios under #8682 rule, through test seams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant