镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Forward Claude Code turns to the agent gateway - #2917

Open
philazar wants to merge 2 commits into
coder1/dxa-1156-host-forwardingfrom
coder1/dxa-1156-claude-neutral
Open

philazar wants to merge 2 commits into
coder1/dxa-1156-host-forwardingfrom
coder1/dxa-1156-claude-neutral

Conversation

@philazar

@philazar philazar commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Why

The runner can now dispatch a Claude agent's turn through the build's agent gateway (#2632), and the host can forward Claude Code's model traffic natively (#2916). Nothing yet connects the two for Claude Code. A wake that falls back from the gateway also has no request to carry its fallback notice, so the user never sees why it fell back.

What

  • A Claude turn that the runner routes through the gateway runs on its own native forwarding generation and its own Claude process.
  • Compaction follows the same route as the agent's turns.
  • A wake's gateway fallback notice now shows in the Activity transcript, right after the prompt it belongs to.

How

  • The turn opens a generation at the route revision it was dispatched with, with the turn's frozen headers. Admission is sealed at Claude's qualifying idle, and the generation closes after the process exits. No other turn runs on it or overlaps it.
  • A route that moves on revokes the generation natively and ends the process.
  • Nothing waits on gateway readiness or retries. A moved route, a refusal, an unreachable native side or a protected agent fails visibly before anything spawns. It never falls back to Claude's own configuration on its own. A turn the runner already sent to Claude's own configuration (gatewayFallback) runs there unchanged.
  • Compaction reads the route once. Where turns go through the gateway, so does compaction, on its own generation. Where they would fall back, compaction is refused. Where the route doesn't forward Claude, it runs on Claude's own configuration.
  • Fallback notices are kept in memory by the id of the message Claude took, at most 100 per agent. A message Claude never took has no id, so its notice shows nowhere rather than on a later turn.
  • The harness declaration stays off until its wire proof.

Risk

Low today. The Claude harness declaration is off, so no build forwards Claude turns yet. The change touches the Claude Code runtime and the Activity transcript, so a regression there would affect every Claude agent.

Testing

Local pre-push lane at 017c8dbb2 (bin/node scripts/check-push.mjs, clean tree): 986 files passed, 9 skipped; 18,612 tests passed, 23 skipped. An earlier run of the same lane failed under heavy machine load and did not reproduce.

Not run yet:

  • Native app acceptance with a live gateway, for turns, interrupt, compaction and the fallback notice. No live run is approved yet.
  • A choice on where a fallback notice should show for a wake whose message Claude never took. It shows nowhere today.

Bigger picture

Review order: #2632 (shared gateway client) → #2479 (Pi) → #2916 (native forwarding) → this PR → goose caller. The stack conflicts with current main and needs a main integration before merge. Ready for review does not mean ready to merge.

🤖 Generated with Claude Code

philazar and others added 2 commits November 6, 2026 14:02
A Claude agent whose membership the runner dispatches through the agent
gateway opens a native generation for its turn at the route revision it
was dispatched with, with the turn's frozen headers, and gives it to one
Claude process of its own. Admission is sealed at Claude's qualifying
idle, and the generation closes once the process has exited, so no other
turn runs on it or overlaps it. A route that moves on revokes the
generation natively and ends its process.

Nothing waits on gateway readiness or re-reads a route to retry. A turn
whose route moved past its dispatch, a refusal, a native side that can't
be reached, or a protected agent fails visibly before anything spawns; it
never runs on Claude's own configuration instead. A turn the runner sent
to Claude's own configuration (`gatewayFallback`) runs there unchanged.

Compaction reads the route once, without waiting: where Claude's turns go
through the gateway, so does compaction, on a generation of its own under
the control's context; where they would fall back, it is refused; where
the route doesn't forward Claude, it runs on Claude's own configuration.
An interrupt during a held admission stops the compaction and leaves a
queued turn uninterrupted.

The harness declaration stays off until its wire proof.

Co-authored-by: Coder1 <db50ef1f1688dc7f3e536c17351e8e994a7466bcbe009794f61d64355c0ffc2e@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Philip Azar <pazar@squareup.com>
A wake that falls back from the agent gateway has no request to carry
its notice. Once Claude has taken the message, the runtime keeps the
notice by that message's id, and the Activity transcript shows it as a
status right after the prompt Claude saved under the same id. A message
Claude never took has no id, so its notice shows nowhere rather than on
a later turn. Mentions keep showing theirs on the request. Notices are
kept in memory while the app runs, at most 100 per agent.

Co-authored-by: Coder1 <db50ef1f1688dc7f3e536c17351e8e994a7466bcbe009794f61d64355c0ffc2e@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Philip Azar <pazar@squareup.com>
@tellaho

tellaho commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

🤖 Design review at 017c8dbb2019ae6fa83c7a5b3a2d35ec12143f64. Intent: connect Claude turns to the gateway and place a wake’s fallback explanation beside its prompt. No additional design blocker found in source review. Claude’s gateway opt-in remains off; this is not acceptance of the live forwarding flow. Reviewed with #2632 and #2479; Pi’s recovery findings are on #2479.

Source review only. No screenshots supplied; I did not run tests, the app or a live gateway, or verify rendered themes, widths, enlarged text, keyboard/focus, interrupt or compaction behavior.

@tellaho

tellaho commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

🤖 Could you add a screenshot or short video of the change to the PR? Design uses these for faster reviews.

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.

2 participants