Skip to content

fix(runtime): complete Bun compatibility follow-ups - #147085

Merged
steipete merged 4 commits into
mainfrom
codex/bun-runtime-followups
Sep 13, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/bun-runtime-followups

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

OpenClaw's source test/runtime paths still assumed several Node behaviors that shipping Bun does not provide: Worker events lost the caller's async context, injected HTTPS sockets bypassed TLS, bare ws resolved to Bun's partial shim, a Telegram test launched a TypeScript Worker through ignored execArgv, relative Vitest imports moved with the generated runner chunk, and deeply nested channel schemas depended on the runtime's stack limit.

The result was broad Bun failures across SQLite admission, secret egress, provider WebSockets, Telegram polling, and channel metadata even though the shipped SQLite and Telegram worker logic itself was sound.

Solution

  • Preserve each SQLite mutation request's AsyncLocalStorage context at its Worker event boundary, with a removal TODO linked to fix(worker_threads): preserve async context for worker events oven-sh/bun#42593.
  • Compose the secret-egress endpoint as tls.Server -> http.Server, with a removal TODO linked to fix(node:https): wrap injected raw connections with TLS oven-sh/bun#42594.
  • Route provider WebSockets through the existing installed npm-ws adapter.
  • Run the Telegram polling proof against its production-built Worker sidecar and register the exact runtime prerequisite.
  • Resolve real config writer imports from an absolute module URL.
  • Reject official channel schemas beyond a deterministic 256-level traversal bound while keeping external metadata collection total.
  • Capture the configure command's JSON runtime writer directly so parallel Vitest output handling cannot replace a process-wide stdout spy.

No dependency or SQLite schema changes are introduced. Node installation behavior is unchanged.

Validation

  • pnpm check:changed
  • Node focused run: 5 shards passed in 596.28s
  • Custom Bun focused run: the same 5 shards passed in 253.27s
  • Provider WebSocket: 17/17 under each runtime
  • Secret egress lifecycle: 35/35 under each runtime
  • Config, Worker, and schema tests: 28/28 under each runtime
  • Telegram production-worker case and tooling prerequisite contracts passed under each runtime
  • Full secrets lane: 977/977 under Node and custom Bun; post-rebase focused output proof: 2/2 under each runtime
  • Control UI performance: startup gzip 354,640 B, below the 356,316 B enforcement limit
  • Fresh exact-diff P0-P2 autoreview: clean

Release-note context: improves OpenClaw source and runtime compatibility with Bun while preserving Node behavior.

@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@steipete
steipete requested a review from a team as a code owner September 13, 2026 14:29
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram scripts Repository scripts size: M maintainer Maintainer-authored PR labels Sep 13, 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 2:12 PM ET / 18:12 UTC (Revision 5).

ClawSweeper review

What this changes

Repairs Bun compatibility for SQLite Worker callbacks, protected HTTPS connections, provider WebSockets, channel schema traversal, and supporting tests.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: these remain useful Bun compatibility fixes beyond the earlier merged work. No blocking correctness or security defect was identified in the introduced changes.

Priority: P2
Reviewed head: 7e5607f92a71da4f3d5bf32cd290aa87e04f56f0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused compatibility repair with meaningful boundary coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer-author classification exempts ordinary contributor proof. The body reports Node/custom-Bun runs covering production Worker, TLS lifecycle, and WebSocket boundaries; these were inspected as supporting evidence, not independently rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer-author classification exempts ordinary contributor proof. The body reports Node/custom-Bun runs covering production Worker, TLS lifecycle, and WebSocket boundaries; these were inspected as supporting evidence, not independently rerun.
Evidence reviewed 12 items Changes remain absent from captured main: Comparison with captured main retains the Worker context wrappers, provider WebSocket adapter import, and split TLS/HTTP endpoint as branch changes. This comparison establishes current behavior, while the supplied merge-base delta establishes PR ownership.
Latest release still uses the affected WebSocket import: The supplied latest release, v2026.9.4, imports the bare ws entrypoint in the provider connector; it does not contain this adapter cutover.
Earlier Bun work is merged but complementary: GitHub confirms #146807 merged at e572c0c. Its existing npm-ws adapter is reused here; that merged PR does not supersede these remaining call-site and runtime fixes.
Findings None None.
Security None None.

How this fits together

OpenClaw’s runtime adapters connect session maintenance and provider requests to JavaScript runtime facilities. These changes preserve request context, TLS handling, and configuration metadata across Node and Bun.

flowchart TD
  A[Session maintenance] --> B[Worker request context]
  B --> C[Live write authorization]
  C --> D[SQLite mutation settlement]
  E[Provider and subprocess requests] --> F[WebSocket and TLS adapters]
  F --> G[Existing network and secret policies]
  G --> H[Upstream connection]
Loading

Before merge

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

Security

None.

PR surface

Source +56, Tests +52, Other +4. Total +112 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 5 92 36 +56
Tests 9 74 22 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 9 5 +4
Total 15 175 63 +112

Review metrics

Metric Value Why it matters
Production versus test growth Production +56 lines; tests +52; test tooling +4 Production growth supports explicit runtime compatibility boundaries and a deterministic schema traversal limit.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/secrets/egress-proxy/proxy-server.ts, unknown-data-model-change: src/secrets/egress-proxy/certificates.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep compatibility handling at the existing runtime boundaries, preserving current authorization and Node defaults, with the documented upstream conditions governing workaround removal.

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

Yes: the Worker callback-context and injected CONNECT/TLS scenarios identify concrete failing boundaries, supported by upstream Bun reports and focused repository coverage; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes: the patch reuses the existing WebSocket adapter and authorization owners, with narrow runtime workarounds and no dependency or stored-schema changes.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: Repairs bounded failures in the optional Bun runtime while preserving the default Node workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer-author classification exempts ordinary contributor proof. The body reports Node/custom-Bun runs covering production Worker, TLS lifecycle, and WebSocket boundaries; these were inspected as supporting evidence, not independently rerun.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 7ab5077 adds src/config/sessions/session-accessor.sqlite-worker-request.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7ab507770f3d; files: src/config/sessions/session-accessor.sqlite-worker-request.ts)
  • openclaw/openclaw-secops: 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 (4 earlier review cycles)
  • reviewed 2026-09-13T14:34:46.209Z sha b196994 :: blocked before merge. :: none
  • reviewed 2026-09-13T15:17:38.054Z sha 0811ded :: blocked before merge. :: none
  • reviewed 2026-09-13T16:48:37.459Z sha f140f8deb2127e02370bda5b9119fd61e22f78a9 :: blocked before merge. :: none
  • reviewed 2026-09-13T17:13:35.816Z sha 8e7ccc2 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/bun-runtime-followups branch from f140f8d to 8e7ccc2 Compare September 13, 2026 17:06
@steipete
steipete force-pushed the codex/bun-runtime-followups branch from 8e7ccc2 to 7e5607f Compare September 13, 2026 18:02
@steipete
steipete merged commit 69213b3 into main Sep 13, 2026
191 checks passed
@steipete
steipete deleted the codex/bun-runtime-followups branch September 13, 2026 18:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '28887b564210326174413d0d8ade72b38268d5f3': (1827 commits)
  fix(qa): bind coverage IDs to producer assertions (#144000)
  fix(linux): explain FreeBSD desktop setup prerequisites (#147211)
  fix(memory): split embedding batches rejected for an input array item cap (#139541)
  test: isolate timing metadata persistence from inherited settings (#147112)
  refactor(status): retire test-only helper publication (#147071)
  improve: reduce workspace agent lookup work for large fleets (#147144)
  refactor(macos): share connect credential selection (#144214)
  fix(plugins): restore Slack onboarding after core updates (#147109)
  refactor: share ANSI compatibility matching (#146998)
  fix(test): settle Models catalog before picker open (#147215)
  test(ui): reuse panel tab drag fixture (#147250)
  fix(install): use system Node for FreeBSD CLI setup (#147204)
  fix(cli): explain MCP probes with no enabled servers (#147216)
  docs: require UI screenshots in chat and PR (#147263)
  docs(skills): clarify remote gog OAuth setup for Gateway hosts (#145945)
  test: replace idle account catalog waits with synchronization (#147228)
  feat(qa): preserve maturity decision context (#147219)
  feat(macos): clarify agent activity in native chat (#147197)
  fix(runtime): complete Bun compatibility follow-ups (#147085)
  fix(ui): release closed chat panes after queued updates (#147240)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
* fix(runtime): complete Bun compatibility follow-ups

* test(secrets): force captured runtime output

* perf(config): shrink schema traversal helper

* test(secrets): isolate JSON output capture
MertBasar0 added a commit to MertBasar0/openclaw that referenced this pull request Oct 17, 2026
Under Bun, a bare "ws" import resolves to Bun's built-in adapter, which
ignores the agent option, so the media worker still dialed directly (the
new proxy regressions failed in the Bun CI shard). Use the SDK
websocket-runtime WebSocket, which loads the real ws implementation, the
same fix provider-websocket received in openclaw#147085.
roboclaw-bot pushed a commit that referenced this pull request Oct 22, 2026
…icted hosts (#175886)

* fix(openai): GPT-Live Talk bypasses the managed proxy on egress-restricted hosts

The GPT-Live direct media socket runs in a worker_threads isolate, where
the managed proxy's Proxyline hooks are not installed, so ws dialed
OpenAI directly. Build the agent inside the worker from the inherited
proxy env with the public createNodeProxyAgent helper; a proxy failure
closes media instead of falling back to a direct connection.

Fixes #175794

* perf(openai): load the proxy helper in GPT-Live media workers only when proxied

The env proxy helper pulls in undici (~200 ms of module load), which every
Talk session's media worker paid before its first audio. Import it only
when the inherited env carries proxy settings; the helper still owns
NO_PROXY and protocol selection. Also clear OPENCLAW_PROXY_CA_FILE in the
managed proxy test env, as startProxy does without a CA.

* fix(openai): route GPT-Live media through the proxy on Bun too

Under Bun, a bare "ws" import resolves to Bun's built-in adapter, which
ignores the agent option, so the media worker still dialed directly (the
new proxy regressions failed in the Bun CI shard). Use the SDK
websocket-runtime WebSocket, which loads the real ws implementation, the
same fix provider-websocket received in #147085.

---------

Co-authored-by: jalehman <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…icted hosts (openclaw#175886)

* fix(openai): GPT-Live Talk bypasses the managed proxy on egress-restricted hosts

The GPT-Live direct media socket runs in a worker_threads isolate, where
the managed proxy's Proxyline hooks are not installed, so ws dialed
OpenAI directly. Build the agent inside the worker from the inherited
proxy env with the public createNodeProxyAgent helper; a proxy failure
closes media instead of falling back to a direct connection.

Fixes openclaw#175794

* perf(openai): load the proxy helper in GPT-Live media workers only when proxied

The env proxy helper pulls in undici (~200 ms of module load), which every
Talk session's media worker paid before its first audio. Import it only
when the inherited env carries proxy settings; the helper still owns
NO_PROXY and protocol selection. Also clear OPENCLAW_PROXY_CA_FILE in the
managed proxy test env, as startProxy does without a CA.

* fix(openai): route GPT-Live media through the proxy on Bun too

Under Bun, a bare "ws" import resolves to Bun's built-in adapter, which
ignores the agent option, so the media worker still dialed directly (the
new proxy regressions failed in the Bun CI shard). Use the SDK
websocket-runtime WebSocket, which loads the real ws implementation, the
same fix provider-websocket received in openclaw#147085.

---------

Co-authored-by: jalehman <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 26, 2026
…icted hosts (#175886)

* fix(openai): GPT-Live Talk bypasses the managed proxy on egress-restricted hosts

The GPT-Live direct media socket runs in a worker_threads isolate, where
the managed proxy's Proxyline hooks are not installed, so ws dialed
OpenAI directly. Build the agent inside the worker from the inherited
proxy env with the public createNodeProxyAgent helper; a proxy failure
closes media instead of falling back to a direct connection.

Fixes #175794

* perf(openai): load the proxy helper in GPT-Live media workers only when proxied

The env proxy helper pulls in undici (~200 ms of module load), which every
Talk session's media worker paid before its first audio. Import it only
when the inherited env carries proxy settings; the helper still owns
NO_PROXY and protocol selection. Also clear OPENCLAW_PROXY_CA_FILE in the
managed proxy test env, as startProxy does without a CA.

* fix(openai): route GPT-Live media through the proxy on Bun too

Under Bun, a bare "ws" import resolves to Bun's built-in adapter, which
ignores the agent option, so the media worker still dialed directly (the
new proxy regressions failed in the Bun CI shard). Use the SDK
websocket-runtime WebSocket, which loads the real ws implementation, the
same fix provider-websocket received in #147085.

---------

Co-authored-by: jalehman <[email protected]>

Release adaptation: test-only import merge (stable's worker test still imports the default ws WebSocket and the audio clock).

(cherry picked from commit da5840e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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