Skip to content

fix(e2e): avoid multiline Deep Agents Python probe - #5899

Merged
cv merged 4 commits into
mainfrom
fix/deepagents-python-egress-probe
Jun 27, 2026
Merged

fix(e2e): avoid multiline Deep Agents Python probe#5899
cv merged 4 commits into
mainfrom
fix/deepagents-python-egress-probe

Conversation

@cv

@cv cv commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the Deep Agents Code Python egress check so its OpenShell sandbox exec call no longer passes a multi-line heredoc as a command argument. The post-#5897 rerun showed OpenShell rejects that argument shape before the policy checks can run.

Changes

  • Encodes the Python egress probe source locally with base64 and decodes it to a temp file inside the sandbox.
  • Executes the temp probe file with the requested Python interpreter and URL argument, then removes it.
  • Adds a self-test/support test proving the command sent through sandbox_exec is single-line.

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: live E2E harness behavior only.
  • 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: self-review; command-shape fix keeps the same in-sandbox probe source and policy assertions.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • 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)

Targeted verification:

bash -n test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-command-shape bash test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
npm test -- --run test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts
npm run typecheck:cli

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Tests
    • Strengthened the cloud-experimental end-to-end check for the Python egress probe to ensure it completes successfully.
    • Added a self-test mode that validates the generated probe command is strictly single-line (no newline characters) and emits the expected sentinel output.
    • Updated Deep Agents Code policy behavior checks to match the revised probe construction/execution flow using an encoded probe payload, and to explicitly confirm the implementation does not rely on temporary file creation.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Python egress probe now builds a base64-decoded python_bin -c command, and new tests verify the generated command contains no newline characters.

Changes

Python egress probe command shape

Layer / File(s) Summary
Probe source and execution
test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
python_probe_source emits the embedded Python probe source, and python_probe now base64-encodes it, decodes it in a remote ${python_bin} -c command, and runs that command through sandbox_exec while preserving the fixture fast-path.
Command-shape self-test and assertions
test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh, test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts, test/langchain-deepagents-code-image.test.ts
probe-command-shape rejects newline-containing commands, and the e2e tests assert the script succeeds, prints the sentinel output, and matches the updated base64-based command construction.

Sequence Diagram(s)

sequenceDiagram
  participant Test as platform-parity-cloud-experimental.test.ts
  participant Script as 06-deepagents-code-python-egress.sh
  participant Sandbox as sandbox_exec
  participant Python as python_bin

  Test->>Script: spawnSync with probe-command-shape
  Script->>Sandbox: run python_probe
  Sandbox->>Python: execute base64-decoded probe via -c
  Python-->>Sandbox: exit status
  Sandbox-->>Script: return probe result
  Script-->>Test: stdout NO_NEWLINE_IN_COMMAND
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5823: Also changes the Deep Agents Code Python egress probe command construction and related assertions in the same test area.
  • NVIDIA/NemoClaw#5897: Modifies 06-deepagents-code-python-egress.sh around python_probe and its egress-checking behavior.

Suggested labels

bug-fix, area: e2e

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making the Deep Agents Python e2e probe single-line instead of multiline.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deepagents-python-egress-probe

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

@github-code-quality

github-code-quality Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the fix/deepagents-pytho... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/deepagents-pytho... a7ac294 +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the fix/deepagents-pytho... branch is 47%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/deepagents-pytho... a7ac294 +/-
src/lib/state/o...oard-session.ts 91%
src/lib/actions...dbox/rebuild.ts 73%
src/lib/sandbox/config.ts 72%
src/lib/onboard/preflight.ts 62%
src/lib/shields/index.ts 62%
src/lib/actions...licy-channel.ts 60%
src/lib/state/sandbox.ts 56%
src/lib/policy/index.ts 48%
src/lib/onboard...er-gpu-patch.ts 47%
src/lib/onboard.ts 18%

Updated June 27, 2026 07:57 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Blocked

Merge posture: Do not merge until addressed
Primary next action: Fix PRA-2: TOCTOU race condition via predictable mktemp in world-writable /tmp — FIXED in this PR; then add or justify PRA-T1.
Open items: 1 required · 6 warnings · 2 suggestions · 6 test follow-ups
Since last review: 1 prior item resolved · 5 still apply · 2 new items found

Action checklist

  • PRA-2 Fix: TOCTOU race condition via predictable mktemp in world-writable /tmp — FIXED in this PR in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • PRA-1 Resolve or justify: Source-of-truth review needed: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37-105 (base64 roundtrip workaround for alleged OpenShell multiline rejection)
  • PRA-3 Resolve or justify: Base64-encoded probe reduces auditability; sister script uses readable heredoc in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • PRA-4 Resolve or justify: Workaround for OpenShell multi-line rejection implemented without root cause verification in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • PRA-5 Resolve or justify: Source-of-truth review: base64+tempfile workaround lacks source-fix investigation in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • PRA-6 Resolve or justify: New test only verifies command shape, not end-to-end probe execution in test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts:80
  • PRA-9 Resolve or justify: Base64 pipeline executes decoded content via command substitution — verify no injection in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:103
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: New test only verifies command shape, not end-to-end probe execution
  • PRA-T5 Add or justify test follow-up: Acceptance clause
  • PRA-T6 Add or justify test follow-up: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37-105 (base64 roundtrip workaround for alleged OpenShell multiline rejection)
  • PRA-7 In-scope improvement: Function python_probe_source() misnamed — outputs raw Python, not base64 in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94
  • PRA-8 In-scope improvement: Simplification: adopt sister script heredoc pattern to delete ~25 lines in test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify architecture Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-2 Required correctness test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97 No action needed — the fix is in this PR. Verify line 97 no longer contains mktemp.
PRA-3 Resolve/justify security test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37 Adopt sister script's heredoc pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64 encoding/decoding (~25 lines). Test with python_bin=/sandbox/.nemoclaw-e2e-project-venv/bin/python3.
PRA-4 Resolve/justify acceptance test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97 Test heredoc approach with variable python_bin: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. If it works, delete base64 complexity. If it fails, document exact OpenShell exec limitation and file issue to fix OpenShell.
PRA-5 Resolve/justify architecture test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37 Either: (a) prove heredoc works with variable python_bin and delete workaround, or (b) document exact failure, file OpenShell issue, add TODO with removal condition. Do not merge workaround without this analysis.
PRA-6 Resolve/justify tests test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts:80 Add self-test mode (e.g., NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) that runs probe against local test HTTP server to verify BLOCKED/REACHED logic end-to-end. Or switch to heredoc approach and test actual probe behavior. Existing 'blocked-no-marker' self-test shows the pattern.
PRA-7 Improvement correctness test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94 Rename to python_probe_python_source() or python_probe_script(), or eliminate entirely by inlining heredoc at call site (sister script pattern).
PRA-8 Improvement correctness test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94 Replace python_probe() with sister script pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64, tr, printf pipeline. ~25 lines removed.
PRA-9 Resolve/justify security test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:103 Adopt heredoc approach which avoids command substitution with decoded content. If keeping base64, ensure python_probe_source never incorporates external input and add comment documenting this trust boundary.

🚨 Required before merge

Address these before merging unless a maintainer explicitly overrides the advisor with rationale.

PRA-2 Required — TOCTOU race condition via predictable mktemp in world-writable /tmp — FIXED in this PR

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • Category: correctness
  • Problem: Previous version used `mktemp -d /tmp/nemoclaw-python-egress.XXXXXX` creating a predictable temp directory in world-writable /tmp. A malicious co-tenant process could race to overwrite probe.py between creation and python execution. This PR removes mktemp entirely, using base64 roundtrip instead. The TOCTOU is fixed.
  • Impact: Potential probe tampering inside sandbox leading to false pass/fail results or arbitrary code execution within sandbox context. Security property (network policy enforcement) could be subverted by malicious co-tenant process.
  • Required action: No action needed — the fix is in this PR. Verify line 97 no longer contains mktemp.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Check line 97 of 06-deepagents-code-python-egress.sh for mktemp usage. Confirm base64 pipeline replaces it.
  • Missing regression test: None needed for this specific fix; the base64 approach inherently avoids temp files.
  • Done when: The required change is committed and verification passes: Check line 97 of 06-deepagents-code-python-egress.sh for mktemp usage. Confirm base64 pipeline replaces it.
  • Evidence: Line 97 in prior version: remote_cmd="probe_dir=$(mktemp -d /tmp/nemoclaw-python-egress.XXXXXX); probe=\"$probe_dir/probe.py\"; cleanup(){ rm -rf \"$probe_dir\"; }; trap cleanup EXIT; printf '%s' ${encoded@Q} | base64 -d > \"$probe\"; ${python_bin@Q} \"$probe\" ${url@Q}"
Review findings by urgency: 1 required fix, 6 items to resolve/justify, 2 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Source-of-truth review needed: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37-105 (base64 roundtrip workaround for alleged OpenShell multiline rejection)

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: None. No test demonstrates heredoc failure with variable python_bin.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: PR body claims 'OpenShell rejects that argument shape' but provides no evidence. Sister script 09-deepagents-code-tavily-opt-in.sh:37 uses heredoc with python3. No test in codebase proves heredoc fails with variable python_bin.

PRA-3 Resolve/justify — Base64-encoded probe reduces auditability; sister script uses readable heredoc

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • Category: security
  • Problem: The probe Python source is base64-encoded in the executed command (`python_bin -c "$(printf '%s' ${encoded@Q} | base64 -d)"`), making it unreadable in logs/debugging. Sister script 09-deepagents-code-tavily-opt-in.sh:37 uses direct heredoc: `sandbox_exec "python3 - ${url@Q} <<'PY'...PY"` keeping source auditable. No evidence provided that heredoc fails with variable python_bin.
  • Impact: Reduced auditability of executed probe logic in logs; security reviewers cannot easily verify probe behavior from command strings. Added complexity increases surface for bugs.
  • Recommended action: Adopt sister script's heredoc pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64 encoding/decoding (~25 lines). Test with python_bin=/sandbox/.nemoclaw-e2e-project-venv/bin/python3.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Compare 06-deepagents-code-python-egress.sh python_probe() with 09-deepagents-code-tavily-opt-in.sh python_probe(). Run heredoc approach manually with variable python_bin to verify it works.
  • Missing regression test: Add test that runs actual probe via heredoc against test HTTP server (NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) verifying BLOCKED/REACHED logic end-to-end.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Compare 06-deepagents-code-python-egress.sh python_probe() with 09-deepagents-code-tavily-opt-in.sh python_probe(). Run heredoc approach manually with variable python_bin to verify it works.
  • Evidence: Sister script line 37: sandbox_exec "python3 - ${url@Q} <<'PY'...PY" — readable Python source in command. This script line 103: ${python_bin@Q} -c "$(printf '%s' ${encoded@Q} | base64 -d)" ${url@Q} — base64 opaque.

PRA-4 Resolve/justify — Workaround for OpenShell multi-line rejection implemented without root cause verification

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • Category: acceptance
  • Problem: PR claims base64 avoids 'OpenShell multiline rejection' but provides no evidence. Sister script uses heredoc successfully. The @q quoting handles variable python_bin paths. No investigation documented for: what invalid state, where created, why source can't be fixed, regression test proving source can't regress, removal condition.
  • Impact: Localized workaround preserves/hides potential OpenShell bug without path to fix. If heredoc actually works, ~25 lines of unnecessary complexity remain.
  • Recommended action: Test heredoc approach with variable python_bin: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. If it works, delete base64 complexity. If it fails, document exact OpenShell exec limitation and file issue to fix OpenShell.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run manual test: `openshell sandbox exec --name <sandbox> -- bash -c 'python3 - https://example.com <<"PY"...PY"'` with python_bin set to both 'python3' and '/sandbox/.nemoclaw-e2e-project-venv/bin/python3'.
  • Missing regression test: Test proving heredoc fails with variable python_bin, or test proving it works (enabling workaround removal).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run manual test: `openshell sandbox exec --name <sandbox> -- bash -c 'python3 - https://example.com <<"PY"...PY"'` with python_bin set to both 'python3' and '/sandbox/.nemoclaw-e2e-project-venv/bin/python3'.
  • Evidence: PR body: 'OpenShell rejects that argument shape before the policy checks can run.' No test or log evidence in diff. Sister script line 37 uses heredoc with python3 successfully.

PRA-5 Resolve/justify — Source-of-truth review: base64+tempfile workaround lacks source-fix investigation

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • Category: architecture
  • Problem: Localized workaround (base64 roundtrip) preserves/hides invalid state without answering: what invalid state is handled, where created, why source can't be fixed in this PR, regression test proving source can't regress, when workaround can be removed. Prefer fixes that make invalid states impossible at source.
  • Impact: Workaround becomes permanent technical debt if root cause not investigated. Masks potential OpenShell bug that should be fixed upstream.
  • Recommended action: Either: (a) prove heredoc works with variable python_bin and delete workaround, or (b) document exact failure, file OpenShell issue, add TODO with removal condition. Do not merge workaround without this analysis.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check PR description and code comments for root-cause analysis of heredoc failure with variable python_bin. None found in diff.
  • Missing regression test: Test demonstrating heredoc failure mode with variable python_bin, or test passing with heredoc (enabling workaround removal).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check PR description and code comments for root-cause analysis of heredoc failure with variable python_bin. None found in diff.
  • Evidence: No root-cause analysis in PR body or code comments. Sister script proves heredoc works with static python3.

PRA-6 Resolve/justify — New test only verifies command shape, not end-to-end probe execution

  • Location: test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts:80
  • Category: tests
  • Problem: The 'probe-command-shape' test mocks sandbox_exec to verify no newlines in command (stdout === 'NO_NEWLINE_IN_COMMAND'). It does NOT exercise the actual base64→decode→python pipeline to confirm probe logic (denial marker detection, HTTP error handling, REACHED/BLOCKED/ERROR output) works correctly. Security property (network policy enforcement) has no automated regression coverage for this probe.
  • Impact: Regression in probe logic (base64 encoding issues, Python version compatibility, denial marker detection) would not be caught. Network policy enforcement property lacks automated regression coverage.
  • Recommended action: Add self-test mode (e.g., NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) that runs probe against local test HTTP server to verify BLOCKED/REACHED logic end-to-end. Or switch to heredoc approach and test actual probe behavior. Existing 'blocked-no-marker' self-test shows the pattern.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run the probe-command-shape test and confirm it only checks command shape. Check if any test exercises actual probe logic with base64 pipeline.
  • Missing regression test: End-to-end probe test: spawn test HTTP server, run probe via actual base64 pipeline (or heredoc), assert correct BLOCKED/REACHED/ERROR output for various responses.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run the probe-command-shape test and confirm it only checks command shape. Check if any test exercises actual probe logic with base64 pipeline.
  • Evidence: Test at line 81-103: spawns script with NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-command-shape, mocks sandbox_exec to check for newlines only. No HTTP server, no actual probe execution.

PRA-9 Resolve/justify — Base64 pipeline executes decoded content via command substitution — verify no injection

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:103
  • Category: security
  • Problem: Command: `${python_bin@Q} -c "$(printf '%s' ${encoded@Q} | base64 -d)" ${url@Q}`. The base64-decoded content is placed inside double quotes in -c argument. Since encoded@Q is quoted and base64 -d output is controlled (from python_probe_source heredoc), injection risk is low. But double-quoted command substitution with decoded content is fragile — if python_probe_source ever included user input, could be risky. Heredoc approach avoids this entirely.
  • Impact: Fragile trust boundary: currently safe (static source) but any future change adding external input to python_probe_source could introduce command injection. Heredoc pattern has no such risk.
  • Recommended action: Adopt heredoc approach which avoids command substitution with decoded content. If keeping base64, ensure python_probe_source never incorporates external input and add comment documenting this trust boundary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Trace data flow: python_probe_source (static heredoc) → base64 → encoded@Q → printf → base64 -d → command substitution → -c argument. Confirm no user-controlled data enters python_probe_source.
  • Missing regression test: Test that probes with special characters in URL (handled by ${url@Q}) don't break base64 pipeline.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Trace data flow: python_probe_source (static heredoc) → base64 → encoded@Q → printf → base64 -d → command substitution → -c argument. Confirm no user-controlled data enters python_probe_source.
  • Evidence: Line 103: remote_cmd="${python_bin@Q} -c \"$(printf '%s' ${encoded@Q} | base64 -d)\" ${url@Q}" — decoded content inside double-quoted -c argument.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

PRA-7 Improvement — Function python_probe_source() misnamed — outputs raw Python, not base64

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94
  • Category: correctness
  • Problem: Function python_probe_source() uses heredoc to output raw Python source code. The base64 encoding happens in python_probe() caller. Name suggests it returns base64; it returns raw Python. Misleading for maintainers.
  • Impact: Maintainer confusion; function name does not match behavior.
  • Suggested action: Rename to python_probe_python_source() or python_probe_script(), or eliminate entirely by inlining heredoc at call site (sister script pattern).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read function definition at line 94 and its usage at line 103.
  • Missing regression test: None — naming clarity only.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Function at line 94: python_probe_source() { cat <<'PY'...PY } — outputs raw Python. Caller at line 103: encoded="$(python_probe_source | base64 | tr -d '\n')" — base64 happens in caller.

PRA-8 Improvement — Simplification: adopt sister script heredoc pattern to delete ~25 lines

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94
  • Category: correctness
  • Problem: Sister script 09-deepagents-code-tavily-opt-in.sh uses 10-line heredoc python_probe(). This script uses 35-line base64 pipeline (python_probe_source + base64 encode/decode). Simplification ladder: sister script proves heredoc works; Node/Python/shell already provide heredoc; no dependency needed; one pattern covers both. Base64 adds YAGNI complexity.
  • Impact: ~25 extra lines of fragile base64 pipeline; two divergent patterns for same probe logic in sister scripts.
  • Suggested action: Replace python_probe() with sister script pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64, tr, printf pipeline. ~25 lines removed.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Compare line counts: 09-deepagents-code-tavily-opt-in.sh python_probe (10 lines) vs 06-deepagents-code-python-egress.sh python_probe + python_probe_source (35 lines).
  • Missing regression test: Test proving heredoc works with variable python_bin (same as PRA-5).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Sister script 09-deepagents-code-tavily-opt-in.sh line 37: 10-line heredoc probe. This script: python_probe_source (22 lines) + python_probe with base64 pipeline (15 lines) = 37 lines.
Simplification opportunities: 1 possible cut, net -25 lines possible

These are safe simplification checks only. Do not remove validation, security controls, data-loss prevention, or required tests.

  • PRA-8 yagni (test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94): python_probe_source() function (lines 94-118), base64 encoding pipeline in python_probe() (lines 103-105), tr -d '\n' usage
    • Replacement: Single heredoc in python_probe(): sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY" matching sister script pattern
    • Net: -25 lines
    • Safety boundary: Heredoc must preserve @q quoting for python_bin and url to prevent command injection; denial marker detection logic must remain identical
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — End-to-end probe test: spawn test HTTP server, run probe via actual execution path (base64 or heredoc), assert correct BLOCKED/REACHED/ERROR output for policy-denied, allowed, and error responses. New test only verifies command shape (no newlines). Does not exercise actual probe execution pipeline (base64 decode → python) to confirm denial marker detection, HTTP error handling, BLOCKED/REACHED logic. Security property (network policy enforcement) lacks automated regression coverage.
  • PRA-T2 Runtime validation — Test proving heredoc approach works with variable python_bin (both 'python3' and '/sandbox/.nemoclaw-e2e-project-venv/bin/python3'), enabling deletion of base64 workaround. New test only verifies command shape (no newlines). Does not exercise actual probe execution pipeline (base64 decode → python) to confirm denial marker detection, HTTP error handling, BLOCKED/REACHED logic. Security property (network policy enforcement) lacks automated regression coverage.
  • PRA-T3 Runtime validation — If heredoc fails with variable python_bin: test documenting exact failure mode, filed OpenShell issue reference, and TODO with removal condition. New test only verifies command shape (no newlines). Does not exercise actual probe execution pipeline (base64 decode → python) to confirm denial marker detection, HTTP error handling, BLOCKED/REACHED logic. Security property (network policy enforcement) lacks automated regression coverage.
  • PRA-T4 New test only verifies command shape, not end-to-end probe execution — Add self-test mode (e.g., NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) that runs probe against local test HTTP server to verify BLOCKED/REACHED logic end-to-end. Or switch to heredoc approach and test actual probe behavior. Existing 'blocked-no-marker' self-test shows the pattern.
  • PRA-T5 Acceptance clause — OpenShell rejects multi-line heredoc as command argument before policy checks can run — add test evidence or identify existing coverage. PR body claims this but no test, log, or code evidence in diff. Sister script uses heredoc successfully with python3. No test shows heredoc fails with variable python_bin.
  • PRA-T6 test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37-105 (base64 roundtrip workaround for alleged OpenShell multiline rejection) — None. No test demonstrates heredoc failure with variable python_bin.. PR body claims 'OpenShell rejects that argument shape' but provides no evidence. Sister script 09-deepagents-code-tavily-opt-in.sh:37 uses heredoc with python3. No test in codebase proves heredoc fails with variable python_bin.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37-105 (base64 roundtrip workaround for alleged OpenShell multiline rejection)

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: None. No test demonstrates heredoc failure with variable python_bin.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: PR body claims 'OpenShell rejects that argument shape' but provides no evidence. Sister script 09-deepagents-code-tavily-opt-in.sh:37 uses heredoc with python3. No test in codebase proves heredoc fails with variable python_bin.

PRA-2 Required — TOCTOU race condition via predictable mktemp in world-writable /tmp — FIXED in this PR

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • Category: correctness
  • Problem: Previous version used `mktemp -d /tmp/nemoclaw-python-egress.XXXXXX` creating a predictable temp directory in world-writable /tmp. A malicious co-tenant process could race to overwrite probe.py between creation and python execution. This PR removes mktemp entirely, using base64 roundtrip instead. The TOCTOU is fixed.
  • Impact: Potential probe tampering inside sandbox leading to false pass/fail results or arbitrary code execution within sandbox context. Security property (network policy enforcement) could be subverted by malicious co-tenant process.
  • Required action: No action needed — the fix is in this PR. Verify line 97 no longer contains mktemp.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Check line 97 of 06-deepagents-code-python-egress.sh for mktemp usage. Confirm base64 pipeline replaces it.
  • Missing regression test: None needed for this specific fix; the base64 approach inherently avoids temp files.
  • Done when: The required change is committed and verification passes: Check line 97 of 06-deepagents-code-python-egress.sh for mktemp usage. Confirm base64 pipeline replaces it.
  • Evidence: Line 97 in prior version: remote_cmd="probe_dir=$(mktemp -d /tmp/nemoclaw-python-egress.XXXXXX); probe=\"$probe_dir/probe.py\"; cleanup(){ rm -rf \"$probe_dir\"; }; trap cleanup EXIT; printf '%s' ${encoded@Q} | base64 -d > \"$probe\"; ${python_bin@Q} \"$probe\" ${url@Q}"

PRA-3 Resolve/justify — Base64-encoded probe reduces auditability; sister script uses readable heredoc

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • Category: security
  • Problem: The probe Python source is base64-encoded in the executed command (`python_bin -c "$(printf '%s' ${encoded@Q} | base64 -d)"`), making it unreadable in logs/debugging. Sister script 09-deepagents-code-tavily-opt-in.sh:37 uses direct heredoc: `sandbox_exec "python3 - ${url@Q} <<'PY'...PY"` keeping source auditable. No evidence provided that heredoc fails with variable python_bin.
  • Impact: Reduced auditability of executed probe logic in logs; security reviewers cannot easily verify probe behavior from command strings. Added complexity increases surface for bugs.
  • Recommended action: Adopt sister script's heredoc pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64 encoding/decoding (~25 lines). Test with python_bin=/sandbox/.nemoclaw-e2e-project-venv/bin/python3.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Compare 06-deepagents-code-python-egress.sh python_probe() with 09-deepagents-code-tavily-opt-in.sh python_probe(). Run heredoc approach manually with variable python_bin to verify it works.
  • Missing regression test: Add test that runs actual probe via heredoc against test HTTP server (NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) verifying BLOCKED/REACHED logic end-to-end.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Compare 06-deepagents-code-python-egress.sh python_probe() with 09-deepagents-code-tavily-opt-in.sh python_probe(). Run heredoc approach manually with variable python_bin to verify it works.
  • Evidence: Sister script line 37: sandbox_exec "python3 - ${url@Q} <<'PY'...PY" — readable Python source in command. This script line 103: ${python_bin@Q} -c "$(printf '%s' ${encoded@Q} | base64 -d)" ${url@Q} — base64 opaque.

PRA-4 Resolve/justify — Workaround for OpenShell multi-line rejection implemented without root cause verification

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:97
  • Category: acceptance
  • Problem: PR claims base64 avoids 'OpenShell multiline rejection' but provides no evidence. Sister script uses heredoc successfully. The @q quoting handles variable python_bin paths. No investigation documented for: what invalid state, where created, why source can't be fixed, regression test proving source can't regress, removal condition.
  • Impact: Localized workaround preserves/hides potential OpenShell bug without path to fix. If heredoc actually works, ~25 lines of unnecessary complexity remain.
  • Recommended action: Test heredoc approach with variable python_bin: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. If it works, delete base64 complexity. If it fails, document exact OpenShell exec limitation and file issue to fix OpenShell.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run manual test: `openshell sandbox exec --name <sandbox> -- bash -c 'python3 - https://example.com <<"PY"...PY"'` with python_bin set to both 'python3' and '/sandbox/.nemoclaw-e2e-project-venv/bin/python3'.
  • Missing regression test: Test proving heredoc fails with variable python_bin, or test proving it works (enabling workaround removal).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run manual test: `openshell sandbox exec --name <sandbox> -- bash -c 'python3 - https://example.com <<"PY"...PY"'` with python_bin set to both 'python3' and '/sandbox/.nemoclaw-e2e-project-venv/bin/python3'.
  • Evidence: PR body: 'OpenShell rejects that argument shape before the policy checks can run.' No test or log evidence in diff. Sister script line 37 uses heredoc with python3 successfully.

PRA-5 Resolve/justify — Source-of-truth review: base64+tempfile workaround lacks source-fix investigation

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:37
  • Category: architecture
  • Problem: Localized workaround (base64 roundtrip) preserves/hides invalid state without answering: what invalid state is handled, where created, why source can't be fixed in this PR, regression test proving source can't regress, when workaround can be removed. Prefer fixes that make invalid states impossible at source.
  • Impact: Workaround becomes permanent technical debt if root cause not investigated. Masks potential OpenShell bug that should be fixed upstream.
  • Recommended action: Either: (a) prove heredoc works with variable python_bin and delete workaround, or (b) document exact failure, file OpenShell issue, add TODO with removal condition. Do not merge workaround without this analysis.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Check PR description and code comments for root-cause analysis of heredoc failure with variable python_bin. None found in diff.
  • Missing regression test: Test demonstrating heredoc failure mode with variable python_bin, or test passing with heredoc (enabling workaround removal).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Check PR description and code comments for root-cause analysis of heredoc failure with variable python_bin. None found in diff.
  • Evidence: No root-cause analysis in PR body or code comments. Sister script proves heredoc works with static python3.

PRA-6 Resolve/justify — New test only verifies command shape, not end-to-end probe execution

  • Location: test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts:80
  • Category: tests
  • Problem: The 'probe-command-shape' test mocks sandbox_exec to verify no newlines in command (stdout === 'NO_NEWLINE_IN_COMMAND'). It does NOT exercise the actual base64→decode→python pipeline to confirm probe logic (denial marker detection, HTTP error handling, REACHED/BLOCKED/ERROR output) works correctly. Security property (network policy enforcement) has no automated regression coverage for this probe.
  • Impact: Regression in probe logic (base64 encoding issues, Python version compatibility, denial marker detection) would not be caught. Network policy enforcement property lacks automated regression coverage.
  • Recommended action: Add self-test mode (e.g., NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-e2e) that runs probe against local test HTTP server to verify BLOCKED/REACHED logic end-to-end. Or switch to heredoc approach and test actual probe behavior. Existing 'blocked-no-marker' self-test shows the pattern.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Run the probe-command-shape test and confirm it only checks command shape. Check if any test exercises actual probe logic with base64 pipeline.
  • Missing regression test: End-to-end probe test: spawn test HTTP server, run probe via actual base64 pipeline (or heredoc), assert correct BLOCKED/REACHED/ERROR output for various responses.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Run the probe-command-shape test and confirm it only checks command shape. Check if any test exercises actual probe logic with base64 pipeline.
  • Evidence: Test at line 81-103: spawns script with NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-command-shape, mocks sandbox_exec to check for newlines only. No HTTP server, no actual probe execution.

PRA-7 Improvement — Function python_probe_source() misnamed — outputs raw Python, not base64

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94
  • Category: correctness
  • Problem: Function python_probe_source() uses heredoc to output raw Python source code. The base64 encoding happens in python_probe() caller. Name suggests it returns base64; it returns raw Python. Misleading for maintainers.
  • Impact: Maintainer confusion; function name does not match behavior.
  • Suggested action: Rename to python_probe_python_source() or python_probe_script(), or eliminate entirely by inlining heredoc at call site (sister script pattern).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read function definition at line 94 and its usage at line 103.
  • Missing regression test: None — naming clarity only.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Function at line 94: python_probe_source() { cat <<'PY'...PY } — outputs raw Python. Caller at line 103: encoded="$(python_probe_source | base64 | tr -d '\n')" — base64 happens in caller.

PRA-8 Improvement — Simplification: adopt sister script heredoc pattern to delete ~25 lines

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:94
  • Category: correctness
  • Problem: Sister script 09-deepagents-code-tavily-opt-in.sh uses 10-line heredoc python_probe(). This script uses 35-line base64 pipeline (python_probe_source + base64 encode/decode). Simplification ladder: sister script proves heredoc works; Node/Python/shell already provide heredoc; no dependency needed; one pattern covers both. Base64 adds YAGNI complexity.
  • Impact: ~25 extra lines of fragile base64 pipeline; two divergent patterns for same probe logic in sister scripts.
  • Suggested action: Replace python_probe() with sister script pattern: `sandbox_exec "${python_bin@Q} - ${url@Q} <<'PY'...PY"`. Delete python_probe_source, base64, tr, printf pipeline. ~25 lines removed.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Compare line counts: 09-deepagents-code-tavily-opt-in.sh python_probe (10 lines) vs 06-deepagents-code-python-egress.sh python_probe + python_probe_source (35 lines).
  • Missing regression test: Test proving heredoc works with variable python_bin (same as PRA-5).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Sister script 09-deepagents-code-tavily-opt-in.sh line 37: 10-line heredoc probe. This script: python_probe_source (22 lines) + python_probe with base64 pipeline (15 lines) = 37 lines.

PRA-9 Resolve/justify — Base64 pipeline executes decoded content via command substitution — verify no injection

  • Location: test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh:103
  • Category: security
  • Problem: Command: `${python_bin@Q} -c "$(printf '%s' ${encoded@Q} | base64 -d)" ${url@Q}`. The base64-decoded content is placed inside double quotes in -c argument. Since encoded@Q is quoted and base64 -d output is controlled (from python_probe_source heredoc), injection risk is low. But double-quoted command substitution with decoded content is fragile — if python_probe_source ever included user input, could be risky. Heredoc approach avoids this entirely.
  • Impact: Fragile trust boundary: currently safe (static source) but any future change adding external input to python_probe_source could introduce command injection. Heredoc pattern has no such risk.
  • Recommended action: Adopt heredoc approach which avoids command substitution with decoded content. If keeping base64, ensure python_probe_source never incorporates external input and add comment documenting this trust boundary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Trace data flow: python_probe_source (static heredoc) → base64 → encoded@Q → printf → base64 -d → command substitution → -c argument. Confirm no user-controlled data enters python_probe_source.
  • Missing regression test: Test that probes with special characters in URL (handled by ${url@Q}) don't break base64 pipeline.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Trace data flow: python_probe_source (static heredoc) → base64 → encoded@Q → printf → base64 -d → command substitution → -c argument. Confirm no user-controlled data enters python_probe_source.
  • Evidence: Line 103: remote_cmd="${python_bin@Q} -c \"$(printf '%s' ${encoded@Q} | base64 -d)\" ${url@Q}" — decoded content inside double-quoted -c argument.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: ubuntu-repo-cloud-langchain-deepagents-code

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No merge-blocking E2E is required because the PR is tests-only and changes only E2E/support test code, not NemoClaw runtime behavior, installer/onboarding, credentials, sandbox lifecycle, policy assets, inference routing, or deployment code.

Optional E2E

  • ubuntu-repo-cloud-langchain-deepagents-code: Optional confidence run for the changed live check: this typed Vitest scenario onboards the LangChain Deep Agents Code sandbox and runs the cloud-experimental Deep Agents checks, including 06-deepagents-code-python-egress.sh, against a real OpenShell sandbox.

New E2E recommendations

  • None.

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: ubuntu-repo-cloud-langchain-deepagents-code
Optional Vitest E2E scenarios: None

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field scenarios=ubuntu-repo-cloud-langchain-deepagents-code

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • ubuntu-repo-cloud-langchain-deepagents-code: The PR changes the Deep Agents Code cloud-experimental Python egress live check and its Vitest parity guardrail. That check is executed by the live registry scenario for cloud-langchain-deepagents-code, so the targeted live-supported typed scenario is required.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field scenarios=ubuntu-repo-cloud-langchain-deepagents-code

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts
  • test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh

@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: No advisor follow-up required beyond maintainer review.
Open items: 0 required · 0 warnings · 0 suggestions · 0 test follow-ups
Since last review: 0 prior items resolved · 0 still apply · 0 new items found

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/langchain-deepagents-code-image.test.ts (1)

405-409: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer the script’s self-test outcome over source-text assertions.

These checks hard-code the current shell implementation (base64, mktemp, ${python_bin@Q}, etc.), so the test will fail on harmless refactors even if the real contract still holds. The support test already exercises the public boundary by running the script and asserting NO_NEWLINE_IN_COMMAND; this file should lean on that behavior instead of pinning internal command construction details. As per path instructions, "**/*.test.{ts,js,mts,mjs,cts,cjs}: Review tests for behavioral confidence rather than implementation lock-in" and "Prefer observable outcomes through the public boundary over source-text... assertions."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/langchain-deepagents-code-image.test.ts` around lines 405 - 409, The
test in pythonEgressCheck is over-specifying the shell implementation by
asserting internal script text like base64, mktemp, ${python_bin@Q}, and
${url@Q}; replace these source-text checks with assertions on the script’s
observable behavior. Use the existing public-boundary execution pattern from the
support test and verify the expected NO_NEWLINE_IN_COMMAND outcome instead,
keeping the test tied to the behavior of the relevant test helper rather than
the current command construction details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/langchain-deepagents-code-image.test.ts`:
- Around line 405-409: The test in pythonEgressCheck is over-specifying the
shell implementation by asserting internal script text like base64, mktemp,
${python_bin@Q}, and ${url@Q}; replace these source-text checks with assertions
on the script’s observable behavior. Use the existing public-boundary execution
pattern from the support test and verify the expected NO_NEWLINE_IN_COMMAND
outcome instead, keeping the test tied to the behavior of the relevant test
helper rather than the current command construction details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e149a32d-5a24-48d6-9f24-1282bd7b1dab

📥 Commits

Reviewing files that changed from the base of the PR and between edacd65 and 9628666.

📒 Files selected for processing (2)
  • test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
  • test/langchain-deepagents-code-image.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh

cv added 2 commits June 27, 2026 00:43
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/langchain-deepagents-code-image.test.ts (1)

407-409: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid source-text assertions for the probe transport.

Line 407-409 locks this test to the current base64 -d / ${python_bin@Q} -c implementation details. This PR already adds a probe-command-shape path, so the more durable check is that the probe succeeds and emits the expected sentinel through that public boundary. As per path instructions, "Prefer observable outcomes through the public boundary over source-text, private-shape, or mock-call assertions."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/langchain-deepagents-code-image.test.ts` around lines 407 - 409, The
test in langchain-deepagents-code-image.test.ts is asserting internal probe
command text instead of observable behavior. Update the check around
pythonEgressCheck to verify the public probe-command-shape path succeeds and
emits the expected sentinel, and remove the brittle source-text assertions for
mktemp, base64 -d, and ${python_bin@Q} -c. Use the probe command helper/flow
already introduced so the test validates the transport through its public
boundary rather than implementation details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/langchain-deepagents-code-image.test.ts`:
- Around line 407-409: The test in langchain-deepagents-code-image.test.ts is
asserting internal probe command text instead of observable behavior. Update the
check around pythonEgressCheck to verify the public probe-command-shape path
succeeds and emits the expected sentinel, and remove the brittle source-text
assertions for mktemp, base64 -d, and ${python_bin@Q} -c. Use the probe command
helper/flow already introduced so the test validates the transport through its
public boundary rather than implementation details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 84a5bcec-c108-4b87-a7ad-9b63fd4f9180

📥 Commits

Reviewing files that changed from the base of the PR and between 31eb3f0 and a7ac294.

📒 Files selected for processing (2)
  • test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
  • test/langchain-deepagents-code-image.test.ts

@cv
cv merged commit 73a3a7a into main Jun 27, 2026
45 checks passed
@cv
cv deleted the fix/deepagents-python-egress-probe branch June 27, 2026 07:57
cv added a commit that referenced this pull request Jun 27, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Fixes the Deep Agents Code secret-boundary check so its
`dcode_secret_probe` no longer sends a multi-line shell snippet as a
single OpenShell exec argument. The post-#5899 rerun showed OpenShell
now rejects those newline-bearing command arguments before the
secret-boundary assertions can run.

## Changes
- Compacts `dcode_secret_probe` into a single-line remote shell command
while preserving stdout/stderr capture and `DCODE_EXIT` reporting.
- Updates the Deep Agents image contract test to assert the compact
remote command shape.

## Type of Change

- [x] 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
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: live E2E harness behavior
only.
- [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: self-review;
command-shape-only change preserves existing secret-boundary assertions.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [ ] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only)
- [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)
- [ ] 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)

Targeted verification:

```bash
bash -n test/e2e/e2e-cloud-experimental/checks/08-deepagents-code-secret-boundary.sh
npm test -- --run test/langchain-deepagents-code-image.test.ts
npm run typecheck:cli
```

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


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

* **Tests**
* Strengthened secret-boundary end-to-end checks with additional stdout
assertions, including formatted command output and explicit captured
exit-status markers.
* Added/extended an opt-in self-test mode that validates the probe
execution argument contains no newline characters and verifies the
expected “no newline” marker.
* Added a new cloud-experimental end-to-end scenario that runs the
secret-boundary check in self-test mode, confirms successful execution,
and checks for the new stdout marker.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv added the v0.0.69 label Jun 27, 2026
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Fixes the Deep Agents Code Python egress check so its OpenShell sandbox
exec call no longer passes a multi-line heredoc as a command argument.
The post-NVIDIA#5897 rerun showed OpenShell rejects that argument shape before
the policy checks can run.

## Changes
- Encodes the Python egress probe source locally with base64 and decodes
it to a temp file inside the sandbox.
- Executes the temp probe file with the requested Python interpreter and
URL argument, then removes it.
- Adds a self-test/support test proving the command sent through
`sandbox_exec` is single-line.

## Type of Change

- [x] 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
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: live E2E harness behavior
only.
- [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: self-review;
command-shape fix keeps the same in-sandbox probe source and policy
assertions.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [ ] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only)
- [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)
- [ ] 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)

Targeted verification:

```bash
bash -n test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
NEMOCLAW_E2E_PYTHON_EGRESS_SELF_TEST=probe-command-shape bash test/e2e/e2e-cloud-experimental/checks/06-deepagents-code-python-egress.sh
npm test -- --run test/e2e-scenario/support-tests/platform-parity-cloud-experimental.test.ts
npm run typecheck:cli
```

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


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

* **Tests**
* Strengthened the cloud-experimental end-to-end check for the Python
egress probe to ensure it completes successfully.
* Added a self-test mode that validates the generated probe command is
strictly single-line (no newline characters) and emits the expected
sentinel output.
* Updated Deep Agents Code policy behavior checks to match the revised
probe construction/execution flow using an encoded probe payload, and to
explicitly confirm the implementation does not rely on temporary file
creation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Fixes the Deep Agents Code secret-boundary check so its
`dcode_secret_probe` no longer sends a multi-line shell snippet as a
single OpenShell exec argument. The post-NVIDIA#5899 rerun showed OpenShell
now rejects those newline-bearing command arguments before the
secret-boundary assertions can run.

## Changes
- Compacts `dcode_secret_probe` into a single-line remote shell command
while preserving stdout/stderr capture and `DCODE_EXIT` reporting.
- Updates the Deep Agents image contract test to assert the compact
remote command shape.

## Type of Change

- [x] 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
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: live E2E harness behavior
only.
- [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: self-review;
command-shape-only change preserves existing secret-boundary assertions.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [ ] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only)
- [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)
- [ ] 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)

Targeted verification:

```bash
bash -n test/e2e/e2e-cloud-experimental/checks/08-deepagents-code-secret-boundary.sh
npm test -- --run test/langchain-deepagents-code-image.test.ts
npm run typecheck:cli
```

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


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

* **Tests**
* Strengthened secret-boundary end-to-end checks with additional stdout
assertions, including formatted command output and explicit captured
exit-status markers.
* Added/extended an opt-in self-test mode that validates the probe
execution argument contains no newline characters and verifies the
expected “no newline” marker.
* Added a new cloud-experimental end-to-end scenario that runs the
secret-boundary check in self-test mode, confirms successful execution,
and checks for the new stdout marker.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression integration: dcode LangChain Deep Code integration behavior labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression integration: dcode LangChain Deep Code integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants