Skip to content

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

Merged
lidge-jun merged 8 commits into
devfrom
test/link-gate-codex-digest
Nov 13, 2026
Merged

lidge-jun merged 8 commits into
devfrom
test/link-gate-codex-digest

Conversation

@lidge-jun

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

Copy link
Copy Markdown
Owner

Summary

The link WebSocket release gate (design T4 11.1 item 13, tests/e2e-style/link-websocket-release-gate.test.ts) runs the pinned Codex binary as its client. A run counts as release evidence only when that binary's sha256 equals the digest in tests/fixtures/link-gate-codex.json. Until now the digest was null: no build of codex-rs at openai/codex 88c58562580aa4abe2da6ce4d7676bf171682230 had been attested, so every run was labelled a smoke check.

This PR records the digest of one attested build of that revision and replaces the fixture's note with the build facts. "revision" is unchanged. structure/remote-link.md no longer says the fixture "records none until a build is attested"; it now says the digest attests one Linux x86_64 build and that a run with any binary whose digest differs is a smoke check by design (a second build with identical bytes would get the gate label). The gate stays closed: linkWebsocketTransportReady() (Home) and linkWebsocketChildReady() (Child) are still hard-coded false, and nothing in src/ changes.

What is hashed is what runs. The gate resolves OCX_LINK_GATE_CODEX once to an executable regular file (anything else is refused and the scenarios are skipped), copies it, exclusively and read-only (0555), into a fresh private scratch directory, and both hashes and spawns that copy by absolute path (tests/helpers/link-gate-binary.ts). The copy is a reflink where the file system supports one (APFS, btrfs, XFS) and an ordinary copy elsewhere. Before this, it hashed the value relative to the working directory and 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, and the file could be replaced between the hash and the spawns. tests/e2e-style/link-gate-codex-binary.test.ts covers four things: a bare name with another codex on PATH, a replacement after hashing, a second copy into the same scratch directory (refused with EEXIST) and refused values. The hashed stand-in is a copy of the running Bun executable named codex (codex.exe on Windows), which prints its own path, so the test runs on every platform. The codex on PATH holds other bytes (mode 0755) and never has to run, so the digest tells the two apart. The execute-permission case is POSIX-only. Against c28e59ae6's behaviour, three cases fail: the bare name runs the codex on PATH (its spawn fails with ENOEXEC); the replacement case runs the replaced file (ENOEXEC); and a directory passes the X_OK check and then fails hashing with EISDIR. c28e59ae6 already refused a 0644 file. The scratch copy is removed after the file, and at once when the value is refused or preparing it throws.

What the digest attests. The table is the builder's attestation (this lane): the digest, the failures, the OOM kills and the timings are backed by the build logs and the kernel log; the source commit, toolchain, OS, compiler and package versions were read on the build VM right after the build (environment.txt) and are builder-reported for build time. The small receipts are in this description ("Receipts", below). The build VM keeps the binary, the logs and the kernel log. The coordinator holds a second copy of the binary and the receipts (listed under "Receipts"); the binary's sha256 matched c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c on arrival. c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c is the sha256 of codex-rs/target/release/codex, built by OpenCodex agent lane G on its build VM on 2026-11-13 (successful build 05:35:07Z–06:54:37Z UTC, from the system clock):

Fact Value
Source openai/codex 88c58562580aa4abe2da6ce4d7676bf171682230, shallow fetch of that commit; git rev-parse HEAD matched right after the fetch and again after the build, when git status --porcelain was empty (the build writes only to the ignored target/)
Command (in codex-rs/) cargo build --release --locked -j 1 -p codex-cli --bin codex
Toolchain rustc 1.95.0 (59807616e 2026-04-14, LLVM 22.1.2), cargo 1.95.0 (f2d3ce0bd 2026-03-21); rustup picked it from the revision's rust-toolchain.toml (channel = "1.95.0"), with no default toolchain set
Target / host x86_64-unknown-linux-gnu (native)
Build directory an absolute path under the builder's home directory; rustc embeds absolute paths in the binary, so another build directory may change the digest
OS Ubuntu 24.04.5 LTS, Linux 6.12.113 x86_64, glibc 2.39, cc = clang 18.1.3
System packages added libcap-dev 1:2.66-5ubuntu2.4 (the vendored bubblewrap needs it), libssl-dev 3.0.13-0ubuntu3.16 (openssl-sys needs it)
Profile the revision's [profile.release], unchanged: lto = "thin", codegen-units = 4, debug = "line-tables-only", split-debuginfo = "off", strip = false. No RUSTFLAGS or CARGO_PROFILE_* overrides
Jobs -j 1. At the default width (4), codex-core and codex-app-server were killed with SIGKILL (build-attempt2.log); the kernel log shows the memory-cgroup OOM killer killing two rustc processes at 05:29:44 and 05:30:23 UTC (oom-kernel-log.txt; 16 GiB, no swap). Job count does not change the profile; in principle the output does not depend on it, but that was not checked by building at another width
Duration 79 min 30 s for the final -j 1 invocation (real 79m29.651s, user 77m54s), which reused the crates compiled by the two earlier attempts. Total build time across the three attempts was about 1 h 42 min (7.5 + 15.1 + 79.5 min)
Binary 1,618,990,456 bytes, ELF 64-bit PIE, dynamically linked (libssl.so.3, libcrypto.so.3, libgcc_s, libm, libc), not stripped
codex --version codex-cli 0.0.0 (a source build carries no release version, so the version string does not identify the revision; the digest does)

This is one attested build, not a reproducible one. It was not built twice and the digest was not compared across builders. A second builder trying to get the same bytes would have to match at least: the source commit and Cargo.lock (--locked), the same git dependencies at the locked revisions, the toolchain (1.95.0 x86_64-unknown-linux-gnu with its bundled LLVM), the release profile and an empty RUSTFLAGS, the C compiler and its version (clang 18.1.3 as cc) for the cc-built crates (bubblewrap, sqlite, zstd, tree-sitter and others), the system libcap and OpenSSL development headers, and the absolute build paths, which rustc embeds in panic locations and debug info (the Codex checkout, the Cargo home and the rustup home, all under the builder's home directory). Any difference may change the digest. Then the build is a different binary, and its gate runs are labelled smoke. The fixture keeps one digest; see "Proposal" below for more than one platform.

Gate results

Smoke run first, with the digest still null (on 7316cb7d6): 8 pass, 0 fail, exit 0, 10 s. Every Codex scenario was titled [smoke only, not release evidence: Codex sha256 c80d5ba4… is not the reviewed digest for openai/codex 88c5856 (tests/fixtures/link-gate-codex.json records none yet)]. No scenario failed, so no stand-in, Child, Home or Codex discrepancy needed analysis. The design's assumptions C1 (426 switches to HTTP), C5 (retry budget then HTTP) and C7 (the max-message header keeps a larger request off the socket) all held for this binary.

Gate runs with the digest recorded, three in sequence on this PR's head 248e7321d, with an absolute binary path (full output under "Receipts"). Earlier sets of three were also 8/8 each: on two local commits made before the rebase and the first review (never pushed), and on c28e59ae6, dab27510e and 6fe94b208.

Run Exit Wall Result Titles with the gate label
1 0 8.79 s 8 pass, 0 fail 7 of 7
2 0 8.95 s 8 pass, 0 fail 7 of 7
3 0 8.92 s 8 pass, 0 fail 7 of 7

Each Codex scenario's title ends in [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json]:

  1. the reviewed pin names the design's Codex revision and a digest of the right shape, or none yet (no Codex; unlabelled): pass ×3
  2. drain: the switch goes off under a running turn; it finishes and its tool result is admitted, the idle socket is fenced, and the next session ends on HTTP: pass ×3 (841, 879, 852 ms)
  3. drain past its deadline: the session's next create is fenced on the socket, costs one retry, and the same request completes over HTTP: pass ×3 (522, 549, 509 ms)
  4. a request over the 8 MiB message limit goes over HTTP: pass ×3 (1145, 1278, 1231 ms)
  5. control: without the advertised limit, Codex does send the oversized request on the socket: pass ×3 (1227, 1234, 1226 ms)
  6. a Home restart mid-turn: the turn completes after Codex reconnects: pass ×3 (513, 526, 554 ms)
  7. the 503 sequence while the Child's tunnel reconnects recovers on the WebSocket once the tunnel is back: pass ×3 (571, 497, 553 ms)
  8. the 503 sequence while the Child's tunnel reconnects ends on HTTP when the tunnel stays down past Codex's retry budget: pass ×3 (1839, 1886, 1882 ms)

None of the gate's runs needs credentials or network access to a model provider: Codex talks to a loopback stand-in or the real Child listener in front of an in-process Home whose upstream is a loopback fixture, with scratch HOME and CODEX_HOME and an explicit environment.

U11 was also checked outside the suite, with an untracked probe server: the pinned binary's single WebSocket upgrade carried no Origin header. It does carry Sec-WebSocket-Extensions, which both the stand-in and the real Child strip before the Home's shape check.

Release-gate evidence inventory (design T4)

The design (T4, a private lane note, not in this repository) has no section 11.3 in its current revision. The review table's "11.3" references (R1-10 "11.3-11", R2-06 "11.3") point to the T6 gates that are now 11.2: the Autobahn client run and the size cases 11.2-8. They are listed under those numbers below.

Item Test on dev Ran in G-1 Status
11.1-13 drain fence retry ending on HTTP gate file, "drain past its deadline" (and "drain: the switch goes off…") yes ×3 + smoke pass, release-labelled. Through the relay stand-in, not lane T6's Child relay
11.1-13 8 MiB header sends a larger request over HTTP gate file, "a request over the 8 MiB…" + control yes ×3 pass. Stand-in, not the real Child
11.1-13 Home restart mid-turn gate file, "a Home restart mid-turn" yes ×3 pass. Stand-in. Which transport carries the completing retry is not asserted (C4/C5, by design)
11.1-13 503 sequence, recovering on WS / ending on HTTP gate file, the two "503 sequence" cases yes ×3 pass. Real Child listener (startChild), but the tunnel gate is test-driven: waitForConnected resolves at once, so the 3 s and 15 s hold durations are not exercised in real time
11.2-8 (a) pinned-Codex request > 8 MiB goes over HTTP before sending gate file "a request over the 8 MiB…" (stand-in's 101); the real Child's 101 header is in tests/clients/link-ws-relay.test.ts:91 with a scripted client yes (gate) partial: no single test runs pinned Codex through the real Child for this case
11.2-8 (b) scripted client ignoring the header: 9 MiB unfragmented and fragmented → 1009 before any response text tests/clients/link-ws-relay.test.ts:178 (8 MiB + 1, unfragmented, Bun client) no partial: the fragmented Codex→Child case is missing (the framer's fragmented 1009 at tests/clients/link-ws-framer.test.ts:95 covers server frames read by the Child, the other direction)
11.2-8 (c) Home message > 4 MiB + 64 KiB, before and after response text → 1011, pinned Codex retries tests/clients/link-ws-relay.test.ts:189 (oversized Home message before any text: Codex 1011, Home 1009). :199/:211/:450 deliver a completed message before a refused frame, but the refused frame there is an RSV-bit protocol error (Home 1002), not an oversized message. A scripted client's retry after a dropped Home (1011) is in tests/clients/link-ws-fallback.test.ts:124 no partial: the oversized Home message after response text began is missing, and so is a pinned-Codex retry after the 1011
11.2-9 backpressure, refusal on failed reservation tests/clients/link-ws-relay.test.ts:234, :343 no exists
11.2-9 Child transport-only RSS acceptance (6.3: 8 sockets, 256 MiB) none — missing. src/client/link-websocket-limits.ts:61 keeps the Child gate closed until it passes
11.2-12 end to end, the controlled validation of 9.2 none — skipped by the owner on 2026-11-13, not measured
Autobahn fuzzingserver client conformance run (3.3, R2-06) none (no test, script or CI job) — missing. Also a condition of the Child gate (src/client/link-websocket-limits.ts:61)
U11 Codex sends no Origin no direct assertion; implied by the gate runs (the stand-in forwards Origin, and the Home's linkResponsesUpgradeShape refuses it, src/server/index/link-websocket.ts:100, so every "upgrade" assertion would fail; the real Child would record an origin fallback) probe observed for this binary (u11-probe.txt). Proposal: one explicit assertion in the gate file (the stand-in records whether the upgrade carried Origin)
U15 largest upstream chunk the pinned Bun delivers on the canonical upstream none; the RSS test uses a fixed chunk plan up to 16 MiB — skipped by the owner on 2026-11-13, not measured. It needs a measurement against the canonical upstream, which needs provider access; not in G-1's local-only scope
11.1-9 Home RSS acceptance tests/e2e-style/link-websocket-rss.test.ts (opt-in) no (by instruction) exists; see below for what counts

What the Home RSS acceptance needs to count as evidence. It runs only with OCX_LINK_WS_RSS_ACCEPTANCE=1 and no other OCX_LINK_WS_RSS_* variable set (any other turns it into a diagnostic that asserts nothing), at the full 24 sockets, on Linux 4.0 or later where the peak is the kernel's VmHWM (a sampled peak cannot pass), on the pinned Bun (1.4.4, U3). The settle logic of open PR #8647 is required: each Home announces its stall only after a 2.5 s quiet window, and a load not settled within 180 s fails. Per #8647, only settled 24-socket runs count; the four earlier runs under #8625 are not evidence. In practice it needs #8647 merged, then three settled canonical runs on a quiet machine (nothing heavy beside it, a few GiB free) at a recorded commit, with each run's WebSocket and HTTP peaks, the difference against 768 MiB, and the settle times. #8647's own table (three settled passes on 2e8b3f383) becomes evidence for that commit once it lands. It does not involve the pinned Codex.

9.2 controlled validation: skipped by the owner on 2026-11-13, not measured. For the record, what exists and what is missing. Existing pieces: the gate file's runCodex drives the pinned binary with scratch homes against a scripted loopback upstream, which can already script tool calls (toolCall) so one turn makes several model requests; startChild plus an in-process Home give a real Child-to-Home link; the Home's request-log fields (transport, continuation with reason, threadRef/turnRef, tests/server/link-request-log-fields.test.ts) supply L1 and L1d and the M2/M3 classification; the Child's ?transport=1 counters supply L2; the gate already forces a Home restart and a fallback, and setLinkWebsocketLimitsForTests can force fences. Missing:

  1. A scripted session runner: fixed prompts and fixed tool outputs over several turns, run once over HTTP and once over WebSocket, three times each, with per-attempt logs from the client side. The design wants the client's own log, not M3.
  2. A forced reconnect and a forced previous_response_not_found miss with an upstream that keeps previous responses (the gate's fixture upstream is stateless), plus a run with Codex request compression on (U8).
  3. L3: wire bytes on the link tunnel. The design's method is nettop on the Home's tunnel processes; on Linux this needs a byte-counting TCP shim between Child and Home, or real SSH tunnels with per-process counters.
  4. Real input-token counts. The acceptance compares L3 per input token on the canonical route. A fixture upstream's usage is whatever the fixture says, so a meaningful ratio needs either the canonical provider (credentials and network, outside this lane's local-only rule) or an agreed token estimate for the fixed prompts.
  5. A report that computes, per pair, WS L3/token ÷ HTTP L3/token ≤ 0.20, the spread across runs, and every forced miss ending in a completed turn.

Estimate: about 3–5 days of lane work for items 1–3 and 5 against local fixtures. Item 4 needs provider access or an agreed token estimate; without it a local harness can show the plumbing but cannot produce the 20% acceptance. The owner skipped 9.2 for now, so the gate-opening change states it as not measured.

Proposal: per-platform digests. One digest is honest for what was attested: a Linux x86_64 build. If release evidence is needed on macOS, Windows or aarch64, the fixture could become { "revision", "builds": [{ "target", "sha256", "note" }] }, and the test would accept a binary whose digest matches any reviewed build for its own process.platform/process.arch. Not built here.

Receipts

Scrubbed of user and host names. The full logs, the kernel log and the binary stay on the build VM. The coordinator holds a second copy:

  • the binary, as a gzip copy of 457,769,736 bytes; after decompression the binary's sha256 matched c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c on arrival;
  • from G-1-build: build-attempt1.log, build-attempt2.log, build.log, end-attempt1.txt, end-attempt2.txt, end.txt, environment.txt, oom-kernel-log.txt, sha256.txt, start-attempt1.txt, start-attempt2.txt, start.txt;
  • from G-1-runs: gate-1.txt, gate-2.txt, gate-3.txt (of an earlier head), pre-rebase/, smoke-1.txt, superseded-588db5f5e/, u11-probe.txt. The gate runs of this head, below, are sent to the coordinator with this change.
environment.txt (read on the build VM right after the build; line 2 is the Codex checkout's HEAD, line 3 the line count of its git status --porcelain)
captured 2026-11-13T07:07:39Z, after the build, on the build VM
88c58562580aa4abe2da6ce4d7676bf171682230
0
rustc 1.95.0 (59807616e 2026-04-14)
binary: rustc
commit-hash: 59807616e1fa2540724bfbac14d7976d7e4a3860
commit-date: 2026-04-14
host: x86_64-unknown-linux-gnu
release: 1.95.0
LLVM version: 22.1.2
cargo 1.95.0 (f2d3ce0bd 2026-03-21)
Linux 6.12.113+ x86_64
PRETTY_NAME="Ubuntu 24.04.5 LTS"
ldd (Ubuntu GLIBC 2.39-0ubuntu8.9) 2.39
Ubuntu clang version 18.1.3 (1ubuntu1)
libcap-dev:amd64 1:2.66-5ubuntu2.4
libssl-dev:amd64 3.0.13-0ubuntu3.16
-rwxrwxr-x 2 <user> <group> 1618990456 Nov 13 06:54 target/release/codex
codex-cli 0.0.0
Last lines of the successful build log
   Compiling codex-exec-server-cli v0.0.0 (~/src/codex/codex-rs/exec-server-cli)
   Compiling codex-cli v0.0.0 (~/src/codex/codex-rs/cli)
    Finished `release` profile [optimized + debuginfo] target(s) in 79m 29s

real	79m29.651s
user	77m54.013s
sys	1m38.594s
EXIT=0
sha256sum
c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c  codex-88c5856 (read-only copy of target/release/codex)
gate-1.txt (on 248e732)
bun test v1.4.4 (38afee6c8)

tests/e2e-style/link-websocket-release-gate.test.ts:
(pass) link WebSocket release gate (design 11.1 item 13) > the reviewed pin names the design's Codex revision and a digest of the right shape, or none yet [2.51ms]
🚀 opencodex proxy running on http://localhost:39145
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain: the switch goes off under a running turn; it finishes and its tool result is admitted, the idle socket is fenced, and the next session ends on HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [841.18ms]
🚀 opencodex proxy running on http://localhost:43495
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain past its deadline: the session's next create is fenced on the socket, costs one retry, and the same request completes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [522.10ms]
🚀 opencodex proxy running on http://localhost:35993
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a request over the 8 MiB message limit goes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1145.26ms]
🚀 opencodex proxy running on http://localhost:39679
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > control: without the advertised limit, Codex does send the oversized request on the socket [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1226.90ms]
🚀 opencodex proxy running on http://localhost:45385
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
🚀 opencodex proxy running on http://localhost:35151
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a Home restart mid-turn: the turn completes after Codex reconnects [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [513.22ms]
🚀 opencodex proxy running on http://localhost:40033
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects recovers on the WebSocket once the tunnel is back [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [571.09ms]
🚀 opencodex proxy running on http://localhost:32855
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects ends on HTTP when the tunnel stays down past Codex's retry budget [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1838.69ms]

 8 pass
 0 fail
 47 expect() calls
Ran 8 tests across 1 file. [8.78s]
exit=0 wall_ms=8788 head=248e7321d at=2026-11-13T08:24:50Z
gate-2.txt (on 248e732)
bun test v1.4.4 (38afee6c8)

tests/e2e-style/link-websocket-release-gate.test.ts:
(pass) link WebSocket release gate (design 11.1 item 13) > the reviewed pin names the design's Codex revision and a digest of the right shape, or none yet [0.51ms]
🚀 opencodex proxy running on http://localhost:41791
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain: the switch goes off under a running turn; it finishes and its tool result is admitted, the idle socket is fenced, and the next session ends on HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [879.15ms]
🚀 opencodex proxy running on http://localhost:33441
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain past its deadline: the session's next create is fenced on the socket, costs one retry, and the same request completes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [549.24ms]
🚀 opencodex proxy running on http://localhost:37383
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a request over the 8 MiB message limit goes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1278.44ms]
🚀 opencodex proxy running on http://localhost:44751
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > control: without the advertised limit, Codex does send the oversized request on the socket [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1234.41ms]
🚀 opencodex proxy running on http://localhost:37031
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
🚀 opencodex proxy running on http://localhost:41687
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a Home restart mid-turn: the turn completes after Codex reconnects [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [525.66ms]
🚀 opencodex proxy running on http://localhost:43199
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects recovers on the WebSocket once the tunnel is back [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [496.72ms]
🚀 opencodex proxy running on http://localhost:44835
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects ends on HTTP when the tunnel stays down past Codex's retry budget [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1885.75ms]

 8 pass
 0 fail
 47 expect() calls
Ran 8 tests across 1 file. [8.94s]
exit=0 wall_ms=8953 head=248e7321d at=2026-11-13T08:24:59Z
gate-3.txt (on 248e732)
bun test v1.4.4 (38afee6c8)

tests/e2e-style/link-websocket-release-gate.test.ts:
(pass) link WebSocket release gate (design 11.1 item 13) > the reviewed pin names the design's Codex revision and a digest of the right shape, or none yet [0.50ms]
🚀 opencodex proxy running on http://localhost:36311
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain: the switch goes off under a running turn; it finishes and its tool result is admitted, the idle socket is fenced, and the next session ends on HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [851.69ms]
🚀 opencodex proxy running on http://localhost:42079
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > drain past its deadline: the session's next create is fenced on the socket, costs one retry, and the same request completes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [508.73ms]
🚀 opencodex proxy running on http://localhost:41285
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a request over the 8 MiB message limit goes over HTTP [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1231.46ms]
🚀 opencodex proxy running on http://localhost:34165
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > control: without the advertised limit, Codex does send the oversized request on the socket [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1225.56ms]
🚀 opencodex proxy running on http://localhost:37267
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
🚀 opencodex proxy running on http://localhost:36863
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > a Home restart mid-turn: the turn completes after Codex reconnects [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [554.14ms]
🚀 opencodex proxy running on http://localhost:44297
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects recovers on the WebSocket once the tunnel is back [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [552.71ms]
🚀 opencodex proxy running on http://localhost:35689
   POST /v1/responses → provider translation
   POST /v1/chat/completions → OpenAI-compatible clients
   GET  /healthz      → health check
   GET  /api/*        → management API
   GET  /             → GUI dashboard
(pass) link WebSocket release gate (design 11.1 item 13) > the 503 sequence while the Child's tunnel reconnects ends on HTTP when the tunnel stays down past Codex's retry budget [release gate: Codex sha256 c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c matches the reviewed digest for openai/codex 88c5856 in tests/fixtures/link-gate-codex.json] [1882.22ms]

 8 pass
 0 fail
 47 expect() calls
Ran 8 tests across 1 file. [8.91s]
exit=0 wall_ms=8918 head=248e7321d at=2026-11-13T08:25:08Z

Verification

  • Build, three attempts in the Codex checkout's codex-rs/: cargo build --release --locked -p codex-cli --bin codex failed on missing OpenSSL headers (exit 101, 7.5 min; libssl-dev installed afterwards); the same command at the default width had two rustc processes OOM-killed (exit 101, 15.1 min; kernel log kept on the build VM); cargo build --release --locked -j 1 -p codex-cli --bin codex succeeded (exit 0, 79.5 min).
  • sha256sum of target/release/codex and of the read-only copy used for the runs (exit 0 each): c80d5ba4a92ffef0ef1ad1e9345429740ada15fa158b1792900e36892573a23c. codex --version (exit 0): codex-cli 0.0.0.
  • Regression test for the hashed-is-run fix: bun test tests/e2e-style/link-gate-codex-binary.test.ts with the earlier behaviour extracted into the helper: exit 1, 1 pass, 3 fail. The bare name ran the codex on PATH, whose spawn failed with ENOEXEC, where work/codex was hashed. The replaced file was what ran (ENOEXEC). A directory passed X_OK and then threw EISDIR while being hashed. The 0644 file was refused, as c28e59ae6 did. With the fix: exit 0, 5 pass. The exclusive copy, checked with COPYFILE_EXCL removed: the new case fails (it expects EEXIST and receives none). Cleanup checked by hand: with a refused value (/nonexistent/codex) and after a full gate run, no ocx-link-gate-bin-* directory is left.
  • OCX_LINK_GATE_CODEX=<absolute path> bun test tests/e2e-style/link-websocket-release-gate.test.ts: smoke on 7316cb7d6 (digest null) exit 0, 8 pass; gate ×3 on 248e7321d exit 0 each, 8 pass, 0 fail, 7 of 7 Codex titles release-labelled.
  • bun test tests/e2e-style/link-websocket-release-gate.test.ts without the binary, on 248e7321d: exit 0, 1 pass (the pin test), 7 skip, 0 fail. bun test tests/e2e-style/link-gate-codex-binary.test.ts: exit 0, 5 pass.
  • On 248e7321d, after merging dev c5010b042 (the layout.json conflict resolved as the union of both appended entries; test-layout-expected.json auto-merged to the same set): bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts exit 0, 29 pass; bun run structure:check exit 0; bun test tests/ci-workflows/structure-ssot.test.ts exit 0, 51 pass; bun run privacy:scan exit 0. bun check --no-script --noEmit on the changed test files reports no error in them (three errors in tests/fixtures/link-child-relay-standin.ts, tests/helpers/link-ws-child.ts and tests/helpers/link-ws-client.ts exist unchanged on dev; bun run typecheck covers src/ only).
  • CI: this PR changes files under tests/fixtures/, which scripts/ci/select-test-lane.sh routes to the full Ubuntu lane, and the fixture is read as data, which test changed cannot follow. The five full shards must run and pass on this PR's head before merge (ci:full if the lane selector does not pick them up).
  • NOT RUN: bun run test (full suite; repo-wide runs are excluded on this VM by the lane's rules), bun run typecheck (no src/ change), bun run test:changed, hosted CI, the opt-in Home RSS acceptance (by instruction), a second independent build of the binary, the Autobahn run, the Child RSS acceptance, the 9.2 controlled validation and U15 (both skipped by the owner on 2026-11-13, not measured), and any gate run on a platform other than Linux x86_64.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed (structure/remote-link.md; no user-visible behaviour changes, so no docs-site/ change).
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults (no secrets in the note; the gate stays closed).

…nk 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.
@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 chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 13, 2026
…ease 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).
…testation 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.
…py 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.
scripts/test-layout/layout.json: both sides appended to the explicit map; the union keeps link-websocket-traffic.test.ts from #8647 and link-gate-codex-binary.test.ts from this branch. tests/fixtures/test-layout-expected.json auto-merged to the same set.
… 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.
…t 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.
…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.
@lidge-jun
lidge-jun marked this pull request as ready for review November 13, 2026 09:05
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 09:05
@lidge-jun
lidge-jun merged commit 85fbba8 into dev Nov 13, 2026
33 checks passed
@lidge-jun
lidge-jun deleted the test/link-gate-codex-digest branch November 13, 2026 09:05
@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-13T09:07:18.421881Z 248e732 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
…w nits) into test/link-gate-evidence

layout.json: the union of dev, the binary test and the two real-Child files; structure/remote-link.md: the P3-3 wording on top of the U11 and real-Child sentences.
lidge-jun added a commit that referenced this pull request Nov 13, 2026
…-gate-evidence

The layout maps (layout.json, layout-clients.json, test-layout-expected.json) are the union of both sides, checked key by key. structure/remote-link.md keeps both sides: this branch's paragraph is dev's plus the U11, real-Child, restart and Autobahn sentences. The gate file keeps this branch's version, in which #8668's labels and binary copy live in tests/helpers/link-gate-codex.ts.
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

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant