Repository navigation
fix(runtime): complete Bun compatibility follow-ups - #147085
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 13, 2026, 2:12 PM ET / 18:12 UTC (Revision 5). ClawSweeper reviewWhat this changesRepairs 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 Review scores
Verification
How this fits togetherOpenClaw’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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +56, Tests +52, Other +4. Total +112 across 15 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
f140f8d to
8e7ccc2
Compare
8e7ccc2 to
7e5607f
Compare
|
Merged via squash.
|
* 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) ...
* 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
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.
…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]>
…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]>
…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)
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
wsresolved to Bun's partial shim, a Telegram test launched a TypeScript Worker through ignoredexecArgv, 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
AsyncLocalStoragecontext at its Worker event boundary, with a removal TODO linked to fix(worker_threads): preserve async context for worker events oven-sh/bun#42593.tls.Server -> http.Server, with a removal TODO linked to fix(node:https): wrap injected raw connections with TLS oven-sh/bun#42594.wsadapter.No dependency or SQLite schema changes are introduced. Node installation behavior is unchanged.
Validation
pnpm check:changedRelease-note context: improves OpenClaw source and runtime compatibility with Bun while preserving Node behavior.