Skip to content

The stage-2 router listens in the PTY server; the arena holds ten providers - #12814

Merged
gHashTag merged 2 commits into
masterfrom
feat/router-host-x2
Oct 27, 2026
Merged

gHashTag merged 2 commits into
masterfrom
feat/router-host-x2

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

Closes #12797

What lands (all on .t27, the host binary is generated)

  • The router accept loop, hosted (issue Host the router accept loop in the PTY server: bind 127.0.0.1:47127, serve_answer on the wire, the actor's backoff #12797): pty_server.t27 binds 127.0.0.1:47127 by the merged laws -- router_actor router_listen (the bind bytes are router_sock.t27's), a mailbox of CONN_MAILBOX connections in G_RCFD/G_RCLEN, serve_answer on the wire, faults counted and gated through tick_decision (BACKOFF_TICKS after FAULT_LIMIT), panes and the supervisor never stop ticking. The walk's body is the router's own honest error object until the outbound provider client lands (its own spec, next lane).
  • SOCK_STREAM is one law: router_sock imports pty_client's constant and re-declares nothing -- two modules emitting one name collide in the merged build (the crash this PR chases down).
  • The arena holds ten providers (my KEYS tab: every key visible and editable; self-checking keys; the stage-2 router laws #12774 debt, paid): KEY_SLOTS 72 to 80 (the 72-slot table silently dropped the nvidia provider's keys), O_CARRY/O_SCAN moved after the grown key table (it overlapped the carry rows), ST_SIZE 512 to 544 for the router state, O_RTRD + 8 x 2048 read buffers appended, MEM_SIZE to 1190088; the arena/mask/load pins follow the law (load_all_mask 1023, needs_key reads it, no literal masks left).

Verification

pty_logic 58/58, pty_server 25/25, router 8, sock 3, serve 5, actor 4, keys 115, fleet 5, transform 12 -- t27c and t27b agree. Seals: T27osPtyServer, T27osPtyLogic, T27osRouterActor, T27osRouter refreshed against this tree; the dupe ratchet is green. Master carried these reds before this PR: pty_logic 55/58, pty_server 21/25 (the arena overlap was a real memory overlap, not a stale pin).

phi^2 + 1/phi^2 = 3 | TRINITY

@tri-claw

tri-claw Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary by t27-bees

Checked by the t27 compiler

t27c parse, parse-complete and typecheck on each changed .t27 file at 7b3a190. Nothing was generated, built or run. A pass means the file is well formed, not that it is right.

  • specs/provider/call.t27: parses and typechecks.
  • specs/t27os/pty_logic.t27: parses and typechecks.
  • specs/t27os/pty_server.t27: parses and typechecks.
  • specs/t27os/router_actor.t27: parses and typechecks.
  • specs/t27os/router_sock.t27: parses and typechecks.

Read by the model

This PR hosts the stage-2 router's accept loop inside the PTY server (binding 127.0.0.1:47127), expands the provider key table from 72 to 80 slots, fixes a SOCK_STREAM constant collision between router_sock and pty_client, and adds a new ProviderCall spec for outbound provider requests.

Worth a look

  • specs/provider/call.t27:47 — var tail : [4096]u8 = undefined; fixes the request body buffer at 4 KiB. A model name, prompt, and JSON framing can exceed this (e.g., long prompts or large max_tokens values), causing silent truncation in chat_body with no error signal.
  • specs/provider/call.t27:73–74 — The while (j < bn) { out[n + j] = tail[j]; } copy assumes n + bn <= out.len. No bounds check; overflow writes past out if the caller's buffer is too small.
  • specs/provider/call.t27:100, 128 — json_copy and copy_content return the truncated byte count when out fills up, but callers (chat_body, reply_content) treat the return value as the full written length. Truncation goes undetected, producing invalid JSON or incomplete content.
  • specs/provider/call.t27:57–68 — chat_request writes the request line, headers, and body into out without any capacity checks. A short caller buffer corrupts memory.
  • specs/t27os/router_sock.t27 — The diff shows only a SOCK_STREAM re-declaration fix. Verify the constant value matches pty_client's exactly (the seal hash change suggests the merged build now agrees, but the diff shown is too small to confirm the value).

Read: 9 files, +943 -496, the whole diff up to 60000 characters (the rest was not read). Head 7b3a190. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-27 07:44:41 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 16
PRs with All Checks Green 0
READY 0
FAILING 16
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=67adcf31aff7 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag

Copy link
Copy Markdown
Collaborator Author

Second commit: the outbound call law (provider/call.t27, 3/3) -- the bytes the router's walk will write to zai/nemotron and the content it reads back. The walk wiring itself is the successor lane; this PR closes the host wiring (#12797).

@gHashTag
gHashTag enabled auto-merge (squash) October 27, 2026 09:15
This was referenced Oct 27, 2026
…s ten providers (Closes #12797)

pty_server hosts the router accept loop by the merged laws: router_actor
router_listen opens 127.0.0.1:47127 (the bytes are router_sock's), the
mailbox holds CONN_MAILBOX connections in G_RCFD, serve_answer puts the
wire down, and a burst of broken clients backs the conn loop off for
BACKOFF_TICKS (tick_decision) while panes and the supervisor keep
ticking. The walk's body is the router's own honest error until the
outbound provider client lands. SOCK_STREAM is one law: router_sock
imports pty_client's and re-declares nothing (two modules emitting one
name collide in the merged build).

pty_logic carries the growth: ST_SIZE 512 to 544 for the router state,
the key table 72 to 80 slots (the nvidia provider made PROVIDER_COUNT
10; the 72-slot table silently dropped its keys), O_CARRY/O_SCAN moved
after the grown table, O_RTRD + 8 x 2048 read buffers appended,
MEM_SIZE 1171712 to 1190088; the arena, mask and load pins follow the
law (load_all_mask is 1023, needs_key reads it, no literal masks).

pty_logic 58/58, pty_server 25/25, router 8, sock 3, serve 5, actor 4,
keys 115, fleet 5, transform 12 -- t27c and t27b agree.
phi^2 + 1/phi^2 = 3 | TRINITY
…ply's content (Refs #12797)

provider/call.t27: chat_request composes the POST a provider's
chat-completions endpoint expects (the head, the bearer, Content-Length
naming the body, then the body); chat_body escapes the prompt the way
JSON must; reply_content reads the assistant's content back out,
decoding the escapes. The socket belongs to the walk (the router-host
successor); this spec owns the bytes only. Keys are never printed; the
max_tokens arrives from the caller, which applies the floor law.

call 3/3 -- t27c and t27b agree. phi^2 + 1/phi^2 = 3 | TRINITY
@gHashTag
gHashTag force-pushed the feat/router-host-x2 branch from 7b3a190 to eaaedff Compare October 27, 2026 11:59
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-27 11:59:30 UTC

Summary

Status Count
Total Open PRs 8
PRs with Failing Checks 6
PRs with All Checks Green 2
READY 1
FAILING 6
PENDING 0
NO CHECKS YET 0

These columns do not partition: 1 + 6 + 0 + 0 = 7, and there are 8 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e75b498e5e79 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

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.

Host the router accept loop in the PTY server: bind 127.0.0.1:47127, serve_answer on the wire, the actor's backoff

1 participant