Repository navigation
fix(node-host): keep the node service PATH when the Linux login shell resets it - #136677
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: needs real behavior proof before merge. What this changesThis PR restores the node service PATH after Linux login-shell startup, ahead of profile-provided entries. Example: A Linux node service has PATH=/opt/node/bin:/usr/bin:/bin, but its login profile resets PATH to /usr/bin:/bin.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it provides a focused repair for an unresolved Linux node execution bug, and current main still lacks the restoration. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway node execution sends command argv to the node's system.run policy owner; the command runner receives the sanitized node environment and returns captured output and exit status. flowchart LR
A[Gateway exec request] --> B[Node system.run policy]
B --> C[Sanitized node environment]
C --> D[Command runner]
D --> E[Login shell startup]
E --> F[Service PATH restoration]
F --> G[Command execution and result]
Technical reviewBest possible solution: Retain the shared environment-carried restoration at the node launch boundary, preserving login startup and operator-controlled service PATH precedence. Do we have a high-confidence way to reproduce the issue? Yes: current main supplies the inherited service environment to /bin/sh -lc without post-profile restoration, matching the reporter's official-release traces; no target code was executed during this review. Is this the best way to solve the issue? The repair addresses the executing owner directly, reuses the established safe carrier, and preserves Linux login initialization rather than removing it or forwarding Gateway PATH configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4db95aa552f7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +15, Tests +26, Docs 0. Total +41 across 5 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (13 earlier review cycles; latest 8 shown)
Reviewed October 11, 2026, 6:41 AM ET / 10:41 UTC (Revision 14). |
|
This pull request has been automatically marked as stale due to inactivity. |
ac3e52a to
ad9b21e
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
Keep the documented node service PATH ahead of login-profile entries by reapplying it after startup through the existing safe shell environment carrier. Scope the fix to OpenClaw's generated /bin/sh -lc envelope and share the prefix with Gateway execution. Preserve approval evaluation and direct binary execution. Refs openclaw#134354. Co-authored-by: Harjoth Khara <[email protected]>
|
Merged via squash.
|
… resets it (#136677) * fix(node-host): preserve service PATH after login startup * refactor(node-host): keep shell PATH carrier behind a narrow import * style(node-host): remove trailing blank line from shell owner * fix(node-host): pin login profile regression and preserve the input environment --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Harjoth Khara <[email protected]> (cherry picked from commit 95e0638)
… resets it (openclaw#136677) * fix(node-host): preserve service PATH after login startup * refactor(node-host): keep shell PATH carrier behind a narrow import * style(node-host): remove trailing blank line from shell owner * fix(node-host): pin login profile regression and preserve the input environment --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Harjoth Khara <[email protected]>
First-parent upstream 75df19c..5ed6a30 (23 commits, including openclaw#169005 infrastructure SQLite work and runtime-write offload, openclaw#169062, openclaw#136677, openclaw#169070, openclaw#168857 plugin-sdk SQLite runtime writes into workers, openclaw#169038, openclaw#168916, openclaw#169053, openclaw#169052 closed-turn transcript work in workers, openclaw#168974, openclaw#168811, openclaw#169082, openclaw#169084, openclaw#166581 worker heap limits). Conflicts: - openclaw-state-worker-runtime.ts: upstream routes more update-run mutations to the worker; our continuation custody dispatch stays ahead of that branch. - worker-access inventory: regenerated (632 files, 2429 calls). server-restart-sentinel.ts auto-merged: upstream's awaited update-run writes; our continuation restart delivery is unaffected. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fixes #134354.
What Problem This Solves
Linux node commands run through
/bin/sh -lc. Login profiles can replace the node service's PATH, making service-installed tools unavailable even when operators follow the documented systemd environment configuration.Why This Change Was Made
Reapply the sanitized service PATH immediately before the generated shell payload runs. The node runner shares the existing environment-carried PATH prefix with Gateway execution, so PATH contents remain data rather than shell syntax. This applies only to the generated
/bin/sh -lcenvelope; command approval still evaluates the original request before launch.User Impact
Service PATH entries take precedence, with profile entries retained afterward. This makes the documented service environment effective without changing login initialization, configuration, protocol, or service lifecycle. Direct executables, non-login shells, and Windows execution retain their existing behavior.
Evidence
.profileresets PATH. The new real-runner regression fails against the original runner and passes with the fix (36 ms).pnpm test src/node-host/invoke.run-command.test.ts src/infra/node-shell.test.ts src/agents/bash-tools.exec-host-node.test.ts --maxWorkers=1: 81 passed, 2 Windows-only cases skipped, 43.76 seconds wall time. The runner file took 32.82 seconds including its existing compiled-worker preparation; the added case itself took 36 ms. Other files took 0.624 and 3.92 seconds.git diff --checkpass.McpAppCatalog,McpAppResourcesElement, andMcpServersCard); no finding names a file changed by this PR. These findings are inherited from main and were independently verified outside this PR. Required GitHub checks pass; no changed PATH file has a reported static finding.check:changedencountered an unrelated max-lines suppression insrc/web-search/runtime.test.ts. The same failure was reproduced on clean mainac8a432aafa; both that source and its baseline are unchanged by this PR. Main's separate unused-export fix7fb80f69f66ais incorporated.Thanks @harjothkhara for the diagnosis and original implementation.