Skip to content

fix(node-host): keep the node service PATH when the Linux login shell resets it - #136677

Merged
steipete merged 6 commits into
openclaw:mainfrom
harjothkhara:fix/134354-node-login-shell-path
Oct 11, 2026
Merged

steipete merged 6 commits into
openclaw:mainfrom
harjothkhara:fix/134354-node-login-shell-path

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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 -lc envelope; 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

  • Five changed files: +15 net production lines, +26 test lines; no changelog edits.
  • Secretless Linux proof: a test-owned .profile resets 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.
  • Independent review found no actionable P0/P1 issue. Formatting and git diff --check pass.
  • Final-head type-aware lint: passed, zero warnings/errors; export-name collision guard: passed. Global Knip remains blocked by unrelated unused exports in the concurrent UI/MCP migration (including McpAppCatalog, McpAppResourcesElement, and McpServersCard); 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.
  • Broad check:changed encountered an unrelated max-lines suppression in src/web-search/runtime.test.ts. The same failure was reproduced on clean main ac8a432aafa; both that source and its baseline are unchanged by this PR. Main's separate unused-export fix 7fb80f69f66a is incorporated.
  • The final main integration leaves all five product/test/doc files byte-identical to the passing behavior proof.
  • No published-driver update cell is required: updater, Doctor, migrations, plugin loading, and service lifecycle are unchanged. A full installed systemd daemon was not exercised; proof uses the actual node command runner and a real login shell.

Thanks @harjothkhara for the diagnosis and original implementation.

@clawsweeper

clawsweeper Bot commented Sep 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 complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling plugin: file-transfer labels Sep 2, 2026
@harjothkhara
harjothkhara marked this pull request as ready for review September 2, 2026 22:23
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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.

  • Before: A node-host command invoking node fails with exit 127 because /opt/node/bin is lost.
  • After: The command resolves node from /opt/node/bin while retaining profile-provided PATH entries afterward.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has no identified correctness defect, but regression tests and green CI do not satisfy the external PR's shipped-behavior proof gate.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Linux node commands lose service-installed tools when login profiles replace the documented service PATH.
Reason: The report establishes a released, owned failure, and the current execution feature owner has recorded the narrow service-first implementation choice without adding configuration or changing service lifecycle.

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
Reviewed head: 83aaaaf980a3a7c90b1ee4b7d63739812ff84141

Before merge

  • Add real behavior proof - The changed node runner is exercised by a regression using a real login shell and a test-owned profile, with reported before/after results, but the external-PR proof gate still needs terminal output or logs through a running Linux node service's shipped system.run path showing service-only lookup and collision precedence on fresh and latest-stable-upgraded setups; redact credentials, IPs, phone numbers, and non-public endpoints, then request re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted Linux node-service system.run transcript showing service-only executable resolution and service-versus-profile collision precedence on fresh and latest-stable-upgraded setups with existing service settings preserved.
Agent review details

How this fits together

Gateway 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +15, Tests +26, Docs 0. Total +41 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 20 5 +15
Tests 1 26 0 +26
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 47 6 +41

Review metrics

Metric Value Why it matters
Production versus tests Production +15 net lines; tests +26 lines The small production increase shares the existing carrier and adds node restoration; the regression exercises executable lookup through the real runner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #134354
Summary: The canonical issue owns Linux service PATH loss, and this open PR is its focused implementation candidate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Reported Linux node workflows cannot resolve service-installed tools despite following the documented service PATH guidance.
  • merge-risk: 🚨 compatibility: Service entries now win executable collisions with profile entries; the feature-owner-authored commit explicitly records this intended precedence.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add the Linux node-service execution transcript described in the proof assessment.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-23T01:46:25.210Z sha ac3e52aca50607482b30513c783e5bc571669840 :: blocked before merge. :: none
  • reviewed 2026-09-26T22:47:56.409Z sha ad9b21e8eb738b57f838461311622194e11cd2e4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-27T00:57:13.151Z sha 64ebab8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-28T00:24:00.580Z sha 64ebab8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T12:26:18.784Z sha 64ebab8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T09:32:04.141Z sha 5588fac :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T09:44:19.362Z sha 5588fac :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T10:04:16.484Z sha dffcf94 :: needs real behavior proof before merge. :: none

Reviewed October 11, 2026, 6:41 AM ET / 10:41 UTC (Revision 14).

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Sep 2, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 17, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 17, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Sep 18, 2026
@clawsweeper clawsweeper Bot added 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 23, 2026
@harjothkhara
harjothkhara force-pushed the fix/134354-node-login-shell-path branch from ac3e52a to ad9b21e Compare September 26, 2026 22:41
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed plugin: file-transfer labels Sep 26, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 Sep 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 28, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Sep 30, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

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]>
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 11, 2026
@steipete
steipete merged commit 95e0638 into openclaw:main Oct 11, 2026
129 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

RomneyDa pushed a commit that referenced this pull request Oct 12, 2026
… 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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
… 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]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 19, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: node-host exec discards the node service PATH by running /bin/sh -lc on Linux; the documented remediation (systemd Environment=PATH) is a no-op

3 participants