Skip to content

fix(nodes): make node-placed Claude CLI turns work end to end - #16

Merged
tomorrowflow merged 1 commit into
mainfrom
fix/node-claude-run-scope
Oct 8, 2026
Merged

tomorrowflow merged 1 commit into
mainfrom
fix/node-claude-run-scope

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Problem

On 2026.10.2, every turn of a Claude CLI session adopted on a paired headless node failed. Upstream main has the same code.

  1. invokeNodeClaudeCliRun and the node skill runtime read scope.context. The session-work admission lease removes that field on purpose (withPluginRuntimeGatewayContextResolver, delete scoped.context), so every node-placed turn failed with "Gateway node runtime unavailable" (via both chat.send and the agent RPC).
  2. prepareCliSessionBinding checked for the Claude transcript on the Gateway's disk. For a node session the transcript is on the node, so the check always missed and cleared a valid binding. The fork claim then failed with "CLI session fork marker is no longer available".
  3. The post-turn isCliBindingFlushed check missed the same way. The fork's new session id was never persisted, so every later turn started a fresh Claude session.

Solution

  • Both node helpers read the context through getInProcessGatewayRequestContext(), which checks the live resolver first.
  • Both transcript checks skip node-placed runs. Placement comes from its existing owner, resolveCliExecutionTarget, which prepare.ts already uses to skip its own check.

Evidence

  • Regression tests:
    • node-agent-cli-runtime and node-claude-skill-runtime now run under the real admitted-turn scope. They failed with the production errors before the fix.
    • attempt-execution.cli and cli-runner.context-engine gained a node-placed case each. Both failed before the fix.
    • One existing fixture had execHost: "node" without execNode, a state the placement owner rejects. It now includes execNode.
  • pnpm test on the 7 affected files: 189 passed, wall time about 98 s across 4 shards. pnpm tsgo is clean.
  • Live proof on an isolated test Gateway (--profile m0) with a headless node in Docker:
    • Catalog adoption works, and the first turn fork-resumes the source session.
    • The second turn resumes the fork successor, and the replies show the earlier context.
    • Two concurrent turns ran on one node.
    • chat.abort stopped the run in 9 ms, with no claude process left on the node.
  • Codex autoreview: scoped-clean at P0–P2.

Fork-only for now; not sent upstream.

🤖 Generated with Claude Code

Every turn of a Claude CLI session adopted on a paired node failed:

- invokeNodeClaudeCliRun and the node skill runtime read scope.context,
  which the session-work admission lease deliberately drops in favor of
  resolveGatewayContext ("Gateway node runtime unavailable"). Read the
  context through getInProcessGatewayRequestContext instead.
- prepareCliSessionBinding probed the Gateway-local Claude transcript for a
  node-placed session, always missed, cleared the binding, and the fork
  claim then failed ("CLI session fork marker is no longer available").
- The post-turn isCliBindingFlushed probe missed the same way, so the fork
  successor id was never persisted and every later turn started fresh.

Node placement comes from resolveCliExecutionTarget, which prepare.ts
already uses to skip its own probe. Tests now run the node helpers under
the real admitted-turn scope shape instead of a hand-built request scope.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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