Skip to content

feat(dcode): add bounded headless validation profiles - #7822

Draft
jyaunches wants to merge 32 commits into
mainfrom
codex/issue-7774-v2
Draft

feat(dcode): add bounded headless validation profiles#7822
jyaunches wants to merge 32 commits into
mainfrom
codex/issue-7774-v2

Conversation

@jyaunches

@jyaunches jyaunches commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Managed headless dcode -n previously had no command-execution path.
This change adds immutable, sandbox-bound validation profiles that admit only exact validation commands through a bounded direct executor while arbitrary shell execution remains disabled.

Related Issue

Fixes #7774

Changes

  • Add the nemoclaw.dcode.validation-profile.v1 schema, canonical digest validation, secure host-file loading, transactional rebuild flag, registry persistence, and machine-readable status.
  • Bake the validated profile into the managed Deep Agents Code image and mediate its headless execute tool with exact argv, working-directory, environment-name, timeout, output, invocation, and secret-shape checks.
  • Reject loader, interpreter, package-manager, Git, OpenShell, network-trust, and other process-control environment names at both the host parser and isolated runtime while keeping HOME and PATH fixed.
  • Reverify the clean Git source identity before each execution, bind the executable and working directory through no-follow descriptors, and enforce cross-process invocation limits with root-owned sticky write-once claims.
  • Return bounded content-free validation receipts and retain OpenShell network, filesystem, process, and credential enforcement.
  • Add CLI, lifecycle, image-contract, upstream-patch, and runtime regression coverage plus operator documentation.
  • The profile is required by [dcode] Add a bounded managed headless validation-command profile #7774 for managed dcode -n automation. Directly enabling the upstream shell is insufficient because it cannot bind exact commands to sandbox, task, and source identities or enforce per-command budgets; validation-profile.test.ts and langchain-deepagents-code-validation-profile.test.ts protect that contract.

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:
  • 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: Pending maintainer security review; issue [dcode] Add a bounded managed headless validation-command profile #7774 establishes the accepted security scope.
  • 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: docs-updated
  • Evidence: Reviewed the complete diff at exact head 913becb95. The main-sync delta contains only three accepted test-timeout and stability changes; product behavior, issue [dcode] Add a bounded managed headless validation-command profile #7774 documentation, and writing guidance are unchanged. All three focused files passed (3 files, 101 tests), check:diff passed, and git diff --check passed.
  • 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 check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: 85 focused host/parser tests passed; CLI typecheck, Python compilation, repository/schema checks, Biome, ShellCheck, hadolint, and docs validation passed. The Linux-only runtime test runs in required GitHub CI.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: npm run test:changed -- --maxWorkers=4 passed 2875/2876 tests; the sole local failure is unrelated and caused by host python3 lacking PyYAML. Required GitHub CI is authoritative.
  • 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) — passed with zero errors; Fern reported the existing unauthenticated redirect-check and light-mode accent-contrast advisories.
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Julie Yaunches jyaunches@nvidia.com

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches added area: docs Documentation, examples, guides, or docs build area: security Security controls, permissions, secrets, or hardening security labels Jul 29, 2026
@jyaunches jyaunches self-assigned this Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 169b60fe-8280-4c74-a1c5-ae4e6901c7e1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a digest-bound managed DCode validation profile that can be supplied during rebuild, baked into the image, enforced for headless command execution, persisted in sandbox state, and exposed through status and documentation.

Changes

Managed DCode validation

Layer / File(s) Summary
Profile contract and validation
schemas/dcode-validation-profile.schema.json, src/lib/domain/dcode-validation-profile.ts, src/lib/onboard/dcode/validation-profile.test.ts, package.json
Defines the profile schema, canonical digest, strict parsing, file loading, encoding/decoding, cloning, path and environment constraints, and validation tests.
Rebuild profile handoff
src/commands/sandbox/rebuild.ts, src/lib/domain/lifecycle/options.ts, src/lib/actions/sandbox/rebuild*.ts
Adds the rebuild option, validates absolute paths or disabled, resolves inherited or requested profiles, encodes the result into the scoped rebuild environment, and tests the handoff.
Image installation and registry persistence
agents/langchain-deepagents-code/Dockerfile, src/lib/onboard/*, src/lib/state/registry*, test/langchain-deepagents-code-*.test.ts
Patches and validates the profile build argument, creates a root-owned image profile, initializes invocation-budget state, propagates profile metadata through onboarding, and stores it in sandbox registry entries.
Runtime command enforcement
agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, test/langchain-deepagents-code-*test.ts
Adds fail-closed profile loading, exact-argv middleware, constrained subprocess execution, timeout/output/invocation limits, bounded receipts, and wiring tests for subagents and unavailable middleware boundaries.
Status and operator documentation
src/lib/actions/sandbox/status-*, docs/get-started/quickstart-langchain-deepagents-code.mdx, docs/reference/commands.mdx
Reports the effective profile digest and command count, and documents installation, enforcement, inspection, retention, and disabling behavior.

Estimated code review effort: 5 (Critical) | ~90 minutes

Suggested labels: area: sandbox, area: cli, feature, needs: review

Suggested reviewers: cv, brandonpelfrey, ericksoa

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.17% 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
Linked Issues check ✅ Passed The changes implement the requested immutable profile, bounded exact-argv execution, digest/status output, fail-closed behavior, and supporting tests/docs for #7774.
Out of Scope Changes check ✅ Passed The patch set stays focused on the validation-profile feature, with tests, docs, runtime, CLI, schema, and policy updates all directly supporting it.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding bounded headless validation profiles for managed DCode execution.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-7774-v2

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

@github-actions

Copy link
Copy Markdown
Contributor

@github-code-quality

github-code-quality Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 9f48519 in the codex/issue-7774-v2 branch remains at 96%, unchanged from commit 4dcb89e in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 9f48519 in the codex/issue-7774-v2 branch remains at 81%, unchanged from commit 4dcb89e in the main branch.

Show a code coverage summary of the most impacted files.
File main 4dcb89e codex/issue-7774-v2 9f48519 +/-
src/lib/actions...flight-phase.ts 99% 92% -7%
src/lib/platform.ts 89% 84% -5%
src/lib/onboard...erfile-patch.ts 93% 90% -3%
src/lib/actions...ild-pipeline.ts 100% 99% -1%
src/lib/state/registry.ts 93% 93% 0%
src/lib/onboard.ts 31% 31% 0%
src/lib/actions.../status-text.ts 41% 41% 0%
src/lib/domain/...ycle/options.ts 83% 86% +3%
src/lib/actions...tion-profile.ts 0% 75% +75%
src/lib/domain/...tion-profile.ts 0% 88% +88%

Updated July 30, 2026 07:23 UTC

Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Fixed
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Fixed
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@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.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/domain/lifecycle/options.ts (1)

150-168: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Typed-object path doesn't validate dcodeValidationProfile, unlike the sibling options — and it's the path the real CLI uses.

dcodeAutoApprovalMode and toolDisclosure are both re-validated in this branch even when passed as a typed object (lines 150-163), but dcodeValidationProfile is only guarded in the array/argv branch (lines 93-106). src/commands/sandbox/rebuild.ts always builds a typed RebuildSandboxOptions object, so the "requires an absolute JSON path or 'disabled'" guard tested in options.test.ts never actually protects the shipped sandbox rebuild command — an empty string (e.g. from --dcode-validation-profile=) silently falls through to "inherit existing profile" instead of raising the intended validation error.
[major]

🛠️ Proposed fix
   rawToolDisclosure = options.toolDisclosure;
   const toolDisclosure = normalizeToolDisclosure(rawToolDisclosure);
   if (rawToolDisclosure !== undefined && !toolDisclosure) {
     throw new Error(`toolDisclosure must be one of: ${TOOL_DISCLOSURE_VALUES.join(", ")}.`);
   }
+  if (options.dcodeValidationProfile !== undefined && !options.dcodeValidationProfile) {
+    throw new Error("dcodeValidationProfile requires an absolute JSON path or 'disabled'.");
+  }
   return {
     ...options,
     ...(dcodeAutoApprovalMode ? { dcodeAutoApprovalMode } : {}),
     ...(toolDisclosure ? { toolDisclosure } : {}),
   };
 }
Please also add a test to `options.test.ts` exercising `normalizeRebuildSandboxOptions({ dcodeValidationProfile: "" })` throwing, to close the coverage gap that let this slip.
🤖 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 `@src/lib/domain/lifecycle/options.ts` around lines 150 - 168, Update the
typed-object normalization path in normalizeRebuildSandboxOptions to validate
dcodeValidationProfile with the same absolute-JSON-path-or-"disabled" rules used
by the array/argv path, rejecting an empty string instead of treating it as
inheritance. Preserve valid values and add an options.test.ts case asserting
normalizeRebuildSandboxOptions({ dcodeValidationProfile: "" }) throws.
🧹 Nitpick comments (2)
test/langchain-deepagents-code-auto-approval-image.test.ts (1)

68-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider dropping the exact indented source snippet.

Matching if request.tool_call["name"] != "execute":\n return handler(request)... locks whitespace and statement layout, so any harmless reformat of the patch breaks the test without a behavior change. The interception behavior is already exercised in test/langchain-deepagents-code-validation-profile.test.ts; a narrower marker (e.g. the class name plus execute_managed_validation_command) keeps the image contract without the formatting coupling.

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-auto-approval-image.test.ts` around lines 68 -
71, Remove the exact indented source-snippet assertion from the patcher test. In
the test containing the _NemoClawValidationProfileMiddleware assertion, retain
the class marker and add a narrower stable marker such as
execute_managed_validation_command, relying on the existing validation-profile
test for interception behavior without coupling to formatting.

Source: Path instructions

src/lib/actions/sandbox/rebuild-pipeline.ts (1)

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

Import DCODE_VALIDATION_PROFILE_ENV instead of duplicating its value.

The literal "NEMOCLAW_DCODE_VALIDATION_PROFILE_B64" duplicates the constant DCODE_VALIDATION_PROFILE_ENV exported by src/lib/onboard/dcode/validation-profile.ts (already imported and used for this exact purpose in rebuild-preflight-phase.ts). If that constant's value is ever renamed, this scoped-env save/restore list would silently drift out of sync with no compile-time signal.

♻️ Proposed fix
+import { DCODE_VALIDATION_PROFILE_ENV } from "../../onboard/dcode/validation-profile";
+
 const scopedEnvKeys = [
   BRAVE_API_KEY_ENV,
   TAVILY_API_KEY_ENV,
   MESSAGING_SETUP_APPLIER_ENV_KEY,
   "OPENSHELL_GATEWAY",
   DOCKER_GPU_PATCH_NETWORK_ENV,
-  "NEMOCLAW_DCODE_VALIDATION_PROFILE_B64",
+  DCODE_VALIDATION_PROFILE_ENV,
   ...REBUILD_HERMES_DASHBOARD_ENV_KEYS,
   ...MESSAGING_CHANNEL_CONFIG_ENV_KEYS,
 ];
🤖 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 `@src/lib/actions/sandbox/rebuild-pipeline.ts` at line 67, Replace the
duplicated "NEMOCLAW_DCODE_VALIDATION_PROFILE_B64" literal in the scoped
environment save/restore list with the imported DCODE_VALIDATION_PROFILE_ENV
constant from validation-profile.ts, reusing the existing symbol rather than
adding another import or value.
🤖 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.

Inline comments:
In `@agents/langchain-deepagents-code/Dockerfile`:
- Around line 135-138: Update the DCode validation profile handling around
NEMOCLAW_DCODE_VALIDATION_PROFILE_B64 to fail closed when base64 decoding fails,
preserving the decoder’s nonzero status instead of allowing cleanup to make the
branch succeed. Strengthen Dockerfile-side base64 and decoded-size validation to
match patchDcodeValidationProfileDockerArg, and abort before later validation
whenever encoding or size checks fail.

In `@agents/langchain-deepagents-code/managed-dcode-runtime.py`:
- Around line 1668-1678: The invocation counter in the validation flow must not
be consumed before execution succeeds. Move the _VALIDATION_INVOCATIONS update
for the (profile["contentDigest"], command_id) key from before the
executable/working-directory checks to immediately after the child is
successfully spawned via Popen, while retaining the existing maxInvocations
check before execution.
- Around line 1795-1806: Update the post-selector process wait around
return_code and _terminate_validation_process so it uses the remaining profile
timeout derived from timeoutSeconds and the command’s start/deadline time,
rather than a fixed one-second wait. Only terminate and mark the command failed
after that remaining deadline is exceeded; otherwise preserve the child’s actual
exit status and existing terminal_status handling.
- Around line 1569-1576: Align the validation-profile digest test with the UTF-8
contract by changing its JSON serialization to use ensure_ascii=False and adding
a non-ASCII argv/path fixture. Update
test/langchain-deepagents-code-validation-profile.test.ts lines 73-75;
agents/langchain-deepagents-code/managed-dcode-runtime.py lines 1569-1576
requires no direct change because its digest logic already uses
ensure_ascii=False.

In `@agents/langchain-deepagents-code/patch-managed-deepagents-code.py`:
- Around line 691-701: The validation_profile_active branch must only enable and
auto-approve shell execution when the patched create_deep_agent middleware is
available. Update the condition to require _nemoclaw_original_create_deep_agent
is not None, preserving the existing fail-closed defaults when middleware
installation is unavailable.
- Around line 668-671: Update the subagent handling loop around
_NemoClawValidationProfileMiddleware to explicitly handle pre-built non-dict
subagent objects, ensuring validation middleware is injected or the shape is
rejected before forwarding to create_deep_agent. Preserve existing dict-subagent
behavior and prevent unsupported objects from bypassing the validation profile
and auto-approved shell path.

In `@src/lib/onboard.ts`:
- Around line 2262-2269: Update the profile resolution in the
onboarding/recreate flow around managedDcodeValidationProfile and the related
registration logic to fall back to the existing registry entry when the
environment request is unset. Preserve an explicit disabled value as a clear
operation, and route both onboarding and recreates through the same
authoritative lifecycle path so persisted managed DCode capabilities remain
registered.

In `@src/lib/onboard/dcode/validation-profile.test.ts`:
- Around line 132-143: Update the test containing mkdtempSync in
validation-profile.test.ts to remove the created temporary directory during
cleanup, using a suite or test teardown hook and the existing directory-removal
utility. Clean up filesystem resources only; do not add redundant mock,
environment, or global restoration.

In `@src/lib/state/registry.ts`:
- Line 35: Move the pure DcodeValidationProfile contract and clone/parse helper
from onboarding code into a neutral state or domain module, then update
src/lib/state/registry.ts lines 35 and 141 to import and use the neutral helper,
and update src/lib/state/registry/types.ts line 7 to import the contract there.
Ensure registry state and persistence no longer depend on onboarding-owned
modules.

In `@test/langchain-deepagents-code-auto-approval-image.test.ts`:
- Around line 63-64: Update the assertion around envBlock to capture the ENV
HOME= index, assert that the anchor exists before slicing, then verify the
sliced block does not contain NEMOCLAW_DCODE_VALIDATION_PROFILE_B64; preserve
the existing negative-content check while preventing a missing anchor from
passing vacuously.

In `@test/langchain-deepagents-code-validation-profile.test.ts`:
- Around line 30-34: Update the executable harness setup around the executables
mapping to resolve each command path through the runtime before profiling and
validation, rather than hardcoding /bin paths. Ensure the profiled paths match
executable.resolve(strict=True) on usrmerge and non-usrmerge hosts, while
preserving the existing echo, sleep, and yes command expectations.

---

Outside diff comments:
In `@src/lib/domain/lifecycle/options.ts`:
- Around line 150-168: Update the typed-object normalization path in
normalizeRebuildSandboxOptions to validate dcodeValidationProfile with the same
absolute-JSON-path-or-"disabled" rules used by the array/argv path, rejecting an
empty string instead of treating it as inheritance. Preserve valid values and
add an options.test.ts case asserting normalizeRebuildSandboxOptions({
dcodeValidationProfile: "" }) throws.

---

Nitpick comments:
In `@src/lib/actions/sandbox/rebuild-pipeline.ts`:
- Line 67: Replace the duplicated "NEMOCLAW_DCODE_VALIDATION_PROFILE_B64"
literal in the scoped environment save/restore list with the imported
DCODE_VALIDATION_PROFILE_ENV constant from validation-profile.ts, reusing the
existing symbol rather than adding another import or value.

In `@test/langchain-deepagents-code-auto-approval-image.test.ts`:
- Around line 68-71: Remove the exact indented source-snippet assertion from the
patcher test. In the test containing the _NemoClawValidationProfileMiddleware
assertion, retain the class marker and add a narrower stable marker such as
execute_managed_validation_command, relying on the existing validation-profile
test for interception behavior without coupling to formatting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 69c1fdc2-a845-46d0-b1ce-0b087de812db

📥 Commits

Reviewing files that changed from the base of the PR and between eeab81c and b9be5ef.

📒 Files selected for processing (28)
  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • package.json
  • schemas/dcode-validation-profile.schema.json
  • src/commands/sandbox/rebuild.ts
  • src/lib/actions/sandbox/rebuild-pipeline.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.ts
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts
  • src/lib/actions/sandbox/rebuild/validation-profile.test.ts
  • src/lib/actions/sandbox/rebuild/validation-profile.ts
  • src/lib/actions/sandbox/status-snapshot.ts
  • src/lib/actions/sandbox/status-text.ts
  • src/lib/actions/sandbox/status.test.ts
  • src/lib/domain/lifecycle/options.test.ts
  • src/lib/domain/lifecycle/options.ts
  • src/lib/onboard.ts
  • src/lib/onboard/dcode/validation-profile.test.ts
  • src/lib/onboard/dcode/validation-profile.ts
  • src/lib/onboard/dockerfile-patch.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.test.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.ts
  • src/lib/onboard/sandbox-registration.ts
  • src/lib/state/registry.ts
  • src/lib/state/registry/types.ts
  • test/langchain-deepagents-code-auto-approval-image.test.ts
  • test/langchain-deepagents-code-validation-profile.test.ts

Comment thread agents/langchain-deepagents-code/Dockerfile
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Outdated
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Outdated
Comment thread agents/langchain-deepagents-code/patch-managed-deepagents-code.py
Comment thread src/lib/onboard.ts Outdated
Comment thread src/lib/onboard/dcode/validation-profile.test.ts
Comment thread src/lib/state/registry.ts Outdated
Comment thread test/langchain-deepagents-code-auto-approval-image.test.ts Outdated
Comment thread test/langchain-deepagents-code-validation-profile.test.ts
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@github-actions

github-actions Bot commented Jul 29, 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 · 1 blocker · 5 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported 1 more blocker, 5 more warnings, the same number of suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-inference, cloud-onboard, security-posture, onboard-repair, onboard-resume, state-backup-restore, upgrade-stale-sandbox, ubuntu-repo-cloud-langchain-deepagents-code

Workflow run details

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

Signed-off-by: Julie Yaunches <jyaunches@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/langchain-deepagents-code-progressive-tool-disclosure.test.ts (1)

475-484: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Assert validation behavior instead of private middleware layout.

This reaches the private _NemoClawValidationProfileMiddleware type and requires a specific per-graph instance layout. A valid wiring refactor could break this while managed execute behavior remains correct. Exercise create_cli_agent through the execute boundary and assert the resulting validation receipt or rejection instead.

As per path instructions, tests should “prefer observable outcomes through the public boundary over … private-shape … 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-progressive-tool-disclosure.test.ts` around
lines 475 - 484, The validation_counts helper currently asserts private
middleware types and per-graph instance counts. Replace this layout inspection
with tests that invoke create_cli_agent through the public execute boundary,
asserting the expected validation receipt for valid input and rejection for
invalid input; retain only the observable backend behavior needed by the test.

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.

Inline comments:
In `@test/langchain-deepagents-code-progressive-tool-disclosure.test.ts`:
- Around line 516-542: Preserve the original
managed.managed_validation_profile_enabled function before replacing it with the
always-true lambda, then wrap both validation cases in an outer try/finally that
restores this function. Keep the existing _nemoclaw_original_create_deep_agent
restoration in the same cleanup scope, ensuring both stubs are restored even
when either assertion fails.

---

Nitpick comments:
In `@test/langchain-deepagents-code-progressive-tool-disclosure.test.ts`:
- Around line 475-484: The validation_counts helper currently asserts private
middleware types and per-graph instance counts. Replace this layout inspection
with tests that invoke create_cli_agent through the public execute boundary,
asserting the expected validation receipt for valid input and rejection for
invalid input; retain only the observable backend behavior needed by the test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a3f39aa6-0a05-4f72-8489-9b49aa474e3b

📥 Commits

Reviewing files that changed from the base of the PR and between e842a32 and c75c211.

📒 Files selected for processing (18)
  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts
  • src/lib/actions/sandbox/rebuild/validation-profile.test.ts
  • src/lib/actions/sandbox/rebuild/validation-profile.ts
  • src/lib/domain/dcode-validation-profile.ts
  • src/lib/domain/lifecycle/options.test.ts
  • src/lib/domain/lifecycle/options.ts
  • src/lib/onboard/dcode/validation-profile.test.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.ts
  • src/lib/onboard/sandbox-registration.test.ts
  • src/lib/onboard/sandbox-registration.ts
  • src/lib/state/registry.ts
  • src/lib/state/registry/types.ts
  • test/langchain-deepagents-code-auto-approval-image.test.ts
  • test/langchain-deepagents-code-progressive-tool-disclosure.test.ts
  • test/langchain-deepagents-code-validation-profile.test.ts
🚧 Files skipped from review as they are similar to previous changes (16)
  • src/lib/actions/sandbox/rebuild/validation-profile.test.ts
  • src/lib/state/registry.ts
  • src/lib/domain/lifecycle/options.test.ts
  • src/lib/actions/sandbox/rebuild/validation-profile.ts
  • src/lib/onboard/sandbox-registration.test.ts
  • src/lib/state/registry/types.ts
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • test/langchain-deepagents-code-validation-profile.test.ts
  • src/lib/domain/lifecycle/options.ts
  • src/lib/onboard/sandbox-registration.ts
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • src/lib/onboard/dcode/validation-profile.test.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.ts
  • test/langchain-deepagents-code-auto-approval-image.test.ts
  • agents/langchain-deepagents-code/Dockerfile
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts

Comment thread test/langchain-deepagents-code-progressive-tool-disclosure.test.ts
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Fixed
Signed-off-by: Julie Yaunches <jyaunches@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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
agents/langchain-deepagents-code/managed-dcode-runtime.py (1)

1642-1671: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Probe relies on inode ownership under the sticky claims directory — worth an explicit comment.

The unlink denial for sandbox_probe holds only because the hard link resolves to the root-owned anchor inode in a 0o1733 sticky directory; the sandbox user creating the link does not grant deletion rights. That subtlety is the whole security argument for write-once slots, so state it inline so a future refactor does not swap the anchor link for a fresh sandbox-owned file.

🤖 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 `@agents/langchain-deepagents-code/managed-dcode-runtime.py` around lines 1642
- 1671, In validate_managed_validation_invocation_budget_unprivileged, add an
inline comment at the os.link(anchor, sandbox_probe, ...) operation documenting
that the hard link preserves the root-owned anchor inode, so the sticky 0o1733
claims directory denies sandbox deletion. Clarify that replacing this anchor
link with a newly created sandbox-owned file would invalidate the write-once
security guarantee.
🤖 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.

Inline comments:
In `@agents/langchain-deepagents-code/managed-dcode-runtime.py`:
- Around line 2136-2143: Anchor the execution deadline to the command spawn time
rather than function entry: update the flow around
_verified_validation_source_identity and the child-process launch to capture a
spawn timestamp and calculate deadline from it. Retain the existing started
timestamp solely for durationMs reporting, and ensure the timeout receipt is
based on the newly anchored deadline.
- Around line 1867-1869: Update the raw_format and raw_oid decoding in
execute_managed_validation_command to use defensive, non-throwing ASCII decoding
so malformed bytes become values the existing status and identity checks can
reject. Preserve the bounded rejected/source_identity_mismatch receipt behavior
and avoid allowing UnicodeDecodeError to escape before those checks.

In `@test/langchain-deepagents-code-image.test.ts`:
- Around line 195-211: Replace the runtime source-text assertions in the test
with a behavioral test for initialize_managed_validation_invocation_budget and
validate_managed_validation_invocation_budget_unprivileged using a temporary
budget root. Assert that a second or rollback attempt to reuse an invocation
claim is rejected, preserving the write-once guarantee through the public
behavior rather than variable names or formatting; keep the Dockerfile wiring
assertions and relevant policy/path checks.

---

Nitpick comments:
In `@agents/langchain-deepagents-code/managed-dcode-runtime.py`:
- Around line 1642-1671: In
validate_managed_validation_invocation_budget_unprivileged, add an inline
comment at the os.link(anchor, sandbox_probe, ...) operation documenting that
the hard link preserves the root-owned anchor inode, so the sticky 0o1733 claims
directory denies sandbox deletion. Clarify that replacing this anchor link with
a newly created sandbox-owned file would invalidate the write-once security
guarantee.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b066480b-e795-4adc-a2e8-f32f5f95faa3

📥 Commits

Reviewing files that changed from the base of the PR and between c75c211 and d788058.

📒 Files selected for processing (12)
  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/policy-additions.yaml
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • schemas/dcode-validation-profile.schema.json
  • scripts/check-dcode-profile-import-gate.sh
  • test/langchain-deepagents-code-image.test.ts
  • test/langchain-deepagents-code-profile-build-gate.test.ts
  • test/langchain-deepagents-code-progressive-tool-disclosure.test.ts
  • test/langchain-deepagents-code-provider-label.test.ts
  • test/langchain-deepagents-code-validation-profile.test.ts
  • test/onboard-terminal-dashboard.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • schemas/dcode-validation-profile.schema.json
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • test/langchain-deepagents-code-validation-profile.test.ts
  • agents/langchain-deepagents-code/Dockerfile
  • test/langchain-deepagents-code-progressive-tool-disclosure.test.ts

Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Outdated
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Outdated
Comment thread test/langchain-deepagents-code-image.test.ts Outdated
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches
jyaunches requested a review from cv July 29, 2026 14:19
jyaunches and others added 2 commits July 29, 2026 10:33
@copy-pr-bot

copy-pr-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@cv cv added the v0.0.98 label Jul 29, 2026

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes at exact head 913becb.

Blocking findings:

  1. Product scope is not approved. #7774 still carries needs: design, and its only design proposal explicitly requests maintainer approval. It also differs materially from this implementation: runtime versus rebuild-only updates, and fixed environment values versus inherited values.
  2. taskIdentity is not enforced. The runtime validates and echoes it but never compares it with a trusted current task or run identity; only source identity is reverified.
  3. Status does not prove the effective profile. sandbox status --json returns registry state, and the new test expects the profile even when reconciliation reports the sandbox missing.
  4. The profile digest does not bind environment values. Execution reads allowlisted names from ambient os.environ, so identical profile digests can produce different behavior and unblocked build-control variables can influence descendants.
  5. The acceptance-level E2E is missing. No live test launches the built managed image and exercises dcode -n with an untrusted repository and escape-seeking prompt; the current harness calls the Python executor directly.

Security warning: timeout cleanup kills only the original process group. A descendant that calls setsid(), detaches stdio, and delays its work can outlive the receipt and mutation guard. Add command-scoped descendant cleanup and a regression test.

Please record the product decision, address these runtime contracts, add the trusted prompt-level E2E, update onto current main, and rerun exact-head security, documentation-writer, CI, and E2E gates.

@cjagwani

Copy link
Copy Markdown
Collaborator

Babysitting status for exact head 913becb (plain comment; no Changes Requested review from me): the existing product-scope and runtime-identity/status/digest findings remain current because no commit followed that review. The branch is also based on 6f3afab rather than current main da1b103, with maintainer edits disabled. I am tracking this PR and will re-review a refreshed, one-hour-quiet revision after the accepted scope and concrete findings are addressed.

@cjagwani

Copy link
Copy Markdown
Collaborator

Correction to my prior handoff: conflict-free base refreshes are explicitly waived. Please do not merge main solely for base currency; preserving exact-head evidence is preferred unless GitHub reports a real conflict or reviewed behavior requires a change. The substantive blocker or missing evidence described in the earlier handoff remains, but base age by itself is not a blocker. This is a plain coordination comment, not Changes Requested.

@cjagwani

Copy link
Copy Markdown
Collaborator

Babysitting review for exact head 9f485193f45793c02b5d71ad6a496aba6fb18688 (plain comment; I am not submitting Changes Requested): approval remains held on two concrete gates.

  1. Product-scope/design decision: [dcode] Add a bounded managed headless validation-command profile #7774 introduces a new supported command-execution surface. Its only design comment explicitly requests maintainer approval for six ownership, lifecycle, storage, update, and containment decisions and proposes runtime apply/show/clear management without rebuilding. There is still no approving maintainer response. This PR instead exposes rebuild-time --dcode-validation-profile with image projection. The version label and project status establish priority, but they do not resolve that explicit design request. Please obtain a maintainer decision accepting this concrete rebuild-time design (including ownership, update lifecycle, rollback/replacement authority, and descendant-process containment), or align the implementation with an approved design.

  2. Acceptance evidence: the exact head has green visible CI but no E2E / PR Gate/trusted coordination receipt, and there is no test/e2e scenario exercising the supported lifecycle end to end: install the profile through the public input, prove it through public JSON status, run one exact argv command, and reject untrusted-repository/prompt escape attempts. [dcode] Add a bounded managed headless validation-command profile #7774 explicitly requires those escape tests. Please add/select exact-head protected E2E coverage for that public flow, or record a narrowly scoped maintainer waiver if the protected infrastructure cannot exercise it.

I verified that status --json is documented and can satisfy the issue’s “equivalent supported command” wording, and the quickstart now states the Git-worktree/source-identity requirement. I am not holding either of those advisor concerns. No base refresh is requested.

@cjagwani

Copy link
Copy Markdown
Collaborator

Exact-head babysitting update for ad67e7dc1e625465f37cb9bf77ee515d36062fab (normal comment; no Changes Requested review): the blockers from review 4812325247 remain unresolved. No contributor-authored fix followed that review; the only later commits are automated merges from main.

  • Product scope remains unapproved. Issue [dcode] Add a bounded managed headless validation-command profile #7774 has no maintainer acceptance; its only design comment explicitly requests approval and differs materially from this PR (runtime profile updates versus rebuild-only installation, and fixed environment values versus inherited ambient values).
  • taskIdentity is still echoed/validated but not compared with a trusted current task/run identity.
  • sandbox status --json still reports registry state rather than proving the effective runtime profile.
  • The profile digest still does not bind inherited environment values.
  • The acceptance-level built-image, prompt-driven escape E2E is still absent.
  • Timeout cleanup still does not prove command-scoped cleanup of detached descendants.

The latest automated conflict resolution also dropped main’s unset OTEL_EXPORTER_OTLP_TRACES_ENDPOINT before the build-time DCode probe from #7950. git show --remerge-diff ad67e7dc1 shows the resolution retained the validation-profile setup but discarded that main-side line, reintroducing the BuildKit telemetry probe failure that #7950 fixed. Preserve both sides of that conflict and its focused image assertion.

I am not approving ordinary or privileged workflows while the product decision and correctness/security blockers remain. I will keep monitoring this PR and will re-review a future head only after it has been quiet for one hour.

@jyaunches
jyaunches marked this pull request as draft July 31, 2026 01:32
@jyaunches

Copy link
Copy Markdown
Contributor Author

Heads-up for overlap coordination: #8018 tracks a managed MCP snapshot failure in the same DCode runtime and policy files changed by this draft. The current patch does not modify _managed_mcp_snapshot, so it does not fix that issue. Any follow-up must preserve the anonymous, read-only, integrity-bound snapshot contract and the intentional OpenShell memfd_create restriction; expect rebase/conflict coordination if both changes proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Documentation, examples, guides, or docs build area: security Security controls, permissions, secrets, or hardening security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dcode] Add a bounded managed headless validation-command profile

5 participants