Skip to content

feat(worker): add native inference runtime - #163645

Merged
RomneyDa merged 3 commits into
mainfrom
openclaw/pr-158902-native-runtime
Oct 6, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
openclaw/pr-158902-native-runtime

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Adds the worker-owned native inference runtime on top of #158902.

  • Accepts the compatible model catalog and resolved credentials projected from the node's canonical top-level models.providers configuration.
  • Uses every compatible configured model without a second model/workspace allowlist and pins each child to its exact admitted canonical workspace.
  • Filters APIs and credential forms that require unsupported ambient provider state before the node advertises worker inference.
  • Keeps credentials and provider execution on the worker; only admitted protocol state crosses the Gateway boundary.
  • Guards streamed provider output across text, structured metadata, decoded tool arguments, signatures, replay data, and terminal results.
  • Aborts active credential-bearing provider I/O when Gateway admission is lost and disables retries at this boundary.
  • Keeps worker as the sole public inference value; there is no compatibility path for the unshipped runtime-local spelling.

Stack

Depends on merged #158902. Followed by #163646, #163647, and #158903.

Evidence

  • pnpm deadcode:full
  • OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 pnpm check:changed
  • pnpm test src/worker/worker.runtime.test.ts --maxWorkers=1 — 85 passed in 68.96s
  • pnpm test src/worker/native-runtime.test.ts src/worker/native-inference-startup.test.ts src/worker/native-runtime-transport.test.ts src/worker/native-inference-stream.test.ts --maxWorkers=1 — 65 passed in 5.20s before the additional stream regressions
  • pnpm test src/worker/native-inference-stream.test.ts --maxWorkers=1 — 40 passed
  • pnpm test test/scripts/eager-import-closure.test.ts --maxWorkers=1 — 17 passed in 23.13s
  • Focused real-provider authority-loss regression — 1 passed, 84 skipped
  • AutoReview P0–P2 scoped clean on the current production diff

@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 blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes agents Agent runtime and tooling size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 2, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 8:12 PM ET / October 6, 2026, 00:12 UTC (Revision 7).

ClawSweeper review

What this changes

Adds worker-side model inference with privately supplied credentials, workspace-bound model selection, guarded provider transport, and credential-safe streamed output.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains useful work beyond the merged protocol foundation. No actionable introduced defect was found, and the earlier migration blocker does not apply to the transient startup contract.

Priority: P2
Reviewed head: 09da1e593c352b106c5bc0b45002b10fc8e06a9b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with meaningful production-boundary fault evidence and no supported blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The reported passing authority-loss scenario exercises the production worker runtime and real provider client against a TCP fixture, requiring request closure and no retry after Gateway disconnect. Source inspection also confirms rejection of unconfigured models, changed workspaces, and escaped turn handles; tests remain supplemental outside the exercised boundary. No stored-data contract changes, so migration proof is not applicable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The reported passing authority-loss scenario exercises the production worker runtime and real provider client against a TCP fixture, requiring request closure and no retry after Gateway disconnect. Source inspection also confirms rejection of unconfigured models, changed workspaces, and escaped turn handles; tests remain supplemental outside the exercised boundary. No stored-data contract changes, so migration proof is not applicable.
Evidence reviewed 8 items Pinned introduction and merge ownership: Reviewed the introduced delta from 4d47170 to 09da1e5. Raw test-merge records confirm main 14ac515 as first parent and the exact PR head as second parent. GitHub's pinned comparison independently confirms the runtime changes survive that merge.
Still necessary on main and in the latest release: Current main retains the Gateway inference adapter and lacks the added native runtime modules. The latest release, v2026.9.8, likewise contains only the existing inference stream and RPC client. GitHub verifies #158902 merged the protocol foundation, not this runtime.
Upgrade concern resolved by contract inspection: The startup owner consumes bounded JSON from private descriptor 3, clears the input buffer, and closes the descriptor. The new configuration is a process input; the launch assignment adds an optional field, and absence retains Gateway inference. No introduced schema migration, stored preference rewrite, or durable format change supports the previous review's migration blocker.
Findings None None.
Security None None.

How this fits together

The worker runs an admitted agent turn using models and credentials supplied by its node host. Provider results feed the existing agent loop, while transcript and live-event updates return to the Gateway.

