Skip to content

fix(dcode): close inherited route-probe descriptor - #7032

Merged
apurvvkumaria merged 6 commits into
mainfrom
codex/fix-7031-dcode-probe-fd
Jul 16, 2026
Merged

fix(dcode): close inherited route-probe descriptor#7032
apurvvkumaria merged 6 commits into
mainfrom
codex/fix-7031-dcode-probe-fd

Conversation

@apurvvkumaria

@apurvvkumaria apurvvkumaria commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Close the legacy auxiliary descriptor before the image-owned DCode managed-exec boundary launches a diagnostic command. Route-probe evidence now remains confined to the existing stdout/stderr contract, with an installed-helper regression against inherited descriptor output.

Related Issue

Closes #7031

Changes

  • Close descriptor 3 immediately before dcode-managed-exec exact-execs its command.
  • Mirror the Dockerfile's separate regular-file installation in the test fixture and invoke that installed usr/local/lib/nemoclaw/dcode-managed-exec artifact.
  • Prove the installed helper rejects inherited descriptor output; the existing connect-flow regression proves untrusted probe evidence exits before session attach.
  • Preserve the existing proxy normalization, resource-limit verification, observability state, and exact command execution behavior.

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: this is defense-in-depth inside the already documented image-owned fail-closed probe boundary; no command, flag, output, default, or recovery behavior changes.
  • 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: narrow review confirmed the descriptor is closed only in managed-exec mode; stdout/stderr, proxy, resource-limit, and observability contracts remain unchanged.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

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 — npx vitest run --project integration test/dcode-managed-exec.test.ts (6 passed)
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Apurv Kumaria akumaria@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved managed command execution by ensuring legacy FD 3 is closed before running managed commands.
    • Prevented probe-related evidence from being reused or routed outside standard output/error.
    • Hardened connect --probe-only to fail closed when presented with untrusted evidence.
  • Tests

    • Refreshed managed-exec fixtures and updated tests to run the managed-exec binary directly.
    • Added and expanded unit/e2e coverage for FD 3 closure, marker behavior, untrusted-evidence rejection, and verifying session attach does not occur.

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@apurvvkumaria apurvvkumaria added Recommended Blocker Recommended release blocker for maintainer review bug-fix PR fixes a bug or regression v0.0.85 labels Jul 16, 2026
@apurvvkumaria apurvvkumaria self-assigned this Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f8d98c49-c7a4-4e85-abcc-f7f27f2f6c3e

📥 Commits

Reviewing files that changed from the base of the PR and between 2ba2b9e and ead40e5.

📒 Files selected for processing (1)
  • test/langchain-deepagents-code-image.test.ts
💤 Files with no reviewable changes (1)
  • test/langchain-deepagents-code-image.test.ts

📝 Walkthrough

Walkthrough

The managed-exec launcher now closes file descriptor 3 before running commands. Unit and end-to-end tests verify direct managed execution, descriptor closure, and fail-closed rejection of untrusted route evidence before session attachment.

Changes

DCode execution and route validation

Layer / File(s) Summary
Target the managed-exec fixture
test/dcode-managed-exec.test.ts
The fixture installs the rewritten launcher at managedExecPath, and existing tests invoke that path directly.
Close FD3 before managed execution
agents/langchain-deepagents-code/dcode-launcher.sh, test/dcode-managed-exec.test.ts
The launcher closes FD3 before executing the managed command, while regression coverage verifies closure, expected markers, empty auxiliary output, and wrapper suppression.
Reject untrusted connect evidence
test/e2e/e2e-cloud-experimental/checks/07-deepagents-code-headless-inference.sh, test/langchain-deepagents-code-image.test.ts
The e2e contract injects untrusted route-probe output and verifies nonzero connect status, no session attachment, expected failure markers, and scanning of both connect outputs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#7036: Modifies the same headless-inference and image-contract checks around the nemoclaw connect --probe-only path.

Suggested labels: area: e2e, area: sandbox, area: security

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: closing the inherited route-probe descriptor in dcode.
Linked Issues check ✅ Passed The changes implement the fail-closed regression by closing FD3, exercising the managed helper, and preventing session attach on untrusted probe output.
Out of Scope Changes check ✅ Passed All file changes support the managed-exec/probe fail-closed regression and no unrelated code paths were added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 codex/fix-7031-dcode-probe-fd

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

@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

🤖 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/dcode-managed-exec.test.ts`:
- Around line 164-181: Update the regression test around makeLauncherFixture and
launcherPath so it invokes the installed
/usr/local/lib/nemoclaw/dcode-managed-exec artifact directly, or add an
installation step that produces that exact artifact before execution. Ensure the
FD 3 closure assertion runs against the installed managed helper rather than
only a temporary copy generated from LAUNCHER_PATH.
🪄 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: 126e95cb-8c7d-4a9d-b64e-b37e16a6e5ed

📥 Commits

Reviewing files that changed from the base of the PR and between d034b7f and bf7f144.

📒 Files selected for processing (2)
  • agents/langchain-deepagents-code/dcode-launcher.sh
  • test/dcode-managed-exec.test.ts

Comment thread test/dcode-managed-exec.test.ts
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

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

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-onboard, credential-sanitization, security-posture, inference-routing, network-policy

1 optional E2E recommendation
  • sandbox-rlimits-connect

Workflow run details

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

@github-code-quality

github-code-quality Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/fix-7031-dcode... branch remains at 80%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 41a5885 codex/fix-7031-dcode... ead40e5 +/-
src/lib/onboard...box-prebuild.ts 88% 69% -19%
src/lib/messagi...flow-planner.ts 93% 93% 0%
src/lib/onboard...tch-recreate.ts 94% 95% +1%
src/lib/inference/local.ts 80% 82% +2%
src/lib/actions...eway-restart.ts 90% 93% +3%
src/lib/onboard...u-patch-mode.ts 90% 93% +3%
src/lib/onboard...host-anchors.ts 90% 94% +4%
src/lib/state/m...-acquisition.ts 84% 89% +5%
src/lib/inferen...er-lifecycle.ts 65% 71% +6%
src/lib/inferen...lama/process.ts 50% 100% +50%

Updated July 16, 2026 21:12 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

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

Blocking exact head 11382f8 on the remaining #7031 acceptance gap. The exec 3>&- fix is correct and the focused managed-exec/probe/image suites pass, but #7031 explicitly requires one image-backed regression that executes the installed managed helper through the route probe and then proves bare connect exits nonzero without attaching when route evidence is untrusted. The current tests cover the temp-copy helper and mocked connect flow separately, so they do not protect that shipped composition. This matches exact-head Advisor PRA-1. Please add that installed-image boundary test, refresh onto current main, rerun exact-diff CI/E2E, and request rereview.

Signed-off-by: Apurv Kumaria <akumaria@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)

805-812: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Avoid locking the image test to E2E script source text.

These literals can all be present while fail-closed behavior remains broken, and harmless shell refactors will cause failures. Keep only an artifact-presence check here and rely on the Vitest E2E result to prove nonzero connect status, probe execution, and no session attachment.

As per path instructions, 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 805 - 812, Remove
the assertions in the image-backed connect test that inspect E2E script source
literals such as probe, session-attach, and shell-command text. Retain only the
artifact-presence check, and use the Vitest E2E result through the public
connect boundary to verify nonzero status, probe execution, and absence of
session attachment.

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 805-812: Remove the assertions in the image-backed connect test
that inspect E2E script source literals such as probe, session-attach, and
shell-command text. Retain only the artifact-presence check, and use the Vitest
E2E result through the public connect boundary to verify nonzero status, probe
execution, and absence of session attachment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b54c3db4-0541-4c13-86ff-6378413d64a6

📥 Commits

Reviewing files that changed from the base of the PR and between 11382f8 and 2ba2b9e.

📒 Files selected for processing (2)
  • test/e2e/e2e-cloud-experimental/checks/07-deepagents-code-headless-inference.sh
  • test/langchain-deepagents-code-image.test.ts

Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All selected tests passed

Run: 29534487768
Workflow ref: codex/fix-7031-dcode-probe-fd
Requested targets: ubuntu-repo-cloud-langchain-deepagents-code
Requested test IDs: (default — all default-enabled tests; explicit-only tests openshell-gateway-auth-contract, mcp-bridge-dev, hermes-gpu-startup, sandbox-rlimits-connect, and jetson-nvmap-gpu are skipped unless selected)
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped, 0 unknown

Test Result Total wall clock time
live ✅ success 8m 54s

@apurvvkumaria
apurvvkumaria requested a review from cv July 16, 2026 21:27
@apurvvkumaria

Copy link
Copy Markdown
Collaborator Author

Rereview requested on exact head ead40e5e7b4cbfbb8dcf4e48622557f3aede0681. The branch is refreshed onto current main, the installed-image boundary cleanup is present, direct DCode cloud target run 29534487768 passed, trusted PR Gate Controller run 29535299151 passed, all 46 ordinary checks pass with no failures or pending checks, and there are no unresolved review threads.

@apurvvkumaria
apurvvkumaria merged commit 3558a7a into main Jul 16, 2026
148 of 150 checks passed
@apurvvkumaria
apurvvkumaria deleted the codex/fix-7031-dcode-probe-fd branch July 16, 2026 21:39
apurvvkumaria added a commit that referenced this pull request Jul 17, 2026
<!-- markdownlint-disable MD041 -->
## Summary

PR E2E risk plans now select the exact Deep Agents Code typed target
when its headless-inference check changes, so #7032 can receive its
required live regression instead of only the control-plane floor jobs.
The controller dispatches jobs and that target in one bound run while
preserving exact-SHA authorization, fork, stale-revision, and
secret-scope boundaries.

## Changes

- Extend deterministic risk plan v4 with `requiredTargets` for the
current Deep Agents Code check-to-target requirement. The PR gate
consumes this field because a free-standing workflow job cannot address
the registry target; `pr-risk-plan.test.ts` and
`pr-e2e-gate-typed-target.test.ts` protect the mapping and evidence
contract.
- Permit one workflow run to combine selected jobs with the exact
allowlisted `ubuntu-repo-cloud-langchain-deepagents-code` target. The
trusted workflow independently rejects unapproved controller target
input and requires the generated matrix IDs to exactly match that
selection before exposing any matrix output or starting
credential-bearing work.
- Bind typed-target evidence to `matrix.id`, upload its `default`-shard
signal, and fail closed for missing, duplicate, skipped, malformed,
stale, or unauthorized evidence.
- Carry targets through E2E recommendations and PR review context, and
update the maintainer runbook and merge-gate guidance for combined
selections.

## 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: This changes internal
maintainer CI selection and evidence. Maintainer runbooks were updated;
the documentation review found no supported product behavior, Fern page,
or changelog change.
- [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: The exact target is
independently allowlisted in the trusted controller workflow and gate
code, and the workflow requires exact equality between the trusted
controller selection and the PR-generated matrix before any
credential-bearing job. PR-modified execution remains behind
exact-head/base `run-control-plane` authorization, forks and stale
revisions do not dispatch, and the NVIDIA inference secret remains
scoped to the existing live-test step.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — focused controller integration: 161
passed; workflow/E2E support: 81 passed; advisor consumers: 123 passed;
final split target-gate regression: 29 passed; `npm run test:changed`:
208 passed; `npm run build:cli && npm run typecheck:cli`: passed. After
binding the generated matrix to the controller selection: focused
controller integration: 142 passed; workflow/E2E support: 113 passed;
`npm run typecheck:cli`: passed. CodeRabbit PATH follow-up:
workflow-boundary test 31 passed.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: Focused control-plane
contracts and the changed-test lane were used for this narrow
prerequisite.
- [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)

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


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

* **New Features**
* Added typed E2E target selection alongside jobs, supporting combined
job+target plans and unified PR E2E gate dispatch/state handling.
* Risk planning now tracks and recommends required targets (including
Deep Agents headless typed checks).
* **Bug Fixes**
* Strengthened gate authorization and “fail-closed” behavior for both
jobs and typed targets.
* Improved controller-vs-matrix correlation, including stricter
selector/matrix consistency checks.
* **Documentation**
* Updated the PR E2E gate workflow contract to reflect typed targets and
“no run” semantics.
* **Tests**
* Expanded E2E/PR-gate coverage for typed targets, trusted controller
matrix validation, and risk-signal/artifact contracts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Co-authored-by: Charan Jagwani <cjagwani@nvidia.com>
Co-authored-by: Apurv Kumaria <akumaria@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression Recommended Blocker Recommended release blocker for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DCode] connect must fail closed when inference-route evidence is untrusted

3 participants