Skip to content

head-lag: Base and Robinhood on Codex's iad edge node - #3234

Open
mikerowe23 wants to merge 2 commits into
ChainBench:devfrom
mikerowe23:feat/codex-base-iad-edge
Open

mikerowe23 wants to merge 2 commits into
ChainBench:devfrom
mikerowe23:feat/codex-base-iad-edge

Conversation

@mikerowe23

@mikerowe23 mikerowe23 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

I'm on the Codex team. This moves two of the bench's Codex subscriptions to our new edge node, iad.edge.codex.io: Base, and Robinhood Chain at the Processed commitment level. Solana stays on fra.edge.codex.io and BNB on graph.codex.io. The change is in two commits, so you can take Base without Robinhood.

Changes

  • Base (first commit): subscribes on wss://iad.edge.codex.io/graphql from every region, at Processed as before. CODEX_BASE_WS_URL overrides the endpoint; setting it to wss://graph.codex.io/graphql rolls Base back without a code change.
  • Robinhood (second commit): subscribes on wss://iad.edge.codex.io/graphql at Processed instead of the default level. At the default level iad is no faster than graph.codex.io (about 50 ms slower from Singapore), so the gain comes from the Processed stage. graph.codex.io doesn't serve that stage on Robinhood: it accepts the subscription and delivers nothing. So the level follows the endpoint, and CODEX_ROBINHOOD_WS_URL=wss://graph.codex.io/graphql rolls back both.
  • Sockets: each edge chain gets its own socket, so each probe holds four Codex sockets on the same API key (Solana, Base, Robinhood, and BNB on graph.codex.io). Base and Robinhood share the node but not a socket. Since head-lag: a full race book no longer eats pool trades; Codex edge errors end the subscription #3256 an edge error ends the whole socket, and a silent pool trips the flow watchdog for everything on it, so a Robinhood problem can't disconnect Base. All four feed the existing ws_connected{aggregator="codex"} series, which reads 1 only while every socket is up. The spec queries are unchanged.
  • Code: codexSocketPlan splits the chains across sockets and codexProcessed picks each chain's level; both are tested. The socket log tags are [solana], [base], [robinhood] and [graph] (previously [edge] and [graph]).
  • Spec: the "Codex endpoints" methodology line names both edge nodes. A new "Codex commitment levels" line says Robinhood reads Processed and that earlier Robinhood figures read the default level on graph.codex.io. It's two lines to stay under the 500-character limit.

Verified

Base (2026-10-22). I ran a probe in each of the bench's probe regions on Railway (us-east4, europe-west4, asia-southeast1) for about 15 minutes. Each one subscribed the bench's Base pool at Processed on both iad.edge.codex.io and graph.codex.io and compared arrival times trade by trade.

Region Trades on both iad.edge first iad.edge lead p10 / p50 / p90
us-east 139 138 192 / 223 / 309 ms
eu-west 120 119 186 / 221 / 321 ms
sgp 120 119 138 / 174 / 278 ms

Both sockets stayed connected for the whole run in every region. In each region one trade reached graph.codex.io but not iad.edge.codex.io within the 15 s matching window.

Robinhood (2026-10-27). I ran probes in the same three regions for about 10 minutes, each subscribing the bench's Robinhood pool on three setups at once: today's (graph.codex.io, default level), this PR's (iad.edge.codex.io, Processed) and iad.edge.codex.io at the default level.

How far this PR's setup was ahead of today's, trade by trade:

Region Trades Ahead Lead p10 / p50 / p90
us-east 139 139 57 / 79 / 139 ms
eu-west 139 139 55 / 74 / 136 ms
sgp 138 136 8 / 30 / 89 ms

The bench's own figure (arrival minus block timestamp), mean over the same trades:

Region Today This PR Change
us-east 766 ms 674 ms −92 ms
eu-west 804 ms 716 ms −88 ms
sgp 827 ms 785 ms −42 ms

iad.edge.codex.io at the default level ran 1–4 ms behind graph.codex.io in us-east and eu-west, and a steady 51 ms behind in sgp. Every subscription stayed connected in every region, with no errors.

Harness and tests. The branch ran locally with the Codex key: all four Codex sockets connected on the first attempt, every chain delivered, and ws_connected{aggregator="codex"} read 1. go test ./cmd/script (with -race on the Codex tests), pnpm validate and bun test src/ pass.

Deploy notes

  • No new secrets: all four sockets use the existing CODEX_API_KEY. Redeploy the three head-lag services (us-east, eu-west, sgp).
  • Expect Codex's Base figures to drop by roughly 0.2 s, and its Robinhood figures by roughly 40–90 ms depending on region. The methodology lines say why.
  • The two methodology lines are undated. You may want to add the deploy date, as the other dated notes have.
  • I rebased the branch onto current dev (a705fe05) since opening the PR.

🤖 Generated with Claude Code

mikerowe23 and others added 2 commits October 27, 2026 09:52
Base subscribes on wss://iad.edge.codex.io/graphql from every region, on
its own socket. Solana stays on fra.edge and BNB and Robinhood on
graph.codex.io, so each probe now holds three Codex sockets, all feeding
the one ws_connected{aggregator="codex"} series. CODEX_BASE_WS_URL
overrides the Base endpoint; setting it to graph.codex.io rolls back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Robinhood subscribes on wss://iad.edge.codex.io/graphql on a socket of its
own (not Base's: an edge error or a silent pool ends the whole socket), at
the Processed commitment level. On the default level iad trailed
graph.codex.io by ~60 ms on every trade (2026-10-27, 34 trades); at
Processed it led by ~60 ms (p50). graph.codex.io serves no Processed
stage on Robinhood, so the level follows the endpoint:
CODEX_ROBINHOOD_WS_URL=wss://graph.codex.io/graphql rolls back both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikerowe23
mikerowe23 force-pushed the feat/codex-base-iad-edge branch from af2b0a8 to 239c412 Compare October 27, 2026 17:35
@mikerowe23 mikerowe23 changed the title head-lag: Base on Codex's iad edge node head-lag: Base and Robinhood on Codex's iad edge node Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant