Skip to content

fix(e2e): preserve OpenClaw shim authority - #9258

Merged
prekshivyas merged 3 commits into
mainfrom
codex/fix-openclaw-launch-shim-env
Aug 16, 2026
Merged

fix(e2e): preserve OpenClaw shim authority#9258
prekshivyas merged 3 commits into
mainfrom
codex/fix-openclaw-launch-shim-env

Conversation

@senthilr-nv

@senthilr-nv senthilr-nv commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

The protected OpenClaw launch shim previously expected private NEMOCLAW_LAUNCH_* authority after the CLI subprocess filter had removed it, so the current-main security-posture E2E stopped with openshell_shim_authority_invalid before it could publish the PTY record. This change carries the six fixture-only values through the existing OPENSHELL_* subprocess boundary. The shim removes both the source NEMOCLAW_* names and their aliases before each call to the pinned real OpenShell binary.

Related Issue

Relates #9200.

Source evidence: E2E run 31969859118, job 95220668388, artifact 9269583761 (e2e-security-posture-openclaw), digest sha256:8cccd5b85af7614c68228df3a37153c1271deb6ac4f8967c4ae8cdd01d797161.

Changes

  • Pass the six launch-shim values through aliases under the existing OPENSHELL_* allowlisted prefix.
  • Remove both the source NEMOCLAW_* names and the aliases before pass-through and intercepted calls reach the pinned OpenShell binary.
  • Exercise filtered and inherited subprocess environments while proving that pass-through argv remains exact and launch authority does not reach the real process.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: The change is confined to internal E2E launch infrastructure and changes no supported product behavior.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Independent code and nine-category security review found that direct CLI exec could retain the source authority names at eb433efe26a13f62673cd074dca03449edba1f29. Commit d1d5df49bb4a75d3b38450b819f71129d1e59eea removes both naming schemes, and focused negative evidence covers filtered and inherited subprocess environments.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: test/e2e/live/launch-agent-turn.ts and test/e2e/support/launch-agent-turn.test.ts change internal OpenClaw E2E shim authority and deterministic non-leakage coverage only; no public CLI, configuration, default, supported workflow, or user-facing product behavior changes.
  • Agent: Codex Desktop

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit: Not applicable
  • Station profile/scenario: Not applicable
  • Result: Not applicable
  • Supporting evidence: Not applicable

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — npx vitest run --project e2e-support test/e2e/support/launch-agent-turn.test.ts passed on d1d5df49b: 8 passed, 0 failed, and 20 intentional Linux-only skips on macOS. A direct inherited-environment probe confirmed that neither authority naming scheme reaches the real process.
  • Applicable broad gate passed — npm run checks:repository, npm run typecheck:cli, and direct Oxfmt checks passed on d1d5df49b. The installed pre-commit and commit-message hooks also passed; CI for this commit starts after the push.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Senthil Ravichandran senthilr@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved launch security by isolating control settings passed to OpenShell.
    • Prevented private launch-control values from being forwarded to child processes.
    • Updated launch handling to recognize current and legacy environment variable names.
  • Tests

    • Expanded validation for environment filtering, PTY records, run identifiers, and launch authority handling.

Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
@senthilr-nv senthilr-nv self-assigned this Aug 16, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c46153fe-cabc-4e20-8bc1-c0c55777ec82

📥 Commits

Reviewing files that changed from the base of the PR and between eb433ef and d1d5df4.

📒 Files selected for processing (2)
  • test/e2e/live/launch-agent-turn.ts
  • test/e2e/support/launch-agent-turn.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/e2e/live/launch-agent-turn.ts
  • test/e2e/support/launch-agent-turn.test.ts

Included review availability: Your plan includes up to 12 reviews per rolling hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

The launch shim now uses namespaced control variables and removes them before invoking OpenShell. E2E fixtures filter inherited environments, use fixture-specific PTY identifiers, record forwarded authority names, and assert that launch authority variables are not forwarded.

Changes

Launch authority isolation

Layer / File(s) Summary
Shim environment contract
test/e2e/live/launch-agent-turn.ts
The shim reads OPENSHELL_NEMOCLAW_LAUNCH_* variables, removes private launch variables before spawning OpenShell, and receives the renamed variables from the launch script.
Fixture environment validation
test/e2e/support/launch-agent-turn.test.ts
Launch fixtures filter subprocess environments, use fixture-specific PTY paths and run IDs, record forwarded authority names, and assert that launch authority variables are absent from real OpenShell calls.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to d1d5d

This change preserves launch authority across the E2E subprocess boundary while removing it before the real OpenShell process runs. The reported targeted and repository checks pass, so no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant LaunchScript
  participant LaunchShim
  participant OpenShell
  LaunchScript->>LaunchShim: pass OPENSHELL_NEMOCLAW_LAUNCH_* variables
  LaunchShim->>LaunchShim: remove recognized private launch variables
  LaunchShim->>OpenShell: spawn with filtered environment
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#9250: Modifies the same launch shim and E2E support tests for environment-variable handling and scrubbing.

Suggested reviewers: prekshivyas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the E2E fix that preserves OpenClaw shim authority, which matches the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-openclaw-launch-shim-env

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 183035b in the codex/fix-openclaw-l... branch remains at 96%, unchanged from commit 6f28b97 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 183035b in the codex/fix-openclaw-l... branch is 82%. The coverage in commit 3e4cd78 in the main branch is 83%.

Show a code coverage summary of the most impacted files.
File main 3e4cd78 codex/fix-openclaw-l... 183035b +/-
src/lib/cua/bounded-file.ts 94% 84% -10%
src/lib/cua/run...ime-manifest.ts 91% 84% -7%
src/lib/state/o...d-checkpoint.ts 91% 87% -4%
src/lib/onboard...nt-authority.ts 79% 75% -4%
src/lib/trace.ts 94% 90% -4%
src/lib/onboard...press-resume.ts 79% 82% +3%
src/lib/state/p...l-retirement.ts 86% 89% +3%
src/lib/onboard...file-builder.ts 90% 95% +5%
src/lib/onboard...der/snapshot.ts 75% 83% +8%
src/lib/securit...ntial-filter.ts 72% 88% +16%

Updated August 16, 2026 23:05 UTC

@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized terminology decisions differ; normalized E2E selections differ; severity counts match.
2 terminology differences from the second opinion

Advisory only. These are normalized differences from the primary terminology receipt.

  • OPENSHELL_NEMOCLAW_LAUNCH at test/e2e/live/launch-agent-turn.ts:146: selected only by the second-opinion lane as justified.
  • filtered and inherited environments at test/e2e/support/launch-agent-turn.test.ts:731: selected only by the second-opinion lane as justified.
2 additional E2E selections from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • openclaw-tui-chat-correlation: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • openclaw-skill-cli: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • established — launch authority at test/e2e/support/launch-agent-turn.test.ts:731: Keep "launch authority" for these interception-control values.
  • justified — private launch variables at test/e2e/live/launch-agent-turn.ts:131: Keep "private launch variables" because the adjacent authorityNames list defines the limited variable set.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite for the commit under review.

Recommended E2E: None

Manual-only E2E: cloud-onboard, security-posture, cloud-inference
The manual PR workflow does not run these selectors for the commit under review. Run them from reviewed code on main.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@senthilr-nv
senthilr-nv marked this pull request as ready for review August 16, 2026 21:16
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
@senthilr-nv

Copy link
Copy Markdown
Collaborator Author

Exact latest-head security follow-up for 183035b46b9bff333104c87c9535e71cab40a2ae: the merge commit retains the same two PR-owned blobs as d1d5df49, so the independent warning remains actionable.

The shim removes only its current captured list before runRealOpenShell, while the launch script also exports NEMOCLAW_OPENSHELL_BIN and other NEMOCLAW_LAUNCH_* process authority. The direct session_evidence OpenShell calls do not go through the shim filter. A direct inherited-environment CLI path can therefore forward private launch authority to the pinned OpenShell process, and the current recorder watches only the narrower list.

Please capture the required command values first, then strip exact NEMOCLAW_OPENSHELL_BIN / NEMOCLAW_OPENSHELL_COMMAND, every NEMOCLAW_LAUNCH_*, and every OPENSHELL_NEMOCLAW_LAUNCH_* variable before every real OpenShell execution, including the direct evidence route. Extend the enforcing fixture to observe both shim and evidence calls and prove that none of those names reaches the real binary. This must be rebound and reviewed on a descendant of the current immutable head; the approval on eb433efe does not cover the later author-owned repair.

@prekshivyas
prekshivyas merged commit 146643b into main Aug 16, 2026
51 checks passed
@prekshivyas
prekshivyas deleted the codex/fix-openclaw-launch-shim-env branch August 16, 2026 23:32
cv pushed a commit that referenced this pull request Aug 17, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Repairs four exact lifecycle/convergence regressions behind five genuine
failures in full main E2E run
[31971397245](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245)
at `03fdc7b0734d7f1f5d347b05d3a378a74d367da0`. The fixes preserve exact
platform provenance, make the Docker replacement start the final
lifecycle event, bound inference API-family cutover retries, and prove
owner-qualified cleanup before the protected harness deletes a retained
runtime.

The two OpenClaw PTY failures were intentionally excluded from this PR
and are now resolved on `main` by merged
[#9258](#9258). This branch
integrates that commit through `main` without carrying a PTY-path diff.
Credential/configuration failures and the downstream aggregate failure
are also excluded.

## Changes

- Preserve a locally proven, same-repository platform digest when the
first multi-architecture inspect reports the manifest-list digest but
the later full inspect exposes one local platform RepoDigest. A
regression test covers the exact DCode ordering from [job
95224452189](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245/job/95224452189).
- Finalize Docker GPU replacement as stop replacement → remove backup →
start replacement → fresh supervisor-readiness check. This makes the
replacement start the final Docker lifecycle event and fixes the shared
root behind [onboarding job
95224452811](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245/job/95224452811)
and [Model Router job
95224452986](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245/job/95224452986).
Partial stop/remove/start states remain fail closed. An
already-finalized helper outcome is accepted after the earlier reconnect
proof, while an explicit replacement restart failure remains fatal.
- Resolve the previous inference API family before mutation. Only when
the family changes, retry HTTP 400/404 route-convergence responses after
one and two seconds, for three total bounded requests; all other
failures retain the existing rollback path. This fixes [job
95224452700](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245/job/95224452700)
without increasing probe timeouts or retrying authentication/5xx
failures. Exhaustion coverage proves prior-route restoration, exact
deletion of the newly created provider, and no registry/config
persistence.
- Correct the protected managed-image rollback proof for [job
95226998860](https://github.com/NVIDIA/NemoClaw/actions/runs/31971397245/job/95226998860):
require the exact owner-cleanup error, durable sandbox identity, exact
retained runtime, and stopped/unpaused/non-restarting state before
harness-owned deletion, then prove zero container, network, and state
orphans. OpenShell list validation now parses stdout and matches the
exact sandbox-name field, rejecting containing names and stderr-only
mentions.
- Stabilize the CLI coverage merge without weakening its ratchet: keep
the no-follow failure proof in the credential filter's owning test file
so one shard reports both normal and fail-closed paths instead of
competing instrumented module maps. The production credential filter is
unchanged and remains above its existing 80% statements, 65% branches,
and 80% lines thresholds.
- Document the observable inference retry contract and the destructive
Docker handoff boundary.
- Do not change growth budgets, coverage thresholds, test-size limits,
timeouts, security controls, or PTY files in the PR diff.

## Type of Change

- [ ] Code change (feature, bug fix, or refactor)
- [x] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: Independent
nine-category review passed exact commit `637f52fa0e` with no findings
or blockers. It verified unchanged fail-closed credential behavior,
bounded retries and rollback, fail-closed Docker partial states,
immutable digest provenance, exact cleanup ownership/name parsing, and
no weakened guard, timeout, threshold, policy, or security boundary.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `docs-updated`
- Evidence: `docs/inference/switch-providers.mdx`;
`docs/reference/commands.mdx`
- Agent: Codex Desktop
<!-- docs-review-head-sha: 637f52f -->
<!-- docs-review-agents-blob-sha: e30afb2 -->

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit:
- Station profile/scenario:
- Result:
- Supporting evidence:

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: 65/65
focused CLI regression tests, 36/36 protected-runtime contract tests,
32/32 credential-filter tests, and 34/34 compatible-provider tests
passed. Credential-filter coverage is 84% statements, 82.25% branches,
100% functions, and 90.36% lines against unchanged 80/65/80 thresholds.
The merged #9258 PTY support suite passes 8/8 applicable tests locally
with 20 Linux-only tests skipped. The independent security review
additionally passed 268 focused/adjacent tests and 129 semantic E2E
phase tests on the byte-identical reviewed tree.
- [x] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: GitHub Linux PR CI run
31980074939 passed all 12 CLI shards, aggregate coverage, static checks,
build/typecheck, installer integration, plugin coverage, reviewed
audits, and required aggregate checks. Managed-images run 31980075046
passed DCode staging QA, Pi candidate builds, Hermes/Deep Agents
Code/OpenClaw direct startup, and exact all-agent managed runtime
activation. Earlier local macOS all-project attempts encountered
unrelated #9189 fixture timing limits; affected-path suites and
repository gates passed.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only) —
result: 0 errors and 2 pre-existing Fern warnings; all generated
variants and routes are synchronized.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

Additional exact-commit validation at `637f52fa0e`:

- `npm run validate:pr`: passed.
- `npm run lint`: passed; 0 architecture cycles and fan-in/fan-out
budgets preserved.
- `npm run test-loops:scan -- --top 20`: passed.
- `npm run test-conditionals:scan -- --top 25`: passed without adding a
conditional.
- `npm run test-size:check`: passed for 2,421 files.
- `npm run typecheck:cli`: passed.
- `npm run docs`: passed with 0 errors and 2 pre-existing Fern warnings.
- `git diff --check`: passed.
- Full diff: 17 files, 760 insertions, 131 deletions.
- Independent documentation review: passed at `637f52fa0e`.
- Independent nine-category security review: passed at `637f52fa0e` with
no findings.

---
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Reliability**
- Provider switches now validate target routes before saving, retry
eligible compatibility failures, and restore the previous route if
validation fails.
- GPU runtime replacement now completes a safer final handoff,
preserving the backup until the replacement is confirmed ready.
- Base image resolution more accurately preserves platform-specific
digest information.

- **Security**
- Credential sanitizers fail safely when required file protections are
unavailable, without modifying source files.

- **Cleanup**
- Failed managed runtime operations retain only expected stopped
resources until cleanup completes, improving rollback verification.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants