Skip to content

feat(gateway): dispatch worker-local native inference safely - #163646

Merged
RomneyDa merged 8 commits into
mainfrom
openclaw/pr-158902-gateway-compat
Oct 6, 2026
Merged

RomneyDa merged 8 commits into
mainfrom
openclaw/pr-158902-gateway-compat

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Connects the Gateway and node-host owners to the worker native-inference runtime from #163645.

  • Dispatches worker-inference turns only after capability, model-policy, placement, receipt, and current-authority checks pass.
  • Resolves worker-local models from the admitted node snapshot without requiring Gateway credentials or provider routing.
  • Preserves legacy and person-linked session auth-pin semantics in projected metadata.
  • Keeps Gateway inference and worker inference as explicit, separate paths and fences stale or incompatible worker receipts.
  • Uses the node host's canonical top-level model configuration; no inference sidecar or second credential store is introduced.

Stack

Depends on #158902 and #163645. Followed by #163647 and #158903.

Review Repairs

  • Addressed all four accepted ClawSweeper findings: Gateway credential coupling, auth-pin projection, ordinary-CI placement of the heavy integration suite, and oversized worker-turn execution ownership.
  • Fixed an additional AutoReview P2 where an empty provider headers: {} map was rejected.
  • Rebased onto current main without restoring superseded runtime or session abstractions.
  • Removed a duplicate database-worker inventory entry inherited from main that made the PR changed-owner manifest fail before its test matrix could start.
  • Cleared exact-head lint findings and updated the real one-slot lifecycle proof to verify the public rejection/claim/provider boundaries without depending on intentionally scrubbed agent.wait error text.
  • Added credential-free Gateway runtime metadata for the custom-model example while keeping its endpoint, key, and secret headers node-owned.

Evidence

  • pnpm check:changed (all affected gates green; final dead-export repair rerun below)
  • pnpm tsgo:core
  • node --import tsx scripts/check-deadcode-exports.mts
  • pnpm check:max-lines-ratchet
  • pnpm check:line-cap-ratchet --base origin/main
  • pnpm test src/gateway/worker-environments/inference-model.test.ts src/gateway/server-methods/chat-metadata-runtime.native-session.test.ts src/gateway/worker-environments/worker-turn-execution.test.ts --maxWorkers=1
  • pnpm test src/node-host/node-worker-native-inference.test.ts --maxWorkers=1
  • pnpm test test/e2e/qa-lab/runtime/native-worker-slot.e2e.test.ts --maxWorkers=1 — 1 passed; 46.7-second test body, 91.5-second Vitest shard
  • Core oxlint stripes 3/5 and 5/5
  • pnpm test src/gateway/worker-environments/worker-inference-dispatch.test.ts --maxWorkers=1
  • pnpm test src/infra/ci-node-plan.test.ts --maxWorkers=1 — 114 passed; heavy native-worker integration remains release-only
  • Exact changed-owner planner — 98 bounded shards; duplicate-file guard passed
  • pnpm test test/scripts/ci-node-test-plan.test.ts --maxWorkers=1 — 114 passed in 111 seconds
  • pnpm docs:check-links — 14,914 links checked, 0 broken
  • pnpm docs:check-config-examples — 1,312 examples validated
  • pnpm docs:check-i18n-glossary

New focused regressions run in roughly 1 second or less. The existing dispatch suite takes about 51–60 seconds because it exercises isolated SQLite fixtures; the CI-plan suite took 112 seconds. A cold local production build made the one-slot command take 937 seconds overall; the test itself took 46.7 seconds.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 1:29 AM ET / 05:29 UTC (Revision 19).

ClawSweeper review

What this changes

Adds Gateway dispatch to paired workers that run inference with node-owned model configuration and credentials, and exposes that placement in session metadata.

Merge readiness

✅ Ready for maintainer review

This integration remains necessary: current main contains the native runtime but lacks the dispatch and node-configuration handoff. The inspected patch preserves the prior repairs and introduces no concrete blocking defect.

Priority: P2
Reviewed head: 600e387c67ac1f70952cb09f0f207d35aabbd10a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful production-boundary evidence and coherent owner integration support normal good PR quality, with no actionable blocker identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The reported passing one-slot scenario exercises Gateway dispatch through the production supervisor, installed native worker, and real HTTP client, observing refusal while occupied and recovery through settlement and reuse. The inspected authority cases supplement that evidence; downstream screenshots do not establish runtime proof. No stored-data format changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The reported passing one-slot scenario exercises Gateway dispatch through the production supervisor, installed native worker, and real HTTP client, observing refusal while occupied and recovery through settlement and reuse. The inspected authority cases supplement that evidence; downstream screenshots do not establish runtime proof. No stored-data format changes require migration.
Evidence reviewed 10 items Pinned introduction and merge identities: Reviewed the merge-base-to-head introduced delta. Raw test-merge records confirm the pinned base followed by the exact PR head; base-only changes were not attributed to this PR.
Current-main necessity: Current main still calls the Gateway-authenticated model preparation path and does not emit the worker-local inference assignment. The merged runtime dependency at #163645 therefore does not supersede this integration.
Dispatch authority and prior repairs: Worker inference retains model-policy and build checks, live run and placement assertions, cancellation subscriptions, and a final authorization check before launch. Its model preparation avoids Gateway credentials; session metadata preserves explicit, person-linked, and legacy account pins.
Findings None None.
Security None None.

How this fits together

The Gateway authorizes session turns and dispatches them to paired worker hosts. The node supervisor supplies local model configuration to an admitted worker, which calls the provider and returns events and transcript updates to the Gateway.

flowchart TD
  A[Session turn and worker profile] --> B[Gateway authorization and placement]
  B --> C{Inference location}
  C --> D[Gateway provider proxy]
  C --> E[Paired node supervisor]
  F[Node model configuration] --> E
  E --> G[Native worker provider request]
  D --> H[Session events and transcript]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1230, Tests +2672, Docs +342, Other +5. Total +4249 across 72 files.

View PR surface stats
Area Files Added Removed Net
Source 34 1348 118 +1230
Tests 29 2724 52 +2672
Docs 6 350 8 +342
Config 0 0 0 0
Generated 0 0 0 0
Other 3 5 0 +5
Total 72 4427 178 +4249

Review metrics

Metric Value Why it matters
Production versus test growth production net +509 lines; tests and test support net +3393 lines Production growth implements the node configuration handoff and dispatch checks; most growth supplies boundary and release-tier composition coverage.

Technical review

Best possible solution:

Use recorded paired-device placement and canonical node model configuration while preserving Gateway inference defaults and live run fencing.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a feature request; source inspection establishes the missing main integration, and the contributor reports a passing production-path lifecycle scenario.

Is this the best way to solve the issue?

Yes. The patch extends existing placement, supervisor, model-configuration, and transcript owners without introducing a competing runtime service or credential store.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d8612ec864bb.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is an opt-in worker-inference capability with bounded impact and preserved Gateway defaults.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The reported passing one-slot scenario exercises Gateway dispatch through the production supervisor, installed native worker, and real HTTP client, observing refusal while occupied and recovery through settlement and reuse. The inspected authority cases supplement that evidence; downstream screenshots do not establish runtime proof. No stored-data format changes require migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported passing one-slot scenario exercises Gateway dispatch through the production supervisor, installed native worker, and real HTTP client, observing refusal while occupied and recovery through settlement and reuse. The inspected authority cases supplement that evidence; downstream screenshots do not establish runtime proof. No stored-data format changes require migration.

Evidence

What I checked:

  • Pinned introduction and merge identities: Reviewed the merge-base-to-head introduced delta. Raw test-merge records confirm the pinned base followed by the exact PR head; base-only changes were not attributed to this PR. (7805b074211e)
  • Current-main necessity: Current main still calls the Gateway-authenticated model preparation path and does not emit the worker-local inference assignment. The merged runtime dependency at feat(worker): add native inference runtime #163645 therefore does not supersede this integration. (src/gateway/worker-environments/worker-turn-execution.ts:192, d8612ec864bb)
  • Dispatch authority and prior repairs: Worker inference retains model-policy and build checks, live run and placement assertions, cancellation subscriptions, and a final authorization check before launch. Its model preparation avoids Gateway credentials; session metadata preserves explicit, person-linked, and legacy account pins. (src/gateway/worker-environments/worker-turn-execution.ts:94, 600e387c67ac)
  • Latest capability repair: Node startup captures native configuration only after worker hosting is admitted, excluding Windows and nested-container hosting. Advertisement requires Gateway support, and the launch adapter rejects nodes lacking the native handoff capability before dispatch. (src/node-host/runtime.ts:209, 600e387c67ac)
  • Production-path behavior evidence: The captured PR body reports the one-slot E2E passing with a 46.7-second test body. The inspected scenario uses public session RPCs, a real Gateway, installed worker, production supervisor, and HTTP transport; it observes occupied-slot rejection, settlement, deletion, reconnect, stale-epoch cancellation rejection, and slot reuse. This review did not execute tests. (test/e2e/qa-lab/runtime/native-worker-slot.e2e.test.ts:126, 600e387c67ac)
  • Security and forbidden-path coverage: Startup credentials travel through a private pipe rather than the Gateway turn envelope. Inspected coverage checks rejection before provider HTTP for missing configuration, unknown models, and mismatched workspaces, plus provider disconnect and unchanged transcripts after placement replacement. Same-user credential isolation is explicitly outside the documented trust boundary. (src/worker/native-worker.integration.test.ts:455, 600e387c67ac)

Likely related people:

  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (18 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-06T00:26:59.354Z sha 19a25e5 :: blocked before merge. :: [P2] Prepare native turns without Gateway provider credentials | [P2] Preserve person-linked and legacy explicit account pins | [P2] Route the process composition to release-only coverage | [P3] Extract native admission to satisfy the dispatch line cap
  • reviewed 2026-10-06T01:14:02.712Z sha 464c3544934453fc9775c311dfb4385bfabd84b2 :: needs changes before merge. :: [P2] Include Gateway runtime metadata for the custom example model
  • reviewed 2026-10-06T01:40:51.202Z sha 50200b86949690c5b1e655a0d49fce21f1efe08a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T03:30:17.550Z sha 321017d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T03:36:21.150Z sha 321017d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T03:57:44.824Z sha 64ebab0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T04:24:23.121Z sha 7d5a081 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T04:30:50.798Z sha 7d5a081 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Oct 2, 2026
@RomneyDa

RomneyDa commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

Exact head: 142ec437f65c507e8198cbad71fa8ebad9e0354e.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from 23534d1 to 342c075 Compare October 4, 2026 07:17
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-gateway-compat branch 2 times, most recently from 005a16e to 99cafd3 Compare October 4, 2026 07:27
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from 342c075 to fe04f32 Compare October 4, 2026 07:27
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-gateway-compat branch from 99cafd3 to e12694c Compare October 4, 2026 14:58
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch 2 times, most recently from 2280543 to 312d263 Compare October 4, 2026 15:22
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-gateway-compat branch from e12694c to 392f89a Compare October 4, 2026 15:22
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 4, 2026
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-gateway-compat branch from 392f89a to 9d13e40 Compare October 4, 2026 15:34
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch 2 times, most recently from 087c428 to e3c787e Compare October 5, 2026 20:41
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 6, 2026
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-gateway-compat branch from 321017d to 64ebab0 Compare October 6, 2026 03:52
@RomneyDa

RomneyDa commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head rebased onto the merged source-map-js CI repair: 64ebab09da2.

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa

RomneyDa commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

CI fixture repair at exact head 7d5a081; real compatibility E2E passes locally.

@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

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

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant