fix: keep native addons available during agent-initiated commands - #86
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 53ed1116-ce5e-44e8-82bb-aa010e7b78b1
|
🦞👀 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 21, 2026, 6:44 PM ET / 22:44 UTC (Revision 5). ClawSweeper reviewWhat this changesThe Windows launcher carries native-addon redirection through Node startup arguments and command shims while preserving agent-owned Node options. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful fix beyond current main. Earlier correctness findings are resolved, and the new VM evidence supports the central agent-command fix; compatibility validation remains incomplete. Priority: P2 Review scores
Verification
How this fits togetherThe Windows package launches OpenClaw inside an isolated agent account, where native dependencies must load from staged copies. Its launcher and shell shim supply the preload that redirects module resolution to those copies. flowchart LR
A[Foreground or gateway launch] --> B[Node startup arguments]
C[Agent shell command shim] --> B
B --> D[Native dependency preload]
D --> E[Staged native packages]
B --> F[OpenClaw agent command reconstruction]
F --> D
D --> G[Child Node environment]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the runtime-argument fix while preserving supported shell and child-process behavior, backed by focused fresh-session and upgrade evidence. Do we have a high-confidence way to reproduce the issue? Yes, source establishes why an environment-only preload is absent from upstream's reconstructed runtime arguments, and the PR records the corresponding VM failure. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes for the central defect: supplying the existing preload through runtime arguments matches the pinned upstream contract. Shell inheritance and upgrade compatibility still need the bounded validation described above. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 288521d5fcc9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 53ed1116-ce5e-44e8-82bb-aa010e7b78b1
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 53ed1116-ce5e-44e8-82bb-aa010e7b78b1
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 53ed1116-ce5e-44e8-82bb-aa010e7b78b1
What Problem This Solves
Fixes: native OpenClaw modules such as Koffi become unavailable when Copilot invokes
openclawfrom within an isolated agent turn.User Impact
User impact: agent-initiated
openclawcommands retain the staged native dependency redirect used by the foreground and gateway processes without replacing agent-owned Node.js options.Why This Change Was Made
OpenClaw creates its own
%OPENCLAW_STATE_DIR%\tmp\agent-cli\openclaw.cmdand prepends it for agent exec. That runtime shim reconstructs the current Node.js invocation fromprocess.execArgv, so a preload delivered only through ambientNODE_OPTIONSis absent from the reconstructed command.The launcher now places the native redirect on Node's real runtime argument vector before packaged
app\openclaw.mjs. Upstream OpenClaw preserves ordinary--importruntime flags when it reconstructs its agent-visible CLI. Once loaded, the redirect appends itself to the agent account'sNODE_OPTIONSfor ordinary child Node.js processes, preserving existing values as data. Foreground and detached gateway launches use the same argument ordering and continue holding the staged root for their lifetimes.Evidence
Head SHA:
99fa6a407bc3afaaff02e3bfea529920cec588c3Observed VM reproduction against prior PR artifact:
0.1.586.1eb200fb2a50532223c125a5b2e674a3b35da730d3a9d69db306cd7f081e06254cb89c4bcc14a7107openclaw doctorstill reported the native Koffi module missingPassed locally on the corrected head:
OpenClaw.SessionProtocolOpenClaw.SessionHostOpenClaw.Launcherscripts\Test-DocReferences.ps1(0findings)git diff --checkRegression coverage verifies:
--import <file-url> app\openclaw.mjs <unchanged upstream args>NODE_OPTIONS, including quoted paths containing&, is never expanded by the packaging batch shimNot completed locally:
scripts\Test-DotNetQuality.ps1scripts\Test-NativeAotCli.Tests.ps1This development machine's .NET 10.0.401 MSBuild project-reference graph exits with code 1 without a project diagnostic. CI is the authoritative full validation lane. No package registration, isolated session, or user state was modified locally.
Successful VM Validation
Validated the test-signed x64 MSIX from workflow run
35660440161:0.1.599.199fa6a407bc3afaaff02e3bfea529920cec588c3openclaw doctor0and no errors; the native Koffi failure did not recur