flowchart TD
  A[Node model configuration and credentials] --> B[Private worker startup pipe]
  C[Gateway turn admission] --> D[Workspace and model checks]
  B --> D
  D --> E[Worker provider inference]
  E --> F[Stream output guard]
  F --> G[Agent loop and Gateway updates]
  C --> H[Admission loss cancels inference]
  H --> E
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +1084, Tests +1717, Other +1. Total +2802 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 19 1151 67 +1084
Tests 13 1792 75 +1717
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 33 2944 142 +2802

Review metrics

Metric Value Why it matters
Production versus test growth production +935 net lines; tests and test support +1866; tooling +1 Production growth is explained by the new inference owner and its startup, transport, and output boundaries.

Stored data model

Persistent data-model change detected: serialized state: src/worker/worker-runtime-github-failures.suite.ts, unknown-data-model-change: src/worker/worker-runtime-github-failures.suite.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one worker-owned inference path driven by canonical node configuration, with Gateway admission controlling its lifetime and existing Gateway inference preserved for other turns.

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

Not applicable to a new capability; the reported fault-injection run and inspected production path provide a concrete validation scenario, but this review did not execute it.

Is this the best way to solve the issue?

Yes: the runtime reuses the existing AI adapters and worker lifecycle while keeping configuration and credentials with the node owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded worker-inference capability addition without evidence of an urgent existing-user regression.
  • 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 authority-loss scenario exercises the production worker runtime and real provider client against a TCP fixture, requiring request closure and no retry after Gateway disconnect. Source inspection also confirms rejection of unconfigured models, changed workspaces, and escaped turn handles; tests remain supplemental outside the exercised boundary. No stored-data contract changes, so migration proof is not applicable.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported passing authority-loss scenario exercises the production worker runtime and real provider client against a TCP fixture, requiring request closure and no retry after Gateway disconnect. Source inspection also confirms rejection of unconfigured models, changed workspaces, and escaped turn handles; tests remain supplemental outside the exercised boundary. No stored-data contract changes, so migration proof is not applicable.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the introduced delta from 4d47170 to 09da1e5. Raw test-merge records confirm main 14ac515 as first parent and the exact PR head as second parent. GitHub's pinned comparison independently confirms the runtime changes survive that merge. (b221f4a8ff03)
  • Still necessary on main and in the latest release: Current main retains the Gateway inference adapter and lacks the added native runtime modules. The latest release, v2026.9.8, likewise contains only the existing inference stream and RPC client. GitHub verifies feat(protocol): define worker-local inference contracts #158902 merged the protocol foundation, not this runtime. (src/worker/inference-stream.runtime.ts, fc23bc864e45)
  • Upgrade concern resolved by contract inspection: The startup owner consumes bounded JSON from private descriptor 3, clears the input buffer, and closes the descriptor. The new configuration is a process input; the launch assignment adds an optional field, and absence retains Gateway inference. No introduced schema migration, stored preference rewrite, or durable format change supports the previous review's migration blocker. (src/worker/native-inference-startup.ts:16, 09da1e593c35)
  • Authority-loss boundary evidence: The captured PR body reports the focused authority-loss regression passed. Its inspected scenario calls runWorkerDescriptor with the real built-in OpenAI transport against a TCP provider fixture, observes authenticated request arrival, disconnects Gateway clients, and requires provider connection closure, exactly one request, and an aborted terminal lifecycle result. This is production-boundary fault evidence rather than a mocked provider client; it does not claim a full deployed-stack demonstration. (src/worker/worker-runtime-native-inference.suite.ts:21, 09da1e593c35)
  • Credential and provider boundary: Inspected the runtime's immutable model selection, exact workspace checks, turn cancellation, explicit credential injection, and scoped AI transport host. The transport rejects requests outside the configured origin and all redirects; the stream guard checks generated metadata, decoded tool arguments, and authoritative terminal results before publication. The relevant implementation is owned by this repository's AI package; no Codex harness dependency signal was found. (src/worker/native-runtime.ts:73, 09da1e593c35)
  • Related media scope: Both prepared screenshots were inspected locally. They show the placement menu before and after the related client PR adds 'Direct from worker'; they are client presentation evidence and do not independently establish this runtime's transport or authorization behavior.

Likely related people:

  • 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 (6 earlier review cycles)
  • reviewed 2026-10-02T16:59:55.682Z sha 23534d1 :: blocked before merge. :: none
  • reviewed 2026-10-02T17:07:09.284Z sha 23534d1 :: blocked before merge. :: none
  • reviewed 2026-10-02T17:23:59.855Z sha 23534d1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-04T07:22:39.404Z sha 342c075b8672f6dc05a4666d5c96863a0485747a :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-04T07:33:29.351Z sha fe04f32 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T23:51:59.727Z sha ce9be73 :: blocked before merge. :: none

@RomneyDa

RomneyDa commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

Exact head: 23534d11c8c59af3913710d98fb52cd1eed9e766.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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. labels Oct 2, 2026
@RomneyDa
RomneyDa force-pushed the openclaw/pr-154390-native-worker-ui branch 2 times, most recently from cf4c0e5 to 89c26a2 Compare October 4, 2026 07:17
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch 2 times, most recently from 342c075 to fe04f32 Compare October 4, 2026 07:27
@RomneyDa
RomneyDa force-pushed the openclaw/pr-154390-native-worker-ui branch from 89c26a2 to 7afde7f Compare October 4, 2026 07:27
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from fe04f32 to 2280543 Compare October 4, 2026 14:58
@RomneyDa
RomneyDa force-pushed the openclaw/pr-154390-native-worker-ui branch from 7afde7f to 8db748e Compare October 4, 2026 15:22
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from 2280543 to 312d263 Compare October 4, 2026 15:22
@RomneyDa
RomneyDa force-pushed the openclaw/pr-154390-native-worker-ui branch from 8db748e to 86e1097 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
@RomneyDa

RomneyDa commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review\n\nRebased onto merged #158902 and addressed the accepted authority-loss proof gap plus exact-head stream-boundary findings. Please review head 38b94b7d77c.

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper assist is taking a look at your question.

I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes.

Request: review\n\nExact head: 38b94b7d77c6c58472a408b8db0efb2191837423. Current-head evidence and finding dispositions are recorded in the PR body.

@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui gateway Gateway runtime labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper assist: Head 38b94b7d77c6c58472a408b8db0efb2191837423 needs a full correctness re-review. The supplied context reports new authority-loss and stream-boundary coverage, but does not establish that the previous proof gap is resolved.

Evidence:

  • The previous review covered fe04f32b0bb5, requiring proof that admission loss cancels active provider I/O and prevents credential-bearing retries.
  • The current PR body reports the focused authority-loss regression passed and 40 stream tests passed.
  • Supplied patches include an active-request revocation test, but are truncated; no completed review of the requested head is shown.

Suggested next action: Request @clawsweeper review for the exact current head, with current-head proof and finding dispositions recorded in the PR body.


Source: #163645 (comment)
Assist reasoning: medium.

@RomneyDa

RomneyDa commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review\n\nExact head: 38b94b7d77c6c58472a408b8db0efb2191837423. Current-head evidence and finding dispositions are recorded in the PR body.

@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper assist: This needs a full correctness review of head 38b94b7d77c6c58472a408b8db0efb2191837423. The supplied context contains reported proof, but no completed review of that head.

Evidence:

  • The previous review covered fe04f32b… and requested proof that Gateway admission loss cancels active provider I/O and prevents credential-bearing retries.
  • The PR body reports an authority-loss regression passing and AutoReview P0–P2 findings addressed; this context does not independently verify those results.
  • Your latest review request names the current head.

Suggested next action: Use @clawsweeper review for the full review; that command is already present in your latest comment.


Source: #163645 (comment)
Assist reasoning: medium.

@RomneyDa

RomneyDa commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from 38b94b7 to ce9be73 Compare October 5, 2026 23:45
@RomneyDa

RomneyDa commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 5, 2026
@RomneyDa
RomneyDa force-pushed the openclaw/pr-158902-native-runtime branch from ce9be73 to 09da1e5 Compare October 5, 2026 23:59
@RomneyDa

RomneyDa commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit c1005a2 into main Oct 6, 2026
147 checks passed
@RomneyDa
RomneyDa deleted the openclaw/pr-158902-native-runtime branch October 6, 2026 00:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
* feat(worker): add native inference runtime

* refactor(worker): derive inference from node models

* fix(worker): harden native inference boundaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes 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