Skip to content

feat(dcode): add thread-scoped auto-approval - #6486

Merged
jyaunches merged 15 commits into
mainfrom
codex/6478-dcode-thread-autorun
Jul 8, 2026
Merged

feat(dcode): add thread-scoped auto-approval#6486
jyaunches merged 15 commits into
mainfrom
codex/6478-dcode-thread-autorun

Conversation

@jyaunches

@jyaunches jyaunches commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds an explicit, default-disabled thread-opt-in auto-approval capability for managed LangChain Deep Agents Code sandboxes. Operators inspect it through status and change it transactionally for a named sandbox through rebuild, while each DCode thread must still opt in and NemoClaw's existing sandbox security boundaries remain enforced.

Related Issue

Partially addresses #6478. This PR intentionally does not close the issue because Brev launchable embedded-terminal validation remains outstanding; see Verification for the explicit acceptance gap.

Changes

  • Add the named rebuild --dcode-auto-approval <disabled|thread-opt-in> control, durable registry state, status output, prepared-image verification, and fail-closed validation.
  • Bake a root-owned capability file into managed DCode images, reject ambient or malformed overrides, gate -y/--auto-approve, and reset active approval across thread and agent transitions.
  • Add focused CLI and runtime coverage, a live cloud E2E check for enable, per-thread reset, policy boundaries, and disable rollback, plus user/security/reference documentation.

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: independent read-only adversarial review covered runtime fail-closed behavior, rebuild preflight, prepared-image handoff, mutation ordering, and scope reduction; all concrete findings were addressed with regression tests.
  • 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
  • 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 — 285 focused DCode CLI/integration tests, 14 E2E-support tests, and npm run check:diff passed
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — npm test: 1,280 files and 14,344 tests passed; seven unrelated permission-mode failures passed when rerun under the expected umask 0022; one unchanged gateway process-identity test remains locally failing
  • 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 0 errors and 2 pre-existing Fern warnings
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

The issue's Brev launchable embedded-terminal acceptance run remains outstanding; the PR includes the reusable live DCode check but does not claim that external manual evidence.


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

Summary by CodeRabbit

  • New Features

    • Added optional thread-scoped auto-approval for managed Deep Agents Code sandboxes via --dcode-auto-approval <disabled|thread-opt-in>.
    • Status output now reports the configured DCode auto-approval capability/mode (including in --json).
  • Bug Fixes

    • Auto-approval is fail-closed: invalid/unsupported settings are denied.
    • Auto-approval activation is reset on new processes/threads, /clear//force-clear, thread switches/resumes, and agent switches.
    • Ambient NEMOCLAW_DCODE_AUTO_APPROVAL* values are ignored at runtime.
  • Documentation

    • Updated quickstart, security guidance, and command/reference docs with the new thread auto-approval workflow and reset behavior.

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 integration: dcode LangChain Deep Code integration behavior labels Jul 8, 2026
@jyaunches jyaunches self-assigned this Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

This PR adds a managed, fail-closed thread-scoped auto-approval capability for LangChain Deep Agents Code sandboxes. It threads the mode through image build, runtime gating, rebuild/onboard plumbing, registry/status state, documentation, and tests.

Changes

Deep Agents Code thread auto-approval capability

Layer / File(s) Summary
Sandbox image build and runtime enforcement
agents/langchain-deepagents-code/Dockerfile, dcode-launcher.sh, start.sh, dcode-wrapper.sh, managed-dcode-runtime.py, patch-managed-deepagents-code.py
Adds the managed build arg and capability file, strips ambient env overrides, resolves the managed mode in shell and Python, and gates patched CLI/TUI auto-approval behavior on that state.
Auto-approval feature module and rebuild flag
src/lib/onboard/dcode-auto-approval.ts, dockerfile-patch.ts, src/commands/sandbox/rebuild.ts, src/lib/domain/lifecycle/options.ts, related tests
Defines the shared modes/helpers, patches Dockerfile ARG values, and exposes --dcode-auto-approval with parsing and validation.
Rebuild preflight and mutation-edge validation
src/lib/actions/sandbox/rebuild-*.ts, tests
Threads requested and durable auto-approval mode through rebuild durable config, preflight/orchestration, image prep, retry command generation, and mutation-edge validation.
Onboard state machine and runtime wiring
src/lib/onboard.ts, src/lib/onboard/machine/handlers/*, runtime-control-flow.ts, sandbox-registration.ts, prepared-dcode-rebuild.ts, types.ts
Carries requested/recorded modes through onboarding, reuse/recreate decisions, Dockerfile patching, sandbox creation, and registry capture.
Registry persistence and status reporting
src/lib/state/registry.ts, status-snapshot.ts, status-text.ts, status.ts
Persists dcodeAutoApprovalMode in sandbox registry entries and surfaces it in status JSON/text output.
Documentation updates
docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx, docs/inference/model-capability-audit.mdx, docs/reference/commands.mdx, docs/security/best-practices.mdx
Documents the capability, activation/reset behavior, command-line surface, and audit/security guidance.
E2E checks, fixtures, and integration tests
test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh, test/e2e/live/*, test/helpers/*, test/langchain-deepagents-code-*.test.ts
Adds the new cloud-experimental check and extends fixture, entrypoint, image-contract, and onboarding tests around the new capability.

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

Possibly related issues

Suggested labels: area: onboarding, area: architecture

Suggested reviewers: cv

🚥 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: adding thread-scoped auto-approval for DCode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/6478-dcode-thread-autorun

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

@github-code-quality

github-code-quality Bot commented Jul 8, 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/6478-dcode-thr... branch remains at 76%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 7dc1f2f codex/6478-dcode-thr... db891e0 +/-
src/lib/actions...ge-preflight.ts 89% 74% -15%
src/lib/domain/...ycle/options.ts 97% 87% -10%
src/lib/actions.../status-text.ts 48% 43% -5%
src/lib/agent/onboard.ts 71% 70% -1%
src/lib/onboard.ts 28% 28% 0%
src/lib/sandbox/config.ts 60% 61% +1%
src/lib/actions...de-preflight.ts 48% 51% +3%
src/lib/agent/b...availability.ts 63% 74% +11%
src/lib/sandbox...rsion-scheme.ts 73% 100% +27%
src/lib/onboard...uto-approval.ts 0% 81% +81%

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Fixed
Comment thread agents/langchain-deepagents-code/managed-dcode-runtime.py Fixed
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: onboard-resume, onboard-repair, cloud-onboard, ubuntu-repo-cloud-langchain-deepagents-code, sandbox-rebuild
Optional E2E: mcp-bridge, network-policy

Dispatch hint: targets=ubuntu-repo-cloud-langchain-deepagents-code jobs=onboard-resume,onboard-repair,cloud-onboard,sandbox-rebuild

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • onboard-resume (high): Required by the onboarding resume rule because live onboarding machine resume handlers, DCode resume orchestration, session/state transitions, and registry state are changed. This must prove interrupted onboarding resumes with real gateway/session state rather than relying only on unit tests.
  • onboard-repair (high): Required by the onboarding resume rule because the same onboarding state-machine and sandbox resume changes can affect repair/recovery paths. The live repair E2E exercises real repair state, gateway interactions, and sandbox recovery boundaries.
  • cloud-onboard (high): The PR changes onboarding state transitions, hosted install/onboard-visible DCode setup, security defaults, and docs for public operator flows. Hosted cloud onboarding must validate that the public install and full onboarding path still creates a healthy sandbox with security checks.
  • ubuntu-repo-cloud-langchain-deepagents-code (high): The primary runtime changes are in the managed LangChain Deep Agents Code image, launcher, patched Python entrypoints, auto-approval posture, inference route, network/credential boundaries, and DCode user flow. This typed target runs the real DCode cloud lifecycle and cloud-experimental checks, including the new thread-auto-approval check plus headless inference, TUI startup, secret boundary, Python egress, Tavily, observability, and fresh re-onboard coverage.
  • sandbox-rebuild (high): The PR changes the sandbox rebuild command and shared/DCode rebuild pipeline, preflight, target config, MCP phase, durable config, recreate phase, lifecycle options, and status output. A live rebuild E2E is required to protect destructive lifecycle behavior, state preservation, registry refresh, and backup hygiene.

Optional E2E

  • mcp-bridge (high): Useful adjacent confidence because rebuild-mcp-phase and the managed DCode runtime MCP posture changed. The required DCode target covers DCode policy checks, but the broader MCP bridge lifecycle would catch regressions in managed MCP registry/projection behavior across sandboxes.
  • network-policy (high): Optional extra coverage for shared OpenShell policy enforcement. The required DCode target reruns DCode egress and credential boundaries, but the generic network-policy job can provide additional confidence if reviewers are concerned about the new auto-approval capability interacting with policy boundaries.

New E2E recommendations

  • langchain-deepagents-code-auto-approval-reset-boundaries (high): The new live thread-auto-approval check covers default denial, rebuild enable/disable, TUI approval-menu activation, /clear reset, network policy, and credential boundaries. The changed Python patch also resets on thread resume/switch and agent switching, and the docs mention dcode -y, /force-clear, new process, thread switching, and agent switching. Add or extend live coverage to explicitly prove dcode -y activation and reset on /force-clear, thread resume/switch, agent swap, and fresh process boundaries.
    • Suggested test: Extend test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh, or add a companion DCode cloud-experimental check, to exercise dcode -y and all documented reset boundaries with fixed non-secret PTY markers.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: targets=ubuntu-repo-cloud-langchain-deepagents-code jobs=onboard-resume,onboard-repair,cloud-onboard,sandbox-rebuild

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: onboard-repair, onboard-resume, ubuntu-repo-cloud-langchain-deepagents-code
Optional E2E targets: None

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-repair
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-resume
  • gh workflow run e2e.yaml --ref <pr-head-ref> --field targets=ubuntu-repo-cloud-langchain-deepagents-code

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E targets

  • onboard-repair: Focused free-standing E2E job wired for changed live test test/e2e/live/onboard-repair.test.ts.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-repair
  • onboard-resume: Changes touch src/lib/onboard/machine resume orchestration and state handling, so the onboarding resume rule requires the wired onboard-resume live job.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=onboard-resume
  • ubuntu-repo-cloud-langchain-deepagents-code: Deep Agents Code image/runtime, dcode rebuild/status/onboard code, and the cloud-experimental Deep Agents auto-approval live checks changed; this is the smallest live-supported typed target covering that surface.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field targets=ubuntu-repo-cloud-langchain-deepagents-code

Optional E2E targets

  • None.

Relevant changed files

  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/dcode-launcher.sh
  • agents/langchain-deepagents-code/dcode-wrapper.sh
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • agents/langchain-deepagents-code/start.sh
  • src/commands/sandbox/rebuild.ts
  • src/lib/actions/sandbox/rebuild-dcode-orchestrator.ts
  • src/lib/actions/sandbox/rebuild-dcode-preflight.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/rebuild-managed-image-preflight.ts
  • src/lib/actions/sandbox/rebuild-mcp-phase.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-preflight-target-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/actions/sandbox/rebuild-target-config.ts
  • src/lib/actions/sandbox/status-snapshot.ts
  • src/lib/actions/sandbox/status-text.ts
  • src/lib/actions/sandbox/status.ts
  • src/lib/domain/lifecycle/options.ts
  • src/lib/onboard.ts
  • src/lib/onboard/dcode-auto-approval.ts
  • src/lib/onboard/dockerfile-patch.ts
  • src/lib/onboard/machine/core-flow-phases.ts
  • src/lib/onboard/machine/handlers/sandbox-dcode-resume.ts
  • src/lib/onboard/machine/handlers/sandbox-resume.ts
  • src/lib/onboard/machine/handlers/sandbox.ts
  • src/lib/onboard/prepared-dcode-rebuild.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.ts
  • src/lib/onboard/sandbox-registration.ts
  • src/lib/onboard/types.ts
  • src/lib/state/registry.ts
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • test/e2e/live/cloud-experimental-check-list.ts
  • test/e2e/live/cloud-experimental-checks.ts
  • test/e2e/live/deepagents-observability-contract.ts
  • test/e2e/live/onboard-repair.test.ts
  • test/e2e/support/deepagents-observability-contract.test.ts
  • test/e2e/support/platform-parity-cloud-experimental.test.ts

Comment thread test/e2e/support/platform-parity-cloud-experimental.test.ts Fixed
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Changes requested

Merge posture: Do not merge yet
Primary next action: Fix PRA-4: verifyPreparedDcodeRebuildImage() does not validate built image's auto-approval capability file; then add or justify PRA-T1.
Open items: 3 required · 14 warnings · 3 suggestions · 8 test follow-ups
Since last review: 0 prior items resolved · 12 still apply · 4 new items found

Action checklist

  • PRA-4 Fix: verifyPreparedDcodeRebuildImage() does not validate built image's auto-approval capability file in src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • PRA-5 Fix: Bash capability validation has TOCTOU window between stat check and content read in agents/langchain-deepagents-code/dcode-wrapper.sh:63
  • PRA-6 Fix: managed_auto_approval_mode() missing required source-of-truth comment block and structured logging in agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • PRA-1 Resolve or justify: Source-of-truth review needed: managed_auto_approval_mode() in managed-dcode-runtime.py:823
  • PRA-2 Resolve or justify: Source-of-truth review needed: read_managed_auto_approval_mode() in dcode-wrapper.sh:55
  • PRA-3 Resolve or justify: Source-of-truth review needed: verifyPreparedDcodeRebuildImage() in rebuild-managed-image-preflight.ts:84
  • PRA-7 Resolve or justify: Source-of-truth review needed: managed_auto_approval_mode() in agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • PRA-8 Resolve or justify: Source-of-truth review needed: read_managed_auto_approval_mode() in agents/langchain-deepagents-code/dcode-wrapper.sh:55
  • PRA-9 Resolve or justify: Source-of-truth review needed: verifyPreparedDcodeRebuildImage() in src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • PRA-10 Resolve or justify: patchDcodeAutoApprovalDockerArg regex strips trailing comments on ARG line in src/lib/onboard/dockerfile-patch.ts:64
  • PRA-11 Resolve or justify: E2E test only covers /clear thread reset path in test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh:1
  • PRA-12 Resolve or justify: Missing assertions for TUI status bar indicator and stderr warning on auto-approval activation in test/langchain-deepagents-code-direct-module-patch.test.ts:1128
  • PRA-13 Resolve or justify: Missing session-bootstrap test scenarios for dcode-auto-approval in src/lib/onboard/dcode-auto-approval.test.ts:1
  • 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: Runtime validation
  • PRA-T5 Add or justify test follow-up: Runtime validation
  • PRA-T6 Add or justify test follow-up: E2E test only covers /clear thread reset path
  • PRA-T7 Add or justify test follow-up: Missing assertions for TUI status bar indicator and stderr warning on auto-approval activation
  • PRA-T8 Add or justify test follow-up: Missing session-bootstrap test scenarios for dcode-auto-approval
  • PRA-18 In-scope improvement: CLI examples missing --dcode-auto-approval disabled demonstration in src/commands/sandbox/rebuild.ts:24
  • PRA-19 In-scope improvement: Rebuild command documentation missing --dcode-auto-approval examples in docs/reference/commands.mdx:2240
  • PRA-20 In-scope improvement: SandboxStateFlow coordinates 8+ feature domains — tracked architecture debt in src/lib/onboard/machine/handlers/sandbox.ts:1

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 Resolve/justify architecture Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-3 Resolve/justify architecture Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-4 Required correctness src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84 Enhance verifyPreparedDcodeRebuildImage() to run docker run --rm <image> cat /usr/local/share/nemoclaw/dcode-auto-approval (or use layer extraction via docker image save + tar inspection) and verify the content matches prepared.dcodeAutoApprovalMode exactly. The PreparedDcodeRebuildImage type already includes dcodeAutoApprovalMode.
PRA-5 Required security agents/langchain-deepagents-code/dcode-wrapper.sh:63 Align Bash validation with Python approach: open the file with O_NOFOLLOW and validate metadata via fstat on the open descriptor, then read content via the same descriptor. In Bash 4.1+, use exec {fd}<file for descriptor-based validation. Alternatively, document why container image immutability makes this risk theoretical.
PRA-6 Required architecture agents/langchain-deepagents-code/managed-dcode-runtime.py:823 Add a detailed code comment block at managed_auto_approval_mode() with all five source-of-truth elements. Modify _disabled_auto_approval() to emit structured key-value stderr logs (e.g., 'reason=capability path is a symlink', 'reason=capability metadata is unsafe', 'reason=capability file was truncated', 'reason=capability file changed while reading', 'reason=capability file read failed', 'reason=capability contents are invalid') for each distinct failure path. Add a non-debug WARNING-level audit log using Python logging module for production visibility of capability validation failures.
PRA-7 Resolve/justify architecture agents/langchain-deepagents-code/managed-dcode-runtime.py:823 Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source (image immutability) to make the runtime validation unnecessary.
PRA-8 Resolve/justify architecture agents/langchain-deepagents-code/dcode-wrapper.sh:55 Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source to make runtime validation unnecessary.
PRA-9 Resolve/justify architecture src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84 Either fix the function to validate the built image (see PRA-4) which would eliminate the need for this workaround, or provide the five-element justification.
PRA-10 Resolve/justify correctness src/lib/onboard/dockerfile-patch.ts:64 Relax the regex to capture and preserve trailing comments: ^ARG NEMOCLAW_DCODE_AUTO_APPROVAL=([^\r\n#]*)(?:\s*#(.*))?$ and replace with ARG NEMOCLAW_DCODE_AUTO_APPROVAL=${mode}${comment ? ' #' + comment : ''}. Update the test to expect comment preservation.
PRA-11 Resolve/justify tests test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh:1 Extend the E2E check to cover at least one additional reset path (e.g., thread switch via dcode TUI thread selector, or agent swap via model switch). Alternatively, add explicit unit test assertions in direct-module-patch.test.ts that _nemoclaw_reset_thread_auto_approval is called from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with assertions on session_state.auto_approve and approval_mode_key clearing.
PRA-12 Resolve/justify tests test/langchain-deepagents-code-direct-module-patch.test.ts:1128 Add test assertions: (1) after _on_auto_approve_enabled() or action_toggle_auto_approve() enables auto-approval, assert instance._status_bar.set_auto_approve was called with enabled=true; (2) assert the warning message appears in instance.notifications AND consider capturing stderr in the test harness to verify the stderr warning path.
PRA-13 Resolve/justify tests src/lib/onboard/dcode-auto-approval.test.ts:1 Expand dcode-auto-approval.test.ts to cover the three session-bootstrap scenarios using the existing prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions with mocked registry entries.
PRA-14 Resolve/justify correctness agents/langchain-deepagents-code/managed-dcode-runtime.py:810 Enhance _disabled_auto_approval() to emit distinct structured key-value logs per failure reason. Add a non-debug audit log at WARNING level using Python logging module for production visibility of capability validation failures without sensitive details.
PRA-15 Resolve/justify correctness src/lib/actions/sandbox/rebuild-preflight-phase.ts:223 Add post-build verification of the capability file in the built image, or ensure the enhanced verifyPreparedDcodeRebuildImage() (PRA-4 fix) is called at the appropriate pipeline stage. The verification should run after docker build completes and before the prepared image is marked as ready for recreation.
PRA-16 Resolve/justify security src/lib/actions/sandbox/rebuild-dcode-preflight.ts:223 Fix verifyPreparedDcodeRebuildImage to validate the built image (PRA-4), which will automatically fix this call site.
PRA-17 Resolve/justify correctness agents/langchain-deepagents-code/patch-managed-deepagents-code.py:1 Centralize the warning message in a single source (e.g., managed-dcode-runtime.py constants) and import it in both the Python patch and the TypeScript confirmation logic.
PRA-18 Improvement docs src/commands/sandbox/rebuild.ts:24 Add example '<%= config.bin %> sandbox rebuild my-dcode --yes --dcode-auto-approval disabled' to the static examples array in RebuildCliCommand.
PRA-19 Improvement docs docs/reference/commands.mdx:2240 Add rebuild examples for --dcode-auto-approval disabled and --dcode-auto-approval thread-opt-in to commands.mdx documentation, similar to how --tool-disclosure and --observability are documented.
PRA-20 Improvement architecture src/lib/onboard/machine/handlers/sandbox.ts:1 Track follow-up refactor to split SandboxStateFlow into pipeline of feature-specific handlers implementing common interface. No immediate action required in this PR.

🚨 Required before merge

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

PRA-4 Required — verifyPreparedDcodeRebuildImage() does not validate built image's auto-approval capability file

  • Location: src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • Category: correctness
  • Problem: verifyPreparedDcodeRebuildImage() only validates the build context fingerprint via verifyPreparedBuildContext(). It never runs docker run --rm <image> cat /usr/local/share/nemoclaw/dcode-auto-approval or equivalent layer extraction to confirm the exact capability content matches the requested mode ("disabled\n" or "thread-opt-in\n"). A malicious or buggy Dockerfile patch could produce an image with the wrong auto-approval mode without detection.
  • Impact: An attacker who can influence the Dockerfile patch or build context could produce a managed DCode image that reports thread-opt-in capability but actually has disabled (or vice versa), bypassing the operator's intent and the rebuild pipeline's verification.
  • Required action: Enhance verifyPreparedDcodeRebuildImage() to run docker run --rm <image> cat /usr/local/share/nemoclaw/dcode-auto-approval (or use layer extraction via docker image save + tar inspection) and verify the content matches prepared.dcodeAutoApprovalMode exactly. The PreparedDcodeRebuildImage type already includes dcodeAutoApprovalMode.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext (build context fingerprint) without any docker run inspection of the built image's capability file.
  • Missing regression test: Add a test that builds a DCode image with thread-opt-in, then mutates the capability file in the built image (via a malicious RUN step or layer manipulation), and asserts verifyPreparedDcodeRebuildImage returns false.
  • Done when: The required change is committed and verification passes: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext (build context fingerprint) without any docker run inspection of the built image's capability file.
  • Evidence: Function body at line 84 returns verifyPreparedBuildContext(prepared) only; no docker run or layer inspection of built image.

PRA-5 Required — Bash capability validation has TOCTOU window between stat check and content read

  • Location: agents/langchain-deepagents-code/dcode-wrapper.sh:63
  • Category: security
  • Problem: The read_managed_auto_approval_mode() function calls managed_auto_approval_file_metadata() which runs stat on the file, then separately uses cmp to read the file content. There is a window between the stat check and the content read where the file could be replaced (e.g., via a bind mount or race). The Python implementation correctly uses O_NOFOLLOW on the open descriptor and validates metadata via fstat on the same descriptor before reading.
  • Impact: In a compromised or misconfigured sandbox, a symlink swap or file replacement between the stat and read could cause the wrapper to accept a capability file that doesn't match the validated metadata, potentially enabling auto-approval when it should be disabled.
  • Required action: Align Bash validation with Python approach: open the file with O_NOFOLLOW and validate metadata via fstat on the open descriptor, then read content via the same descriptor. In Bash 4.1+, use exec {fd}<file for descriptor-based validation. Alternatively, document why container image immutability makes this risk theoretical.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and observe the separate stat (managed_auto_approval_file_metadata) and cmp (content read) calls with no descriptor-based atomic validation.
  • Missing regression test: Add a test that creates a capability file with correct metadata, then replaces it with a different-content file between the stat and read, and asserts the Bash wrapper returns 'disabled'.
  • Done when: The required change is committed and verification passes: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and observe the separate stat (managed_auto_approval_file_metadata) and cmp (content read) calls with no descriptor-based atomic validation.
  • Evidence: managed_auto_approval_file_metadata() runs stat; read_managed_auto_approval_mode() then runs cmp -- "$file" <(printf '%s\n' 'disabled') with no shared file descriptor.

PRA-6 Required — managed_auto_approval_mode() missing required source-of-truth comment block and structured logging

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • Category: architecture
  • Problem: The managed_auto_approval_mode() function is a security-critical trust boundary but lacks the required 5-element source-of-truth comment block (invalid state, source boundary, source-fix constraint, regression test, removal condition). The _disabled_auto_approval() helper only logs when NEMOCLAW_DEBUG=1 with generic reasons and no production audit log at WARNING level.
  • Impact: Production capability validation failures are invisible in non-debug deployments. Operators cannot audit why auto-approval was disabled without enabling debug mode, which may expose sensitive information. The missing source-of-truth documentation makes future maintenance risky.
  • Required action: Add a detailed code comment block at managed_auto_approval_mode() with all five source-of-truth elements. Modify _disabled_auto_approval() to emit structured key-value stderr logs (e.g., 'reason=capability path is a symlink', 'reason=capability metadata is unsafe', 'reason=capability file was truncated', 'reason=capability file changed while reading', 'reason=capability file read failed', 'reason=capability contents are invalid') for each distinct failure path. Add a non-debug WARNING-level audit log using Python logging module for production visibility of capability validation failures.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and confirm no 5-element source-of-truth comment block exists. Check _disabled_auto_approval at line 810 for debug-only logging.
  • Missing regression test: Add a test that triggers each failure path (symlink, wrong ownership, wrong mode, wrong size, truncation, content change during read, read failure, invalid content) and asserts structured stderr output with the correct reason key and a WARNING-level log entry.
  • Done when: The required change is committed and verification passes: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and confirm no 5-element source-of-truth comment block exists. Check _disabled_auto_approval at line 810 for debug-only logging.
  • Evidence: Function has inline comment 'The image build owns this file, but runtime must tolerate missing or malformed image state and fail closed...' but no structured 5-element block. _disabled_auto_approval only prints when NEMOCLAW_DEBUG==1.
Review findings by urgency: 3 required fixes, 14 items to resolve/justify, 3 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: managed_auto_approval_mode() in managed-dcode-runtime.py:823

  • 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: langchain-deepagents-code-auto-approval-image.test.ts pins rejected shapes; direct-module-patch.test.ts validates mode resolution
  • 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: Function has inline comment but no structured 5-element source-of-truth block. _disabled_auto_approval only logs in debug mode.

PRA-2 Resolve/justify — Source-of-truth review needed: read_managed_auto_approval_mode() in dcode-wrapper.sh:55

  • 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: Missing — no test for TOCTOU or any failure path in Bash wrapper
  • 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: Function uses separate stat (managed_auto_approval_file_metadata) and cmp calls with no shared file descriptor. No source-of-truth comment block.

PRA-3 Resolve/justify — Source-of-truth review needed: verifyPreparedDcodeRebuildImage() in rebuild-managed-image-preflight.ts:84

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as missing.
  • 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 currently — this is the gap (PRA-4)
  • 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: Function returns verifyPreparedBuildContext(prepared) only. No docker run --rm <image> cat /capability or layer inspection.

PRA-7 Resolve/justify — Source-of-truth review needed: managed_auto_approval_mode()

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • Category: architecture
  • Problem: The managed_auto_approval_mode() function is a localized workaround for runtime validation of an image-baked capability. The PR must identify: (1) what invalid state is handled, (2) where that state is created, (3) why the source cannot be fixed in this PR, (4) what regression test proves the source cannot regress, and (5) when the workaround can be removed.
  • Impact: Without this analysis, the localized validation may become permanent technical debt or mask a source-level fix that should be made instead (e.g., making sandbox images truly immutable end-to-end).
  • Recommended action: Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source (image immutability) to make the runtime validation unnecessary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and check for a comment block covering all five elements.
  • Missing regression test: If the workaround is kept, add a test that simulates the invalid state at its source (e.g., a mutated image layer) and confirms the runtime validation catches it.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and check for a comment block covering all five elements.
  • Evidence: Function handles missing/symlink/wrong-owner/wrong-mode/wrong-size/truncated/changed-during-read/read-error/invalid-content states. Source: Dockerfile writes file at build; runtime cannot guarantee immutability. Constraint: sandbox images not yet provably immutable end-to-end. Regression: langchain-deepagents-code-auto-approval-image.test.ts pins rejected shapes. Removal: when images are provably immutable.

PRA-8 Resolve/justify — Source-of-truth review needed: read_managed_auto_approval_mode()

  • Location: agents/langchain-deepagents-code/dcode-wrapper.sh:55
  • Category: architecture
  • Problem: The read_managed_auto_approval_mode() function in the Bash wrapper is a localized workaround for runtime validation. The PR must identify the five source-of-truth elements for this function.
  • Impact: Without justification, this Bash validation may become permanent debt or mask a source fix.
  • Recommended action: Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source to make runtime validation unnecessary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and check for a comment block covering all five elements.
  • Missing regression test: If kept, add a test simulating the invalid state at its source and confirming the Bash validation catches it.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and check for a comment block covering all five elements.
  • Evidence: Same invalid states as Python version. Source: Dockerfile writes file. Constraint: Bash is the only entrypoint before exec; cannot call Python/Node. Regression: direct-module-patch.test.ts validates wrapper behavior. Removal: when wrapper replaced by Node entrypoint or upstream handles validation.

PRA-9 Resolve/justify — Source-of-truth review needed: verifyPreparedDcodeRebuildImage()

  • Location: src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • Category: architecture
  • Problem: The verifyPreparedDcodeRebuildImage() function only validates build context fingerprint, not the built image's capability file. This is a localized workaround that avoids the harder problem of inspecting the built image. The PR must identify the five source-of-truth elements.
  • Impact: Without justification, this incomplete verification may remain a permanent gap.
  • Recommended action: Either fix the function to validate the built image (see PRA-4) which would eliminate the need for this workaround, or provide the five-element justification.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext.
  • Missing regression test: See PRA-4's missing regression test.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext.
  • Evidence: Function returns verifyPreparedBuildContext(prepared) only. Invalid state: built image capability file differs from prepared intent. Source: Dockerfile patch + build could mutate file. Constraint: inspection of built image not implemented. Regression: none currently. Removal: when verification runs against built image.

PRA-10 Resolve/justify — patchDcodeAutoApprovalDockerArg regex strips trailing comments on ARG line

  • Location: src/lib/onboard/dockerfile-patch.ts:64
  • Category: correctness
  • Problem: The regex ^ARG NEMOCLAW_DCODE_AUTO_APPROVAL=[^\r\n]*$ does not capture trailing comments. If the Dockerfile has 'ARG NEMOCLAW_DCODE_AUTO_APPROVAL=disabled # comment', the replacement produces 'ARG NEMOCLAW_DCODE_AUTO_APPROVAL=thread-opt-in' losing the comment.
  • Impact: Dockerfile comments documenting the build arg are lost during rebuild, reducing maintainability and potentially losing important context for operators.
  • Recommended action: Relax the regex to capture and preserve trailing comments: ^ARG NEMOCLAW_DCODE_AUTO_APPROVAL=([^\r\n#]*)(?:\s*#(.*))?$ and replace with ARG NEMOCLAW_DCODE_AUTO_APPROVAL=${mode}${comment ? ' #' + comment : ''}. Update the test to expect comment preservation.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read patchDcodeAutoApprovalDockerArg in dockerfile-patch.ts:64 and test with a Dockerfile containing a trailing comment on the ARG line.
  • Missing regression test: Add a test case in dockerfile-patch-dcode-auto-approval.test.ts that patches a Dockerfile with a trailing comment and asserts the comment is preserved in the output.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read patchDcodeAutoApprovalDockerArg in dockerfile-patch.ts:64 and test with a Dockerfile containing a trailing comment on the ARG line.
  • Evidence: Regex pattern matches to end of line without capturing optional comment. Replacement does not preserve comment group.

PRA-11 Resolve/justify — E2E test only covers /clear thread reset path

  • Location: test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh:1
  • Category: tests
  • Problem: The E2E test exercises auto-approval activation via the TUI approval menu and reset via /clear. It does not cover other thread-boundary reset paths: thread switch via dcode TUI thread selector, agent swap via model switch, /force-clear, or process restart.
  • Impact: Reset behavior for other thread transitions is untested in the E2E suite. A regression in _nemoclaw_reset_thread_auto_approval being called from _nemoclaw_resume_thread or _nemoclaw_restart_server_for_agent_swap would not be caught.
  • Recommended action: Extend the E2E check to cover at least one additional reset path (e.g., thread switch via dcode TUI thread selector, or agent swap via model switch). Alternatively, add explicit unit test assertions in direct-module-patch.test.ts that _nemoclaw_reset_thread_auto_approval is called from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with assertions on session_state.auto_approve and approval_mode_key clearing.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read the E2E test script and confirm it only exercises /clear for thread reset. Check direct-module-patch.test.ts for assertions on _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap reset behavior.
  • Missing regression test: Add E2E coverage for thread switch or agent swap reset, or add unit test assertions for _nemoclaw_reset_thread_auto_approval calls from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with session_state.auto_approve and approval_mode_key clearing assertions.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read the E2E test script and confirm it only exercises /clear for thread reset. Check direct-module-patch.test.ts for assertions on _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap reset behavior.
  • Evidence: E2E script only calls /clear and verifies NEMOCLAW_AUTORUN_NEW_THREAD + NEMOCLAW_AUTORUN_MANUAL_APPROVAL_RESTORED markers.

PRA-12 Resolve/justify — Missing assertions for TUI status bar indicator and stderr warning on auto-approval activation

  • Location: test/langchain-deepagents-code-direct-module-patch.test.ts:1128
  • Category: tests
  • Problem: The test validates that instance.notifications contains the warning message, but does not assert that instance._status_bar.set_auto_approve was called with enabled=true, nor does it capture stderr to verify the warning appears there as well.
  • Impact: The TUI status bar indicator (visual cue) and stderr warning (audit trail) are not regression-tested. A regression removing the status bar update or stderr print would not be caught.
  • Recommended action: Add test assertions: (1) after _on_auto_approve_enabled() or action_toggle_auto_approve() enables auto-approval, assert instance._status_bar.set_auto_approve was called with enabled=true; (2) assert the warning message appears in instance.notifications AND consider capturing stderr in the test harness to verify the stderr warning path.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read the test at direct-module-patch.test.ts:1128 and confirm it checks instance.notifications but not _status_bar.set_auto_approve call or stderr capture.
  • Missing regression test: Add assertions for _status_bar.set_auto_approve(enabled=true) call and stderr output capture when auto-approval is enabled.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read the test at direct-module-patch.test.ts:1128 and confirm it checks instance.notifications but not _status_bar.set_auto_approve call or stderr capture.
  • Evidence: Test calls set_auto(instance, False) then await instance._on_auto_approve_enabled() and asserts WARNING in instance.notifications[-1][0], but no mock/assertion on _status_bar.set_auto_approve.

PRA-13 Resolve/justify — Missing session-bootstrap test scenarios for dcode-auto-approval

  • Location: src/lib/onboard/dcode-auto-approval.test.ts:1
  • Category: tests
  • Problem: The dcode-auto-approval.test.ts covers normalization, drift detection, and create-plan logic, but does not test the three session-bootstrap scenarios: (1) fresh onboarding with thread-opt-in, (2) re-onboard with existing disabled mode, (3) re-onboard with recorded thread-opt-in mode. The prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions are not exercised with mocked registry entries for these scenarios.
  • Impact: Session-bootstrap behavior for the auto-approval capability is untested. A regression in how recorded vs requested modes are resolved during onboarding/resume would not be caught.
  • Recommended action: Expand dcode-auto-approval.test.ts to cover the three session-bootstrap scenarios using the existing prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions with mocked registry entries.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read dcode-auto-approval.test.ts and confirm no tests exercise session-bootstrap scenarios with mocked registry entries.
  • Missing regression test: Add test cases for: (1) fresh onboarding with requested thread-opt-in, (2) re-onboard with recorded disabled and requested thread-opt-in (drift), (3) re-onboard with recorded thread-opt-in and requested disabled (drift).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read dcode-auto-approval.test.ts and confirm no tests exercise session-bootstrap scenarios with mocked registry entries.
  • Evidence: Test file has 6 tests: defaults, feature support, legacy state as disabled, malformed recorded state, prepare create plan, reject orphaned/malformed create state. No onboarding session bootstrap scenarios.

PRA-14 Resolve/justify — _disabled_auto_approval() only logs in debug mode with generic reasons, no production audit log

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:810
  • Category: correctness
  • Problem: The _disabled_auto_approval() helper only prints to stderr when NEMOCLAW_DEBUG=1. In production, capability validation failures are silent. Each distinct failure reason (ownership, mode, size, content mismatch, symlink, readability, truncation, read failure, content change during read) should emit a structured key-value log and a WARNING-level audit log.
  • Impact: Operators cannot audit why auto-approval was disabled in production without enabling debug mode. Distinct failure reasons are not distinguishable in logs.
  • Recommended action: Enhance _disabled_auto_approval() to emit distinct structured key-value logs per failure reason. Add a non-debug audit log at WARNING level using Python logging module for production visibility of capability validation failures without sensitive details.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read _disabled_auto_approval in managed-dcode-runtime.py:810 and confirm it only logs when NEMOCLAW_DEBUG=1.
  • Missing regression test: Add a test that triggers each failure path and asserts structured stderr output with correct reason key and WARNING-level log entry (see also PRA-6).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read _disabled_auto_approval in managed-dcode-runtime.py:810 and confirm it only logs when NEMOCLAW_DEBUG=1.
  • Evidence: Function prints f'NemoClaw managed auto-approval disabled: {reason}' only when os.environ.get('NEMOCLAW_DEBUG') == '1'.

PRA-15 Resolve/justify — Rebuild pipeline lacks post-build verification of built image's capability file

  • Location: src/lib/actions/sandbox/rebuild-preflight-phase.ts:223
  • Category: correctness
  • Problem: The rebuild pipeline calls verifyPreparedDcodeRebuildImage() which only validates build context. There is no post-build verification of the capability file in the built image before the prepared image is marked ready for recreation.
  • Impact: A build that produces an image with the wrong capability file content would not be detected before the sandbox is recreated, potentially deploying an image with the wrong auto-approval mode.
  • Recommended action: Add post-build verification of the capability file in the built image, or ensure the enhanced verifyPreparedDcodeRebuildImage() (PRA-4 fix) is called at the appropriate pipeline stage. The verification should run after docker build completes and before the prepared image is marked as ready for recreation.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read rebuild-preflight-phase.ts around line 223 and confirm no post-build capability file verification occurs.
  • Missing regression test: Add a test that builds a DCode image with thread-opt-in, then mutates the capability file in the built image, and asserts the rebuild pipeline rejects the prepared image.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read rebuild-preflight-phase.ts around line 223 and confirm no post-build capability file verification occurs.
  • Evidence: prepareDcodeReplacementBeforeMutation calls verifyPreparedDcodeRebuildImage(buildContext) which only validates build context fingerprint.

PRA-16 Resolve/justify — verifyPreparedDcodeRebuildImage called but does not verify built image capability

  • Location: src/lib/actions/sandbox/rebuild-dcode-preflight.ts:223
  • Category: security
  • Problem: The prepareDcodeReplacementBeforeMutation function calls verifyPreparedDcodeRebuildImage(buildContext) at line 223 (in the revalidation step) but this only validates build context, not the built image's capability file. The same gap exists in revalidateDcodeReplacementAtMutationEdge.
  • Impact: Same as PRA-4: the preflight and mutation-edge revalidations do not catch a built image with the wrong capability file.
  • Recommended action: Fix verifyPreparedDcodeRebuildImage to validate the built image (PRA-4), which will automatically fix this call site.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read prepareDcodeReplacementBeforeMutation and revalidateDcodeReplacementAtMutationEdge in rebuild-dcode-preflight.ts and confirm they call verifyPreparedDcodeRebuildImage which only validates build context.
  • Missing regression test: See PRA-4's missing regression test.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read prepareDcodeReplacementBeforeMutation and revalidateDcodeReplacementAtMutationEdge in rebuild-dcode-preflight.ts and confirm they call verifyPreparedDcodeRebuildImage which only validates build context.
  • Evidence: Line 223: if (!verifyPreparedDcodeRebuildImage(buildContext) || !pinnedBase.verify()) { fail(...) }

PRA-17 Resolve/justify — Auto-approval warning message duplication between Python and TypeScript

  • Location: agents/langchain-deepagents-code/patch-managed-deepagents-code.py:1
  • Category: correctness
  • Problem: The auto-approval warning message "Tool calls, including shell commands, may execute without further confirmation inside the sandbox." is defined in patch-managed-deepagents-code.py (_NEMOCLAW_AUTO_APPROVAL_WARNING) and also appears in rebuild-preflight-confirmation.test.ts and likely in the TUI patch. If these drift, the warning shown in the TUI may not match the rebuild confirmation warning.
  • Impact: Inconsistent warning messages confuse operators and weaken audit trails.
  • Recommended action: Centralize the warning message in a single source (e.g., managed-dcode-runtime.py constants) and import it in both the Python patch and the TypeScript confirmation logic.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Search for the warning message string across the codebase and count occurrences.
  • Missing regression test: Add a test that asserts the warning message in the Python patch matches the TypeScript confirmation warning.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Search for the warning message string across the codebase and count occurrences.
  • Evidence: patch-managed-deepagents-code.py defines _NEMOCLAW_AUTO_APPROVAL_WARNING. rebuild-preflight-confirmation.test.ts expects 'including shell commands' in output. TUI patch uses same string.

💡 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-18 Improvement — CLI examples missing --dcode-auto-approval disabled demonstration

  • Location: src/commands/sandbox/rebuild.ts:24
  • Category: docs
  • Problem: The examples array in RebuildCliCommand includes --dcode-auto-approval thread-opt-in but not --dcode-auto-approval disabled. Operators need to see how to disable the capability after enabling it.
  • Impact: Users may not discover how to return the sandbox to the default posture.
  • Suggested action: Add example '<%= config.bin %> sandbox rebuild my-dcode --yes --dcode-auto-approval disabled' to the static examples array in RebuildCliCommand.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read the examples array in rebuild.ts:24 and confirm no disabled example exists.
  • Missing regression test: Not applicable (documentation improvement).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Examples array shows: '<%= config.bin %> sandbox rebuild my-dcode --dcode-auto-approval thread-opt-in' but no disabled variant.

PRA-19 Improvement — Rebuild command documentation missing --dcode-auto-approval examples

  • Location: docs/reference/commands.mdx:2240
  • Category: docs
  • Problem: The commands.mdx documentation for rebuild includes --tool-disclosure and --observability examples but lacks --dcode-auto-approval examples for both disabled and thread-opt-in modes.
  • Impact: Operators consulting the reference documentation won't see usage examples for the new flag.
  • Suggested action: Add rebuild examples for --dcode-auto-approval disabled and --dcode-auto-approval thread-opt-in to commands.mdx documentation, similar to how --tool-disclosure and --observability are documented.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read the rebuild command documentation in commands.mdx and confirm no --dcode-auto-approval examples exist.
  • Missing regression test: Not applicable (documentation improvement).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Documentation shows --tool-disclosure and --observability examples but no --dcode-auto-approval.

PRA-20 Improvement — SandboxStateFlow coordinates 8+ feature domains — tracked architecture debt

  • Location: src/lib/onboard/machine/handlers/sandbox.ts:1
  • Category: architecture
  • Problem: The SandboxStateFlow handler coordinates onboarding, GPU, MCP, observability, tool disclosure, auto-approval, and other feature domains in a single monolithic handler. This is tracked architecture debt.
  • Impact: Adding new features increases complexity and coupling. Future refactoring should split into a pipeline of feature-specific handlers implementing a common interface.
  • Suggested action: Track follow-up refactor to split SandboxStateFlow into pipeline of feature-specific handlers implementing common interface. No immediate action required in this PR.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read sandbox.ts and observe the number of feature domains handled in SandboxStateFlow.
  • Missing regression test: Not applicable (architecture tracking item).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: File is 832 lines; handles onboarding, GPU, MCP, observability, tool disclosure, auto-approval, and other domains in single handler.
Simplification opportunities: 1 possible cut

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

  • PRA-10 shrink (src/lib/onboard/dockerfile-patch.ts:64): const instruction = new RegExp(`^ARG ${DCODE_AUTO_APPROVAL_BUILD_ARG}=[^\r\n]*$`, "gm"); return dockerfile.replace(instruction, `ARG ${DCODE_AUTO_APPROVAL_BUILD_ARG}=${mode}`);
    • Replacement: const instruction = new RegExp(`^ARG ${DCODE_AUTO_APPROVAL_BUILD_ARG}=([^\r\n#]*)(?:\s*#(.*))?$`, "gm"); return dockerfile.replace(instruction, (_, val, comment) => `ARG ${DCODE_AUTO_APPROVAL_BUILD_ARG}=${mode}${comment ? ' #' + comment : ''}`);
    • Net: 0 lines
    • Safety boundary: Must preserve exact match count validation (matches.length === 1) and fail-closed on invalid mode.
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 — test/langchain-deepagents-code-image.test.ts: rejects built image where capability file content mismatches prepared dcodeAutoApprovalMode. Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/langchain-deepagents-code/Dockerfile, agents/langchain-deepagents-code/dcode-launcher.sh, agents/langchain-deepagents-code/dcode-wrapper.sh, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, agents/langchain-deepagents-code/start.sh, docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx.
  • PRA-T2 Runtime validation — test/langchain-deepagents-code-image.test.ts: Bash wrapper rejects capability file replaced via bind mount between stat and read (TOCTOU). Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/langchain-deepagents-code/Dockerfile, agents/langchain-deepagents-code/dcode-launcher.sh, agents/langchain-deepagents-code/dcode-wrapper.sh, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, agents/langchain-deepagents-code/start.sh, docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx.
  • PRA-T3 Runtime validation — test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh: add thread-switch reset path (TUI thread selector). Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/langchain-deepagents-code/Dockerfile, agents/langchain-deepagents-code/dcode-launcher.sh, agents/langchain-deepagents-code/dcode-wrapper.sh, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, agents/langchain-deepagents-code/start.sh, docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx.
  • PRA-T4 Runtime validation — test/langchain-deepagents-code-direct-module-patch.test.ts: assert _status_bar.set_auto_approve(enabled=true) called on auto-approval enable and capture stderr warning on activation. Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/langchain-deepagents-code/Dockerfile, agents/langchain-deepagents-code/dcode-launcher.sh, agents/langchain-deepagents-code/dcode-wrapper.sh, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, agents/langchain-deepagents-code/start.sh, docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx.
  • PRA-T5 Runtime validation — src/lib/onboard/dcode-auto-approval.test.ts: three session-bootstrap scenarios with mocked registry (fresh onboard thread-opt-in, re-onboard disabled->thread-opt-in, re-onboard thread-opt-in->disabled). Runtime/sandbox/infrastructure paths need behavioral runtime validation: agents/langchain-deepagents-code/Dockerfile, agents/langchain-deepagents-code/dcode-launcher.sh, agents/langchain-deepagents-code/dcode-wrapper.sh, agents/langchain-deepagents-code/managed-dcode-runtime.py, agents/langchain-deepagents-code/patch-managed-deepagents-code.py, agents/langchain-deepagents-code/start.sh, docs/about/release-notes.mdx, docs/get-started/quickstart-langchain-deepagents-code.mdx.
  • PRA-T6 E2E test only covers /clear thread reset path — Extend the E2E check to cover at least one additional reset path (e.g., thread switch via dcode TUI thread selector, or agent swap via model switch). Alternatively, add explicit unit test assertions in direct-module-patch.test.ts that _nemoclaw_reset_thread_auto_approval is called from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with assertions on session_state.auto_approve and approval_mode_key clearing.
  • PRA-T7 Missing assertions for TUI status bar indicator and stderr warning on auto-approval activation — Add test assertions: (1) after _on_auto_approve_enabled() or action_toggle_auto_approve() enables auto-approval, assert instance._status_bar.set_auto_approve was called with enabled=true; (2) assert the warning message appears in instance.notifications AND consider capturing stderr in the test harness to verify the stderr warning path.
  • PRA-T8 Missing session-bootstrap test scenarios for dcode-auto-approval — Expand dcode-auto-approval.test.ts to cover the three session-bootstrap scenarios using the existing prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions with mocked registry entries.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: managed_auto_approval_mode() in managed-dcode-runtime.py:823

  • 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: langchain-deepagents-code-auto-approval-image.test.ts pins rejected shapes; direct-module-patch.test.ts validates mode resolution
  • 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: Function has inline comment but no structured 5-element source-of-truth block. _disabled_auto_approval only logs in debug mode.

PRA-2 Resolve/justify — Source-of-truth review needed: read_managed_auto_approval_mode() in dcode-wrapper.sh:55

  • 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: Missing — no test for TOCTOU or any failure path in Bash wrapper
  • 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: Function uses separate stat (managed_auto_approval_file_metadata) and cmp calls with no shared file descriptor. No source-of-truth comment block.

PRA-3 Resolve/justify — Source-of-truth review needed: verifyPreparedDcodeRebuildImage() in rebuild-managed-image-preflight.ts:84

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as missing.
  • 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 currently — this is the gap (PRA-4)
  • 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: Function returns verifyPreparedBuildContext(prepared) only. No docker run --rm <image> cat /capability or layer inspection.

PRA-4 Required — verifyPreparedDcodeRebuildImage() does not validate built image's auto-approval capability file

  • Location: src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • Category: correctness
  • Problem: verifyPreparedDcodeRebuildImage() only validates the build context fingerprint via verifyPreparedBuildContext(). It never runs docker run --rm <image> cat /usr/local/share/nemoclaw/dcode-auto-approval or equivalent layer extraction to confirm the exact capability content matches the requested mode ("disabled\n" or "thread-opt-in\n"). A malicious or buggy Dockerfile patch could produce an image with the wrong auto-approval mode without detection.
  • Impact: An attacker who can influence the Dockerfile patch or build context could produce a managed DCode image that reports thread-opt-in capability but actually has disabled (or vice versa), bypassing the operator's intent and the rebuild pipeline's verification.
  • Required action: Enhance verifyPreparedDcodeRebuildImage() to run docker run --rm <image> cat /usr/local/share/nemoclaw/dcode-auto-approval (or use layer extraction via docker image save + tar inspection) and verify the content matches prepared.dcodeAutoApprovalMode exactly. The PreparedDcodeRebuildImage type already includes dcodeAutoApprovalMode.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext (build context fingerprint) without any docker run inspection of the built image's capability file.
  • Missing regression test: Add a test that builds a DCode image with thread-opt-in, then mutates the capability file in the built image (via a malicious RUN step or layer manipulation), and asserts verifyPreparedDcodeRebuildImage returns false.
  • Done when: The required change is committed and verification passes: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext (build context fingerprint) without any docker run inspection of the built image's capability file.
  • Evidence: Function body at line 84 returns verifyPreparedBuildContext(prepared) only; no docker run or layer inspection of built image.

PRA-5 Required — Bash capability validation has TOCTOU window between stat check and content read

  • Location: agents/langchain-deepagents-code/dcode-wrapper.sh:63
  • Category: security
  • Problem: The read_managed_auto_approval_mode() function calls managed_auto_approval_file_metadata() which runs stat on the file, then separately uses cmp to read the file content. There is a window between the stat check and the content read where the file could be replaced (e.g., via a bind mount or race). The Python implementation correctly uses O_NOFOLLOW on the open descriptor and validates metadata via fstat on the same descriptor before reading.
  • Impact: In a compromised or misconfigured sandbox, a symlink swap or file replacement between the stat and read could cause the wrapper to accept a capability file that doesn't match the validated metadata, potentially enabling auto-approval when it should be disabled.
  • Required action: Align Bash validation with Python approach: open the file with O_NOFOLLOW and validate metadata via fstat on the open descriptor, then read content via the same descriptor. In Bash 4.1+, use exec {fd}<file for descriptor-based validation. Alternatively, document why container image immutability makes this risk theoretical.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and observe the separate stat (managed_auto_approval_file_metadata) and cmp (content read) calls with no descriptor-based atomic validation.
  • Missing regression test: Add a test that creates a capability file with correct metadata, then replaces it with a different-content file between the stat and read, and asserts the Bash wrapper returns 'disabled'.
  • Done when: The required change is committed and verification passes: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and observe the separate stat (managed_auto_approval_file_metadata) and cmp (content read) calls with no descriptor-based atomic validation.
  • Evidence: managed_auto_approval_file_metadata() runs stat; read_managed_auto_approval_mode() then runs cmp -- "$file" <(printf '%s\n' 'disabled') with no shared file descriptor.

PRA-6 Required — managed_auto_approval_mode() missing required source-of-truth comment block and structured logging

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • Category: architecture
  • Problem: The managed_auto_approval_mode() function is a security-critical trust boundary but lacks the required 5-element source-of-truth comment block (invalid state, source boundary, source-fix constraint, regression test, removal condition). The _disabled_auto_approval() helper only logs when NEMOCLAW_DEBUG=1 with generic reasons and no production audit log at WARNING level.
  • Impact: Production capability validation failures are invisible in non-debug deployments. Operators cannot audit why auto-approval was disabled without enabling debug mode, which may expose sensitive information. The missing source-of-truth documentation makes future maintenance risky.
  • Required action: Add a detailed code comment block at managed_auto_approval_mode() with all five source-of-truth elements. Modify _disabled_auto_approval() to emit structured key-value stderr logs (e.g., 'reason=capability path is a symlink', 'reason=capability metadata is unsafe', 'reason=capability file was truncated', 'reason=capability file changed while reading', 'reason=capability file read failed', 'reason=capability contents are invalid') for each distinct failure path. Add a non-debug WARNING-level audit log using Python logging module for production visibility of capability validation failures.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and confirm no 5-element source-of-truth comment block exists. Check _disabled_auto_approval at line 810 for debug-only logging.
  • Missing regression test: Add a test that triggers each failure path (symlink, wrong ownership, wrong mode, wrong size, truncation, content change during read, read failure, invalid content) and asserts structured stderr output with the correct reason key and a WARNING-level log entry.
  • Done when: The required change is committed and verification passes: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and confirm no 5-element source-of-truth comment block exists. Check _disabled_auto_approval at line 810 for debug-only logging.
  • Evidence: Function has inline comment 'The image build owns this file, but runtime must tolerate missing or malformed image state and fail closed...' but no structured 5-element block. _disabled_auto_approval only prints when NEMOCLAW_DEBUG==1.

PRA-7 Resolve/justify — Source-of-truth review needed: managed_auto_approval_mode()

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:823
  • Category: architecture
  • Problem: The managed_auto_approval_mode() function is a localized workaround for runtime validation of an image-baked capability. The PR must identify: (1) what invalid state is handled, (2) where that state is created, (3) why the source cannot be fixed in this PR, (4) what regression test proves the source cannot regress, and (5) when the workaround can be removed.
  • Impact: Without this analysis, the localized validation may become permanent technical debt or mask a source-level fix that should be made instead (e.g., making sandbox images truly immutable end-to-end).
  • Recommended action: Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source (image immutability) to make the runtime validation unnecessary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and check for a comment block covering all five elements.
  • Missing regression test: If the workaround is kept, add a test that simulates the invalid state at its source (e.g., a mutated image layer) and confirms the runtime validation catches it.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read managed_auto_approval_mode in managed-dcode-runtime.py:823 and check for a comment block covering all five elements.
  • Evidence: Function handles missing/symlink/wrong-owner/wrong-mode/wrong-size/truncated/changed-during-read/read-error/invalid-content states. Source: Dockerfile writes file at build; runtime cannot guarantee immutability. Constraint: sandbox images not yet provably immutable end-to-end. Regression: langchain-deepagents-code-auto-approval-image.test.ts pins rejected shapes. Removal: when images are provably immutable.

PRA-8 Resolve/justify — Source-of-truth review needed: read_managed_auto_approval_mode()

  • Location: agents/langchain-deepagents-code/dcode-wrapper.sh:55
  • Category: architecture
  • Problem: The read_managed_auto_approval_mode() function in the Bash wrapper is a localized workaround for runtime validation. The PR must identify the five source-of-truth elements for this function.
  • Impact: Without justification, this Bash validation may become permanent debt or mask a source fix.
  • Recommended action: Provide the five-element source-of-truth justification in a code comment block at the function, or fix the source to make runtime validation unnecessary.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and check for a comment block covering all five elements.
  • Missing regression test: If kept, add a test simulating the invalid state at its source and confirming the Bash validation catches it.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read read_managed_auto_approval_mode in dcode-wrapper.sh:55 and check for a comment block covering all five elements.
  • Evidence: Same invalid states as Python version. Source: Dockerfile writes file. Constraint: Bash is the only entrypoint before exec; cannot call Python/Node. Regression: direct-module-patch.test.ts validates wrapper behavior. Removal: when wrapper replaced by Node entrypoint or upstream handles validation.

PRA-9 Resolve/justify — Source-of-truth review needed: verifyPreparedDcodeRebuildImage()

  • Location: src/lib/actions/sandbox/rebuild-managed-image-preflight.ts:84
  • Category: architecture
  • Problem: The verifyPreparedDcodeRebuildImage() function only validates build context fingerprint, not the built image's capability file. This is a localized workaround that avoids the harder problem of inspecting the built image. The PR must identify the five source-of-truth elements.
  • Impact: Without justification, this incomplete verification may remain a permanent gap.
  • Recommended action: Either fix the function to validate the built image (see PRA-4) which would eliminate the need for this workaround, or provide the five-element justification.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext.
  • Missing regression test: See PRA-4's missing regression test.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read verifyPreparedDcodeRebuildImage in rebuild-managed-image-preflight.ts:84 and confirm it only calls verifyPreparedBuildContext.
  • Evidence: Function returns verifyPreparedBuildContext(prepared) only. Invalid state: built image capability file differs from prepared intent. Source: Dockerfile patch + build could mutate file. Constraint: inspection of built image not implemented. Regression: none currently. Removal: when verification runs against built image.

PRA-10 Resolve/justify — patchDcodeAutoApprovalDockerArg regex strips trailing comments on ARG line

  • Location: src/lib/onboard/dockerfile-patch.ts:64
  • Category: correctness
  • Problem: The regex ^ARG NEMOCLAW_DCODE_AUTO_APPROVAL=[^\r\n]*$ does not capture trailing comments. If the Dockerfile has 'ARG NEMOCLAW_DCODE_AUTO_APPROVAL=disabled # comment', the replacement produces 'ARG NEMOCLAW_DCODE_AUTO_APPROVAL=thread-opt-in' losing the comment.
  • Impact: Dockerfile comments documenting the build arg are lost during rebuild, reducing maintainability and potentially losing important context for operators.
  • Recommended action: Relax the regex to capture and preserve trailing comments: ^ARG NEMOCLAW_DCODE_AUTO_APPROVAL=([^\r\n#]*)(?:\s*#(.*))?$ and replace with ARG NEMOCLAW_DCODE_AUTO_APPROVAL=${mode}${comment ? ' #' + comment : ''}. Update the test to expect comment preservation.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read patchDcodeAutoApprovalDockerArg in dockerfile-patch.ts:64 and test with a Dockerfile containing a trailing comment on the ARG line.
  • Missing regression test: Add a test case in dockerfile-patch-dcode-auto-approval.test.ts that patches a Dockerfile with a trailing comment and asserts the comment is preserved in the output.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read patchDcodeAutoApprovalDockerArg in dockerfile-patch.ts:64 and test with a Dockerfile containing a trailing comment on the ARG line.
  • Evidence: Regex pattern matches to end of line without capturing optional comment. Replacement does not preserve comment group.

PRA-11 Resolve/justify — E2E test only covers /clear thread reset path

  • Location: test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh:1
  • Category: tests
  • Problem: The E2E test exercises auto-approval activation via the TUI approval menu and reset via /clear. It does not cover other thread-boundary reset paths: thread switch via dcode TUI thread selector, agent swap via model switch, /force-clear, or process restart.
  • Impact: Reset behavior for other thread transitions is untested in the E2E suite. A regression in _nemoclaw_reset_thread_auto_approval being called from _nemoclaw_resume_thread or _nemoclaw_restart_server_for_agent_swap would not be caught.
  • Recommended action: Extend the E2E check to cover at least one additional reset path (e.g., thread switch via dcode TUI thread selector, or agent swap via model switch). Alternatively, add explicit unit test assertions in direct-module-patch.test.ts that _nemoclaw_reset_thread_auto_approval is called from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with assertions on session_state.auto_approve and approval_mode_key clearing.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read the E2E test script and confirm it only exercises /clear for thread reset. Check direct-module-patch.test.ts for assertions on _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap reset behavior.
  • Missing regression test: Add E2E coverage for thread switch or agent swap reset, or add unit test assertions for _nemoclaw_reset_thread_auto_approval calls from _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap with session_state.auto_approve and approval_mode_key clearing assertions.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read the E2E test script and confirm it only exercises /clear for thread reset. Check direct-module-patch.test.ts for assertions on _nemoclaw_resume_thread and _nemoclaw_restart_server_for_agent_swap reset behavior.
  • Evidence: E2E script only calls /clear and verifies NEMOCLAW_AUTORUN_NEW_THREAD + NEMOCLAW_AUTORUN_MANUAL_APPROVAL_RESTORED markers.

PRA-12 Resolve/justify — Missing assertions for TUI status bar indicator and stderr warning on auto-approval activation

  • Location: test/langchain-deepagents-code-direct-module-patch.test.ts:1128
  • Category: tests
  • Problem: The test validates that instance.notifications contains the warning message, but does not assert that instance._status_bar.set_auto_approve was called with enabled=true, nor does it capture stderr to verify the warning appears there as well.
  • Impact: The TUI status bar indicator (visual cue) and stderr warning (audit trail) are not regression-tested. A regression removing the status bar update or stderr print would not be caught.
  • Recommended action: Add test assertions: (1) after _on_auto_approve_enabled() or action_toggle_auto_approve() enables auto-approval, assert instance._status_bar.set_auto_approve was called with enabled=true; (2) assert the warning message appears in instance.notifications AND consider capturing stderr in the test harness to verify the stderr warning path.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read the test at direct-module-patch.test.ts:1128 and confirm it checks instance.notifications but not _status_bar.set_auto_approve call or stderr capture.
  • Missing regression test: Add assertions for _status_bar.set_auto_approve(enabled=true) call and stderr output capture when auto-approval is enabled.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read the test at direct-module-patch.test.ts:1128 and confirm it checks instance.notifications but not _status_bar.set_auto_approve call or stderr capture.
  • Evidence: Test calls set_auto(instance, False) then await instance._on_auto_approve_enabled() and asserts WARNING in instance.notifications[-1][0], but no mock/assertion on _status_bar.set_auto_approve.

PRA-13 Resolve/justify — Missing session-bootstrap test scenarios for dcode-auto-approval

  • Location: src/lib/onboard/dcode-auto-approval.test.ts:1
  • Category: tests
  • Problem: The dcode-auto-approval.test.ts covers normalization, drift detection, and create-plan logic, but does not test the three session-bootstrap scenarios: (1) fresh onboarding with thread-opt-in, (2) re-onboard with existing disabled mode, (3) re-onboard with recorded thread-opt-in mode. The prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions are not exercised with mocked registry entries for these scenarios.
  • Impact: Session-bootstrap behavior for the auto-approval capability is untested. A regression in how recorded vs requested modes are resolved during onboarding/resume would not be caught.
  • Recommended action: Expand dcode-auto-approval.test.ts to cover the three session-bootstrap scenarios using the existing prepareDcodeAutoApprovalCreatePlan and hasDcodeAutoApprovalDrift functions with mocked registry entries.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read dcode-auto-approval.test.ts and confirm no tests exercise session-bootstrap scenarios with mocked registry entries.
  • Missing regression test: Add test cases for: (1) fresh onboarding with requested thread-opt-in, (2) re-onboard with recorded disabled and requested thread-opt-in (drift), (3) re-onboard with recorded thread-opt-in and requested disabled (drift).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read dcode-auto-approval.test.ts and confirm no tests exercise session-bootstrap scenarios with mocked registry entries.
  • Evidence: Test file has 6 tests: defaults, feature support, legacy state as disabled, malformed recorded state, prepare create plan, reject orphaned/malformed create state. No onboarding session bootstrap scenarios.

PRA-14 Resolve/justify — _disabled_auto_approval() only logs in debug mode with generic reasons, no production audit log

  • Location: agents/langchain-deepagents-code/managed-dcode-runtime.py:810
  • Category: correctness
  • Problem: The _disabled_auto_approval() helper only prints to stderr when NEMOCLAW_DEBUG=1. In production, capability validation failures are silent. Each distinct failure reason (ownership, mode, size, content mismatch, symlink, readability, truncation, read failure, content change during read) should emit a structured key-value log and a WARNING-level audit log.
  • Impact: Operators cannot audit why auto-approval was disabled in production without enabling debug mode. Distinct failure reasons are not distinguishable in logs.
  • Recommended action: Enhance _disabled_auto_approval() to emit distinct structured key-value logs per failure reason. Add a non-debug audit log at WARNING level using Python logging module for production visibility of capability validation failures without sensitive details.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read _disabled_auto_approval in managed-dcode-runtime.py:810 and confirm it only logs when NEMOCLAW_DEBUG=1.
  • Missing regression test: Add a test that triggers each failure path and asserts structured stderr output with correct reason key and WARNING-level log entry (see also PRA-6).
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read _disabled_auto_approval in managed-dcode-runtime.py:810 and confirm it only logs when NEMOCLAW_DEBUG=1.
  • Evidence: Function prints f'NemoClaw managed auto-approval disabled: {reason}' only when os.environ.get('NEMOCLAW_DEBUG') == '1'.

PRA-15 Resolve/justify — Rebuild pipeline lacks post-build verification of built image's capability file

  • Location: src/lib/actions/sandbox/rebuild-preflight-phase.ts:223
  • Category: correctness
  • Problem: The rebuild pipeline calls verifyPreparedDcodeRebuildImage() which only validates build context. There is no post-build verification of the capability file in the built image before the prepared image is marked ready for recreation.
  • Impact: A build that produces an image with the wrong capability file content would not be detected before the sandbox is recreated, potentially deploying an image with the wrong auto-approval mode.
  • Recommended action: Add post-build verification of the capability file in the built image, or ensure the enhanced verifyPreparedDcodeRebuildImage() (PRA-4 fix) is called at the appropriate pipeline stage. The verification should run after docker build completes and before the prepared image is marked as ready for recreation.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read rebuild-preflight-phase.ts around line 223 and confirm no post-build capability file verification occurs.
  • Missing regression test: Add a test that builds a DCode image with thread-opt-in, then mutates the capability file in the built image, and asserts the rebuild pipeline rejects the prepared image.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read rebuild-preflight-phase.ts around line 223 and confirm no post-build capability file verification occurs.
  • Evidence: prepareDcodeReplacementBeforeMutation calls verifyPreparedDcodeRebuildImage(buildContext) which only validates build context fingerprint.

PRA-16 Resolve/justify — verifyPreparedDcodeRebuildImage called but does not verify built image capability

  • Location: src/lib/actions/sandbox/rebuild-dcode-preflight.ts:223
  • Category: security
  • Problem: The prepareDcodeReplacementBeforeMutation function calls verifyPreparedDcodeRebuildImage(buildContext) at line 223 (in the revalidation step) but this only validates build context, not the built image's capability file. The same gap exists in revalidateDcodeReplacementAtMutationEdge.
  • Impact: Same as PRA-4: the preflight and mutation-edge revalidations do not catch a built image with the wrong capability file.
  • Recommended action: Fix verifyPreparedDcodeRebuildImage to validate the built image (PRA-4), which will automatically fix this call site.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read prepareDcodeReplacementBeforeMutation and revalidateDcodeReplacementAtMutationEdge in rebuild-dcode-preflight.ts and confirm they call verifyPreparedDcodeRebuildImage which only validates build context.
  • Missing regression test: See PRA-4's missing regression test.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read prepareDcodeReplacementBeforeMutation and revalidateDcodeReplacementAtMutationEdge in rebuild-dcode-preflight.ts and confirm they call verifyPreparedDcodeRebuildImage which only validates build context.
  • Evidence: Line 223: if (!verifyPreparedDcodeRebuildImage(buildContext) || !pinnedBase.verify()) { fail(...) }

PRA-17 Resolve/justify — Auto-approval warning message duplication between Python and TypeScript

  • Location: agents/langchain-deepagents-code/patch-managed-deepagents-code.py:1
  • Category: correctness
  • Problem: The auto-approval warning message "Tool calls, including shell commands, may execute without further confirmation inside the sandbox." is defined in patch-managed-deepagents-code.py (_NEMOCLAW_AUTO_APPROVAL_WARNING) and also appears in rebuild-preflight-confirmation.test.ts and likely in the TUI patch. If these drift, the warning shown in the TUI may not match the rebuild confirmation warning.
  • Impact: Inconsistent warning messages confuse operators and weaken audit trails.
  • Recommended action: Centralize the warning message in a single source (e.g., managed-dcode-runtime.py constants) and import it in both the Python patch and the TypeScript confirmation logic.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Search for the warning message string across the codebase and count occurrences.
  • Missing regression test: Add a test that asserts the warning message in the Python patch matches the TypeScript confirmation warning.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Search for the warning message string across the codebase and count occurrences.
  • Evidence: patch-managed-deepagents-code.py defines _NEMOCLAW_AUTO_APPROVAL_WARNING. rebuild-preflight-confirmation.test.ts expects 'including shell commands' in output. TUI patch uses same string.

PRA-18 Improvement — CLI examples missing --dcode-auto-approval disabled demonstration

  • Location: src/commands/sandbox/rebuild.ts:24
  • Category: docs
  • Problem: The examples array in RebuildCliCommand includes --dcode-auto-approval thread-opt-in but not --dcode-auto-approval disabled. Operators need to see how to disable the capability after enabling it.
  • Impact: Users may not discover how to return the sandbox to the default posture.
  • Suggested action: Add example '<%= config.bin %> sandbox rebuild my-dcode --yes --dcode-auto-approval disabled' to the static examples array in RebuildCliCommand.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read the examples array in rebuild.ts:24 and confirm no disabled example exists.
  • Missing regression test: Not applicable (documentation improvement).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Examples array shows: '<%= config.bin %> sandbox rebuild my-dcode --dcode-auto-approval thread-opt-in' but no disabled variant.

PRA-19 Improvement — Rebuild command documentation missing --dcode-auto-approval examples

  • Location: docs/reference/commands.mdx:2240
  • Category: docs
  • Problem: The commands.mdx documentation for rebuild includes --tool-disclosure and --observability examples but lacks --dcode-auto-approval examples for both disabled and thread-opt-in modes.
  • Impact: Operators consulting the reference documentation won't see usage examples for the new flag.
  • Suggested action: Add rebuild examples for --dcode-auto-approval disabled and --dcode-auto-approval thread-opt-in to commands.mdx documentation, similar to how --tool-disclosure and --observability are documented.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read the rebuild command documentation in commands.mdx and confirm no --dcode-auto-approval examples exist.
  • Missing regression test: Not applicable (documentation improvement).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Documentation shows --tool-disclosure and --observability examples but no --dcode-auto-approval.

PRA-20 Improvement — SandboxStateFlow coordinates 8+ feature domains — tracked architecture debt

  • Location: src/lib/onboard/machine/handlers/sandbox.ts:1
  • Category: architecture
  • Problem: The SandboxStateFlow handler coordinates onboarding, GPU, MCP, observability, tool disclosure, auto-approval, and other feature domains in a single monolithic handler. This is tracked architecture debt.
  • Impact: Adding new features increases complexity and coupling. Future refactoring should split into a pipeline of feature-specific handlers implementing a common interface.
  • Suggested action: Track follow-up refactor to split SandboxStateFlow into pipeline of feature-specific handlers implementing common interface. No immediate action required in this PR.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read sandbox.ts and observe the number of feature domains handled in SandboxStateFlow.
  • Missing regression test: Not applicable (architecture tracking item).
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: File is 832 lines; handles onboarding, GPU, MCP, observability, tool disclosure, auto-approval, and other domains in single handler.

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 Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 2 test follow-ups
Since last review: 1 prior item resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Acceptance clause
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 — If this PR is later used to close feat(dcode): allow explicit thread-scoped autorun in managed sandboxes #6478, add or identify Brev launchable embedded Deep Code terminal validation for `thread-opt-in`: enable the mode through named rebuild, activate auto-approval inside the embedded terminal, prove repeated shell and non-shell tool execution does not reprompt within the same thread, then prove `/clear` or a new thread returns to manual approval and status still reports only the configured capability.. This PR changes sandbox image construction, Bash/Python runtime launch boundaries, upstream DCode TUI monkeypatching, rebuild/onboard/status control flow, and live approval behavior. The committed unit, image-contract, direct-module, and live shell/Expect check evidence is well targeted for the current partial scope.
  • PRA-T2 Acceptance clause — The behavior works in the NemoClaw Brev launchable's embedded Deep Code terminal. — add test evidence or identify existing coverage. The previous advisor review recorded this issue-level clause. The current PR explicitly narrows scope as a partial fix and states that Brev launchable embedded-terminal validation remains outstanding; changed files add reusable live DCode TUI validation but do not change Brev launchable files or claim embedded-terminal evidence. Because the PR no longer claims to close the issue, the prior review warning is treated as addressed by scope clarification rather than a current code finding.

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.

@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 (10)
docs/get-started/quickstart-langchain-deepagents-code.mdx (1)

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

Prefer code formatting over bold for the literal menu label.

**Auto-approve for this thread** is a literal UI string. As per coding guidelines, "Use code formatting for commands, paths, flags, environment variables, file names, and literal values" and "Avoid ... unnecessary bold text," so this should likely use inline code instead of bold.

✏️ Proposed fix
-For each thread, select **Auto-approve for this thread** in the approval menu or start that `dcode` process with `dcode -y`.
+For each thread, select `Auto-approve for this thread` in the approval menu or start that `dcode` process with `dcode -y`.
🤖 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 `@docs/get-started/quickstart-langchain-deepagents-code.mdx` at line 153, The
inline UI label in the quickstart text uses bold formatting for a literal menu
item, which should be changed to code formatting instead. Update the sentence in
the doc content so the `Auto-approve for this thread` label is wrapped with
inline code rather than bold, while leaving the `dcode` command formatting
as-is; this is a localized markdown wording fix in the prose around the approval
menu instructions.

Source: Coding guidelines

docs/about/release-notes.mdx (1)

28-28: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inconsistent link style in the same sentence.

The first link uses an absolute route path (/user-guide/deepagents/get-started/quickstart) while the other three use relative dotted paths (../security/best-practices, etc.). As per coding guidelines, "Use route-style links without .mdx extensions for links between docs pages," so consider using one consistent style across all four links in this sentence.

✏️ Proposed fix (aligning to relative style used elsewhere in this doc)
-For more information, refer to [Quickstart with LangChain Deep Agents Code](/user-guide/deepagents/get-started/quickstart), [Security Best Practices](../security/best-practices), [Model Capability Audit](../inference/model-capability-audit), and [NemoClaw CLI Commands Reference](../reference/commands).
+For more information, refer to [Quickstart with LangChain Deep Agents Code](../get-started/quickstart-langchain-deepagents-code), [Security Best Practices](../security/best-practices), [Model Capability Audit](../inference/model-capability-audit), and [NemoClaw CLI Commands Reference](../reference/commands).
🤖 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 `@docs/about/release-notes.mdx` at line 28, The sentence in release notes mixes
route-style and relative links, so update the links in the same sentence to use
one consistent docs-link style. Adjust the Quickstart link in the release-notes
content to match the relative dotted-path style used by the other references,
and keep all four links consistent with the docs-link conventions used elsewhere
in this page.

Source: Coding guidelines

docs/inference/model-capability-audit.mdx (1)

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

Same bold-vs-code inconsistency as the quickstart doc.

**Auto-approve for this thread** should likely be inline code per the literal-value formatting rule, matching the same concern raised for the quickstart doc's identical phrase.

🤖 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 `@docs/inference/model-capability-audit.mdx` at line 84, The phrase
Auto-approve for this thread is formatted inconsistently with the literal-value
style used elsewhere; update the relevant table entry in the model-capability
audit doc so this UI label uses inline code formatting like the matching
quickstart reference. Keep the surrounding wording unchanged and align the
markup with the same literal-value convention used for other exact UI strings in
the document.

Source: Coding guidelines

src/lib/onboard/dcode-auto-approval.ts (1)

21-32: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate helper functions.

dcodeAutoApprovalModeOrDefault is a byte-for-byte alias of normalizeDcodeAutoApprovalMode (Line 31 just calls it). Callers use the two names interchangeably (e.g. sandbox-registration.ts calls normalizeDcodeAutoApprovalMode while this file's own hasDcodeAutoApprovalDrift calls dcodeAutoApprovalModeOrDefault), which invites confusion about whether they diverge.

♻️ Suggested consolidation
-export function dcodeAutoApprovalModeOrDefault(value: unknown): DcodeAutoApprovalMode {
-  return normalizeDcodeAutoApprovalMode(value);
-}
+// Reuse normalizeDcodeAutoApprovalMode directly; keeping one name avoids drift.
🤖 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/onboard/dcode-auto-approval.ts` around lines 21 - 32,
dcodeAutoApprovalModeOrDefault is just a duplicate wrapper around
normalizeDcodeAutoApprovalMode, so consolidate the two helpers into a single
source of truth. Remove the redundant alias or make every caller use
normalizeDcodeAutoApprovalMode consistently, and update
hasDcodeAutoApprovalDrift and any related references so the dcode-auto-approval
helpers in dcode-auto-approval.ts have one clear name and behavior.
src/lib/domain/lifecycle/options.ts (1)

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

Duplicated flag-parsing pattern across --tool-disclosure and --dcode-auto-approval.

The split/inline lookup, validation, and error-throwing logic (Lines 95-103 vs 104-121) is nearly identical for both flags. Extracting a shared parseStringFlag(options, flagName, isValid) helper would remove the duplication and make it easy to add future string flags without repeating this block.

♻️ Suggested helper
+function parseArrayFlagValue(options: string[], flagName: string): unknown {
+  const splitIndex = options.lastIndexOf(`--${flagName}`);
+  const inline = [...options].reverse().find((value) => value.startsWith(`--${flagName}=`));
+  if (splitIndex < 0 && inline === undefined) return undefined;
+  return splitIndex >= 0 ? options[splitIndex + 1] : inline?.slice(`--${flagName}=`.length);
+}
🤖 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 95 - 121, The parsing logic
for --tool-disclosure and --dcode-auto-approval is duplicated in options
parsing, so extract the repeated split/inline lookup, validation, and error
handling into a shared helper such as parseStringFlag in lifecycle/options.ts.
Update the existing option handling to use that helper for both
normalizeToolDisclosure and isDcodeAutoApprovalMode paths, keeping the current
validation messages and behavior intact while making it reusable for future
flags.
src/lib/actions/sandbox/rebuild-durable-config.ts (1)

131-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Growing positional-parameter list on resolveRebuildDurableConfig.

The function now takes 7 positional parameters, several optional (requestedToolDisclosure?, allowLegacyManagedImageRecovery = false, requestedDcodeAutoApprovalMode?). This pattern predates this PR but keeps growing; each future durable-config knob will add another positional slot, increasing the chance of misordered call sites (mitigated somewhat by distinct types, but not eliminated for same-typed additions).

Consider migrating to a single options object for the trailing optional parameters in a follow-up.

🤖 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-durable-config.ts` around lines 131 - 142,
`resolveRebuildDurableConfig` is accumulating trailing positional optional
parameters, which makes future call sites brittle and hard to extend. Refactor
the function to accept a single options object for the optional durable-config
knobs (such as `requestedToolDisclosure`, `allowLegacyManagedImageRecovery`, and
`requestedDcodeAutoApprovalMode`), and update the call sites to pass named
properties instead of relying on parameter order.
src/lib/onboard/machine/handlers/sandbox.ts (1)

419-491: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider consolidating repeated registry lookups.

getSandboxRegistryEntry(state.sandboxName) is now called separately in applyObservabilityRequest, applyDcodeAutoApprovalRequest, and again inside resolveResumeDecision for the same sandbox within a single run() invocation. Resolving it once in run() and threading it through would avoid the redundant lookups as this managed-feature pattern grows.

Also applies to: 533-587, 900-903

🤖 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/onboard/machine/handlers/sandbox.ts` around lines 419 - 491,
Consolidate the repeated sandbox registry lookup by resolving
getSandboxRegistryEntry(state.sandboxName) once per run() invocation and
threading the same registry entry through applyObservabilityRequest,
applyDcodeAutoApprovalRequest, and resolveResumeDecision. Use the existing
SandboxHandler flow and the
resolveResumeDecision/applyObservabilityRequest/applyDcodeAutoApprovalRequest
methods to pass the cached registryEntry instead of calling the dependency
repeatedly.
src/lib/actions/sandbox/rebuild-mcp-phase.ts (1)

72-88: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider consolidating optional positional args into a single options object.

printMcpRebuildRetryCommand now takes three sequential optional params (toolDisclosure, observability, dcodeAutoApproval), forcing callers to pass undefined placeholders to reach later ones (as done in the test file). Bundling these into a single options object would improve readability and make future additions safer, though this follows the file's existing pattern.

🤖 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-mcp-phase.ts` around lines 72 - 88,
`printMcpRebuildRetryCommand` currently uses multiple optional positional
parameters, which forces callers to pass placeholder undefined values to reach
later options. Refactor the signature to take a single options object that
groups `toolDisclosure`, `observability`, and `dcodeAutoApproval`, then update
the internal flag/arg handling and all call sites to pass named properties
instead of relying on argument position.
src/lib/onboard/command.test.ts (1)

113-127: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add coverage for the --from + thread-opt-in rejection path.

validateDcodeAutoApprovalAgent in command.ts (lines 156-171) has a fromDockerfile-aware branch that forces effectiveAgent to null (rejecting thread-opt-in) when a custom Dockerfile is supplied, even if --agent langchain-deepagents-code is also set. This is a security-relevant guard (preventing thread-opt-in on non-managed/custom images) but isn't exercised by any test in this file.

✅ Suggested additional test
+  it("rejects DCode thread opt-in when a custom Dockerfile is supplied", () => {
+    expect(() =>
+      resolve({
+        agent: "dcode",
+        from: "./Dockerfile.custom",
+        "dcode-auto-approval": "thread-opt-in",
+      }),
+    ).toThrow("exit:1");
+  });
🤖 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/onboard/command.test.ts` around lines 113 - 127, Add a test in
command.test.ts that exercises the fromDockerfile path in
validateDcodeAutoApprovalAgent by passing thread-opt-in together with a custom
--from Dockerfile and --agent langchain-deepagents-code; assert it is rejected
with the same exit:1 behavior. Use the resolve helper and the existing
knownAgents setup so the new case covers the fromDockerfile-aware branch that
forces effectiveAgent to null.
test/e2e/support/platform-parity-cloud-experimental.test.ts (1)

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

Make the tclsh gate visible on CI
it.runIf(tclshAvailable) can drop the only coverage for the marker-ordering / keystroke sequence without any signal when tclsh isn’t installed. Add an explicit CI check or a warning/summary note so the missing prerequisite doesn’t silently erase this test path.

🤖 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/e2e/support/platform-parity-cloud-experimental.test.ts` around lines 42
- 44, The tclsh availability gate in the platform-parity test is currently
silent, so when tclsh is missing CI can skip the only marker-ordering/keystroke
coverage without any signal. Update the test setup around tclshAvailable and
it.runIf to emit an explicit CI-visible warning or summary note when the
prerequisite is absent, or add a dedicated CI check that reports the missing
dependency instead of silently skipping the path.
🤖 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 `@docs/about/release-notes.mdx`:
- Line 28: The sentence in release notes mixes route-style and relative links,
so update the links in the same sentence to use one consistent docs-link style.
Adjust the Quickstart link in the release-notes content to match the relative
dotted-path style used by the other references, and keep all four links
consistent with the docs-link conventions used elsewhere in this page.

In `@docs/get-started/quickstart-langchain-deepagents-code.mdx`:
- Line 153: The inline UI label in the quickstart text uses bold formatting for
a literal menu item, which should be changed to code formatting instead. Update
the sentence in the doc content so the `Auto-approve for this thread` label is
wrapped with inline code rather than bold, while leaving the `dcode` command
formatting as-is; this is a localized markdown wording fix in the prose around
the approval menu instructions.

In `@docs/inference/model-capability-audit.mdx`:
- Line 84: The phrase Auto-approve for this thread is formatted inconsistently
with the literal-value style used elsewhere; update the relevant table entry in
the model-capability audit doc so this UI label uses inline code formatting like
the matching quickstart reference. Keep the surrounding wording unchanged and
align the markup with the same literal-value convention used for other exact UI
strings in the document.

In `@src/lib/actions/sandbox/rebuild-durable-config.ts`:
- Around line 131-142: `resolveRebuildDurableConfig` is accumulating trailing
positional optional parameters, which makes future call sites brittle and hard
to extend. Refactor the function to accept a single options object for the
optional durable-config knobs (such as `requestedToolDisclosure`,
`allowLegacyManagedImageRecovery`, and `requestedDcodeAutoApprovalMode`), and
update the call sites to pass named properties instead of relying on parameter
order.

In `@src/lib/actions/sandbox/rebuild-mcp-phase.ts`:
- Around line 72-88: `printMcpRebuildRetryCommand` currently uses multiple
optional positional parameters, which forces callers to pass placeholder
undefined values to reach later options. Refactor the signature to take a single
options object that groups `toolDisclosure`, `observability`, and
`dcodeAutoApproval`, then update the internal flag/arg handling and all call
sites to pass named properties instead of relying on argument position.

In `@src/lib/domain/lifecycle/options.ts`:
- Around line 95-121: The parsing logic for --tool-disclosure and
--dcode-auto-approval is duplicated in options parsing, so extract the repeated
split/inline lookup, validation, and error handling into a shared helper such as
parseStringFlag in lifecycle/options.ts. Update the existing option handling to
use that helper for both normalizeToolDisclosure and isDcodeAutoApprovalMode
paths, keeping the current validation messages and behavior intact while making
it reusable for future flags.

In `@src/lib/onboard/command.test.ts`:
- Around line 113-127: Add a test in command.test.ts that exercises the
fromDockerfile path in validateDcodeAutoApprovalAgent by passing thread-opt-in
together with a custom --from Dockerfile and --agent langchain-deepagents-code;
assert it is rejected with the same exit:1 behavior. Use the resolve helper and
the existing knownAgents setup so the new case covers the fromDockerfile-aware
branch that forces effectiveAgent to null.

In `@src/lib/onboard/dcode-auto-approval.ts`:
- Around line 21-32: dcodeAutoApprovalModeOrDefault is just a duplicate wrapper
around normalizeDcodeAutoApprovalMode, so consolidate the two helpers into a
single source of truth. Remove the redundant alias or make every caller use
normalizeDcodeAutoApprovalMode consistently, and update
hasDcodeAutoApprovalDrift and any related references so the dcode-auto-approval
helpers in dcode-auto-approval.ts have one clear name and behavior.

In `@src/lib/onboard/machine/handlers/sandbox.ts`:
- Around line 419-491: Consolidate the repeated sandbox registry lookup by
resolving getSandboxRegistryEntry(state.sandboxName) once per run() invocation
and threading the same registry entry through applyObservabilityRequest,
applyDcodeAutoApprovalRequest, and resolveResumeDecision. Use the existing
SandboxHandler flow and the
resolveResumeDecision/applyObservabilityRequest/applyDcodeAutoApprovalRequest
methods to pass the cached registryEntry instead of calling the dependency
repeatedly.

In `@test/e2e/support/platform-parity-cloud-experimental.test.ts`:
- Around line 42-44: The tclsh availability gate in the platform-parity test is
currently silent, so when tclsh is missing CI can skip the only
marker-ordering/keystroke coverage without any signal. Update the test setup
around tclshAvailable and it.runIf to emit an explicit CI-visible warning or
summary note when the prerequisite is absent, or add a dedicated CI check that
reports the missing dependency instead of silently skipping the path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 829682c7-6387-4d70-a971-804860e04b13

📥 Commits

Reviewing files that changed from the base of the PR and between d45a62a and f60109a.

📒 Files selected for processing (91)
  • agents/langchain-deepagents-code/Dockerfile
  • agents/langchain-deepagents-code/dcode-launcher.sh
  • agents/langchain-deepagents-code/dcode-wrapper.sh
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • agents/langchain-deepagents-code/start.sh
  • docs/about/release-notes.mdx
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • docs/inference/model-capability-audit.mdx
  • docs/reference/commands.mdx
  • docs/security/best-practices.mdx
  • src/commands/sandbox/oclif-command-adapters.test.ts
  • src/commands/sandbox/rebuild.ts
  • src/lib/actions/sandbox/rebuild-dcode-mutation-edge.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-orchestrator.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-orchestrator.ts
  • src/lib/actions/sandbox/rebuild-dcode-pre-delete-drift.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-preflight.ts
  • src/lib/actions/sandbox/rebuild-durable-config.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.test.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/rebuild-managed-image-configuration.test.ts
  • src/lib/actions/sandbox/rebuild-managed-image-preflight.ts
  • src/lib/actions/sandbox/rebuild-mcp-phase.test.ts
  • src/lib/actions/sandbox/rebuild-mcp-phase.ts
  • src/lib/actions/sandbox/rebuild-pipeline.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.test.ts
  • src/lib/actions/sandbox/rebuild-preflight-confirmation.ts
  • src/lib/actions/sandbox/rebuild-preflight-phase.ts
  • src/lib/actions/sandbox/rebuild-preflight-target-phase.ts
  • src/lib/actions/sandbox/rebuild-recreate-observability.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/actions/sandbox/rebuild-target-config.ts
  • src/lib/actions/sandbox/status-flow.test.ts
  • src/lib/actions/sandbox/status-snapshot.ts
  • src/lib/actions/sandbox/status-text.ts
  • src/lib/actions/sandbox/status.test.ts
  • src/lib/actions/sandbox/status.ts
  • src/lib/domain/lifecycle/options.test.ts
  • src/lib/domain/lifecycle/options.ts
  • src/lib/onboard.ts
  • src/lib/onboard/command-support.ts
  • src/lib/onboard/command.test.ts
  • src/lib/onboard/command.ts
  • src/lib/onboard/dcode-auto-approval.test.ts
  • src/lib/onboard/dcode-auto-approval.ts
  • src/lib/onboard/dockerfile-patch-dcode-auto-approval.test.ts
  • src/lib/onboard/dockerfile-patch.ts
  • src/lib/onboard/machine/core-flow-phases.ts
  • src/lib/onboard/machine/handlers/sandbox-dcode-selection.test.ts
  • src/lib/onboard/machine/handlers/sandbox-resume.test.ts
  • src/lib/onboard/machine/handlers/sandbox-resume.ts
  • src/lib/onboard/machine/handlers/sandbox-tool-disclosure.test.ts
  • src/lib/onboard/machine/handlers/sandbox.test.ts
  • src/lib/onboard/machine/handlers/sandbox.ts
  • src/lib/onboard/prepared-dcode-rebuild.test.ts
  • src/lib/onboard/prepared-dcode-rebuild.ts
  • src/lib/onboard/resume-config.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/sandbox-create-launch-observability.test.ts
  • src/lib/onboard/sandbox-dockerfile-patch-flow.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/onboard/session-bootstrap.test.ts
  • src/lib/onboard/session-bootstrap.ts
  • src/lib/onboard/session-updates.ts
  • src/lib/onboard/types.ts
  • src/lib/registry-recovery-action.test.ts
  • src/lib/registry-recovery-action.ts
  • src/lib/state/onboard-session-dcode-auto-approval.ts
  • src/lib/state/onboard-session.test.ts
  • src/lib/state/onboard-session.ts
  • src/lib/state/registry.ts
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • test/e2e/live/cloud-experimental-check-list.ts
  • test/e2e/live/cloud-experimental-checks.ts
  • test/e2e/support/platform-parity-cloud-experimental.test.ts
  • test/helpers/langchain-deepagents-code-patch-fixture.ts
  • test/helpers/rebuild-managed-image-preflight-harness.ts
  • test/langchain-deepagents-code-auto-approval-image.test.ts
  • test/langchain-deepagents-code-direct-module-patch.test.ts
  • test/langchain-deepagents-code-image.test.ts
  • test/langchain-deepagents-code-managed-entrypoints.test.ts
  • test/langchain-deepagents-code-progressive-tool-disclosure.test.ts
  • test/onboard-prepared-gateway-handoff.test.ts
  • test/onboard-terminal-dashboard.test.ts
  • test/support/status-flow-test-harness.ts

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

Security/acceptance blocker at exact head f60109ad3c6c62a3b0190364fa3cf8886d9f66de:

_nemoclaw_restart_server_for_agent_swap clears thread auto-approval only when the post-swap thread_id is non-null and differs from the previous ID. The agent transition itself is an approval boundary; if upstream preserves/reuses an ID, leaves it None, or raises after partially changing state, _auto_approve, session_state.auto_approve, and approval_mode_key can remain enabled across the agent transition. /clear//force-clear and _resume_thread use the same non-null/different-ID condition, so their failure/edge paths are also not fail-closed. This violates #6478's explicit new-thread/session reset guarantee.

Please make transition handling fail closed at the boundary and add focused regressions for same-ID, None, and exceptional agent-swap outcomes plus /clear, /force-clear, thread resume/switch, and new-process behavior. The enabled -> disabled rollback also needs a direct test proving the managed wrapper/runtime denies --auto-approve after rebuild.

Release acceptance is independently incomplete: #6478 explicitly requires the Brev launchable embedded terminal, but the current evidence covers only the cloud-experimental DCode path. Please provide current-head launchable evidence for enable, visible warning/status, repeated tool rounds, reset in a new thread/session, and disable/denial. The current codebase-growth failure and dirty base also need resolution before re-review.

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

cjagwani commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@jyaunches @wscurran Release disposition needed: this is currently not safe to waive into v0.0.78. Exact head has a concrete approval-reset fail-open, lacks enabled-to-disabled rollback proof, lacks the issue's required Brev embedded-terminal acceptance, fails growth guardrails, and is behind main. These are part of the security contract, not cosmetic advisor items.

If this feature is a hard v0.0.78 gate, please keep it in the release and address the requested-change review plus current-head launchable evidence. Otherwise I recommend moving both #6486 and #6478 to v0.0.79 so v0.0.78 is not held on a late security-boundary feature or shipped with acceptance waived. Please confirm which disposition the release should use.

jyaunches added 2 commits July 8, 2026 15:46
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@cjagwani

cjagwani commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Exact-head follow-up for 42c4e29e0037ad294d29a62f7acc4abe6a1eb22c:

The scope reduction is useful: it removes substantial host-side duplication, should address the growth failure, and the cloud E2E now proves thread-opt-in -> disabled rollback through the named rebuild interface.

The security blocker remains unchanged in _nemoclaw_run_thread_transition: reset still occurs only when the post-operation thread ID is non-null and differs. The new fixture at test/langchain-deepagents-code-direct-module-patch.test.ts explicitly expects early /clear, resume, and agent-swap failure paths to retain active auto-approval, and still has no same-ID or None transition coverage. A real upstream operation can partially change agent/session state before returning or raising without yielding a distinct non-null thread ID, so this remains fail-open across an approval boundary.

Please reset before invoking each boundary operation (or otherwise guarantee reset in finally regardless of thread-ID shape), then prove same-ID, None, and exceptional outcomes for clear/force-clear, resume/switch, and agent swap. The Brev embedded-terminal acceptance from #6478 also remains outstanding. My change request therefore stays in place.

@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: 4

Caution

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

⚠️ Outside diff range comments (2)
src/lib/onboard/machine/handlers/sandbox.test.ts (1)

164-227: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

New tests don't cover the resume-without-explicit-flag scenario.

All three new tests here set an explicit requestedDcodeAutoApprovalMode ("thread-opt-in") or leave both requested/recorded at defaults; none cover resuming with a previously recorded "thread-opt-in" while requestedDcodeAutoApprovalMode is omitted. See the related comment on src/lib/onboard/dcode-auto-approval.ts (Lines 43-67) for why this matters — the root-cause fix/verification belongs there, but adding a test here (asserting createSandbox receives dcodeAutoApprovalMode: "disabled" and/or that resume forces a reset) would close the coverage gap at this public boundary.

🤖 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/onboard/machine/handlers/sandbox.test.ts` around lines 164 - 227, Add
a regression test in sandbox.test around handleSandboxState for the
resume-without-explicit-flag case: resume an existing session whose recorded
DCode mode is "thread-opt-in" while requestedDcodeAutoApprovalMode is omitted.
Verify the resume path does not reuse the recorded mode and that createSandbox
is called with dcodeAutoApprovalMode set to "disabled" (or otherwise confirms
the sandbox is reset), using the existing createSandbox, updateSession, and
dcodeRegistryEntry helpers to locate the behavior.

Source: Path instructions

src/lib/onboard/dcode-auto-approval.test.ts (1)

4-15: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing unit coverage for resolveDcodeAutoApprovalRequest, including the resume-without-flag persistence case.

This file never imports or exercises resolveDcodeAutoApprovalRequest — the function that actually gates whether a thread's auto-approval mode is honored. Given the module's other functions are thoroughly unit-tested here, this is a notable gap, especially for the scenario where requestedMode is undefined/omitted but recordedMode is "thread-opt-in" from a prior session (i.e., resume/rebuild without re-passing --dcode-auto-approval thread-opt-in). That is precisely the case the PR requirement "do not silently persist it across sessions or rebuilds" targets, and it remains unverified anywhere in this cohort (see related comment on dcode-auto-approval.ts Lines 43-67).

As per path instructions for src/lib/{onboard.ts,onboard/**,...}, resume/repair paths must be proven idempotent and covered at the public boundary — add a test asserting resolveDcodeAutoApprovalRequest returns "disabled" (not the recorded value) when no explicit request is supplied.

Also applies to: 69-108

🤖 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/onboard/dcode-auto-approval.test.ts` around lines 4 - 15, Add unit
coverage for resolveDcodeAutoApprovalRequest in dcode-auto-approval.test.ts,
since it is currently not imported or exercised. Write a test for the
resume/rebuild case where requestedMode is omitted or undefined and recordedMode
is "thread-opt-in", and assert the function returns "disabled" instead of
persisting the recorded value. Use the existing dcodeAutoApprovalModeOrDefault,
normalizeDcodeAutoApprovalMode, and resolveDcodeAutoApprovalRequest symbols to
place the new assertions alongside the other mode-resolution tests.

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 `@docs/reference/commands.mdx`:
- Line 201: Update the `--resume` documentation in `commands.mdx` so it also
mentions the recorded DCode auto-approval mode alongside the provider, model,
sandbox name, agent, observability choice, and custom Dockerfile path. If the
intent is to avoid expanding the sentence, clarify that this setting is restored
from the saved registry entry; otherwise add it directly to the resumable
session state list in the `--resume` description.

In `@src/lib/onboard/dcode-auto-approval.ts`:
- Around line 105-132: `prepareDcodeAutoApprovalCreatePlan` should fail closed
if `deps.exitProcess(1)` does not actually terminate, because both validation
branches can otherwise fall through and return a plan from invalid state. After
each `exitProcess(1)` call in this function, add a defensive `throw` so behavior
matches the guarded pattern used in `failGatewayRouteCheck` and cannot continue
under a non-throwing `exitProcess` implementation.
- Around line 43-67: resolveDcodeAutoApprovalRequest is silently inheriting the
recorded DCode auto-approval mode when requestedMode is missing because
resolveManagedSandboxFeature still receives registryValue from recordedMode.
Update this resolver so recorded state is only reused when the request
explicitly opted in, or thread the resume/rebuild provenance through the call
and treat null requestedMode as no opt-in. Add a test around
resolveDcodeAutoApprovalRequest covering requestedMode null with recordedMode
thread-opt-in to ensure it does not carry forward automatically.

In `@test/e2e/support/platform-parity-cloud-experimental.test.ts`:
- Around line 272-278: The test in platform-parity-cloud-experimental has
regressed from behavior verification to a syntax-only check. Keep the bash parse
check if useful, but also restore an assertion that exercises the actual
thread-auto-approval behavior in 12-deepagents-code-thread-auto-approval.sh,
such as validating the is_default_auto_approval_denial classification or
matching the expected spawnSync output/exit behavior. Use the existing
scriptPath and spawnSync-based flow to ensure the test still guards the
fail-closed logic instead of only confirming valid Bash syntax.

---

Outside diff comments:
In `@src/lib/onboard/dcode-auto-approval.test.ts`:
- Around line 4-15: Add unit coverage for resolveDcodeAutoApprovalRequest in
dcode-auto-approval.test.ts, since it is currently not imported or exercised.
Write a test for the resume/rebuild case where requestedMode is omitted or
undefined and recordedMode is "thread-opt-in", and assert the function returns
"disabled" instead of persisting the recorded value. Use the existing
dcodeAutoApprovalModeOrDefault, normalizeDcodeAutoApprovalMode, and
resolveDcodeAutoApprovalRequest symbols to place the new assertions alongside
the other mode-resolution tests.

In `@src/lib/onboard/machine/handlers/sandbox.test.ts`:
- Around line 164-227: Add a regression test in sandbox.test around
handleSandboxState for the resume-without-explicit-flag case: resume an existing
session whose recorded DCode mode is "thread-opt-in" while
requestedDcodeAutoApprovalMode is omitted. Verify the resume path does not reuse
the recorded mode and that createSandbox is called with dcodeAutoApprovalMode
set to "disabled" (or otherwise confirms the sandbox is reset), using the
existing createSandbox, updateSession, and dcodeRegistryEntry helpers to locate
the behavior.
🪄 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: 1675f570-cec9-414a-8e5e-1c5c43c8ace4

📥 Commits

Reviewing files that changed from the base of the PR and between 9b79edd and 42c4e29.

📒 Files selected for processing (23)
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • docs/about/release-notes.mdx
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • docs/inference/model-capability-audit.mdx
  • docs/reference/commands.mdx
  • docs/security/best-practices.mdx
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/onboard.ts
  • src/lib/onboard/dcode-auto-approval.test.ts
  • src/lib/onboard/dcode-auto-approval.ts
  • src/lib/onboard/machine/handlers/sandbox.test.ts
  • src/lib/onboard/machine/handlers/sandbox.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/sandbox-registration.test.ts
  • src/lib/onboard/sandbox-registration.ts
  • src/lib/onboard/types.ts
  • src/lib/state/registry.ts
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • test/e2e/support/platform-parity-cloud-experimental.test.ts
💤 Files with no reviewable changes (3)
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
✅ Files skipped from review due to trivial changes (2)
  • docs/about/release-notes.mdx
  • docs/inference/model-capability-audit.mdx
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/lib/actions/sandbox/rebuild-durable-config.test.ts
  • src/lib/onboard/sandbox-registration.ts
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • docs/security/best-practices.mdx
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (2)
src/lib/onboard/machine/handlers/sandbox.test.ts (1)

164-227: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

New tests don't cover the resume-without-explicit-flag scenario.

All three new tests here set an explicit requestedDcodeAutoApprovalMode ("thread-opt-in") or leave both requested/recorded at defaults; none cover resuming with a previously recorded "thread-opt-in" while requestedDcodeAutoApprovalMode is omitted. See the related comment on src/lib/onboard/dcode-auto-approval.ts (Lines 43-67) for why this matters — the root-cause fix/verification belongs there, but adding a test here (asserting createSandbox receives dcodeAutoApprovalMode: "disabled" and/or that resume forces a reset) would close the coverage gap at this public boundary.

🤖 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/onboard/machine/handlers/sandbox.test.ts` around lines 164 - 227, Add
a regression test in sandbox.test around handleSandboxState for the
resume-without-explicit-flag case: resume an existing session whose recorded
DCode mode is "thread-opt-in" while requestedDcodeAutoApprovalMode is omitted.
Verify the resume path does not reuse the recorded mode and that createSandbox
is called with dcodeAutoApprovalMode set to "disabled" (or otherwise confirms
the sandbox is reset), using the existing createSandbox, updateSession, and
dcodeRegistryEntry helpers to locate the behavior.

Source: Path instructions

src/lib/onboard/dcode-auto-approval.test.ts (1)

4-15: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing unit coverage for resolveDcodeAutoApprovalRequest, including the resume-without-flag persistence case.

This file never imports or exercises resolveDcodeAutoApprovalRequest — the function that actually gates whether a thread's auto-approval mode is honored. Given the module's other functions are thoroughly unit-tested here, this is a notable gap, especially for the scenario where requestedMode is undefined/omitted but recordedMode is "thread-opt-in" from a prior session (i.e., resume/rebuild without re-passing --dcode-auto-approval thread-opt-in). That is precisely the case the PR requirement "do not silently persist it across sessions or rebuilds" targets, and it remains unverified anywhere in this cohort (see related comment on dcode-auto-approval.ts Lines 43-67).

As per path instructions for src/lib/{onboard.ts,onboard/**,...}, resume/repair paths must be proven idempotent and covered at the public boundary — add a test asserting resolveDcodeAutoApprovalRequest returns "disabled" (not the recorded value) when no explicit request is supplied.

Also applies to: 69-108

🤖 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/onboard/dcode-auto-approval.test.ts` around lines 4 - 15, Add unit
coverage for resolveDcodeAutoApprovalRequest in dcode-auto-approval.test.ts,
since it is currently not imported or exercised. Write a test for the
resume/rebuild case where requestedMode is omitted or undefined and recordedMode
is "thread-opt-in", and assert the function returns "disabled" instead of
persisting the recorded value. Use the existing dcodeAutoApprovalModeOrDefault,
normalizeDcodeAutoApprovalMode, and resolveDcodeAutoApprovalRequest symbols to
place the new assertions alongside the other mode-resolution tests.

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 `@docs/reference/commands.mdx`:
- Line 201: Update the `--resume` documentation in `commands.mdx` so it also
mentions the recorded DCode auto-approval mode alongside the provider, model,
sandbox name, agent, observability choice, and custom Dockerfile path. If the
intent is to avoid expanding the sentence, clarify that this setting is restored
from the saved registry entry; otherwise add it directly to the resumable
session state list in the `--resume` description.

In `@src/lib/onboard/dcode-auto-approval.ts`:
- Around line 105-132: `prepareDcodeAutoApprovalCreatePlan` should fail closed
if `deps.exitProcess(1)` does not actually terminate, because both validation
branches can otherwise fall through and return a plan from invalid state. After
each `exitProcess(1)` call in this function, add a defensive `throw` so behavior
matches the guarded pattern used in `failGatewayRouteCheck` and cannot continue
under a non-throwing `exitProcess` implementation.
- Around line 43-67: resolveDcodeAutoApprovalRequest is silently inheriting the
recorded DCode auto-approval mode when requestedMode is missing because
resolveManagedSandboxFeature still receives registryValue from recordedMode.
Update this resolver so recorded state is only reused when the request
explicitly opted in, or thread the resume/rebuild provenance through the call
and treat null requestedMode as no opt-in. Add a test around
resolveDcodeAutoApprovalRequest covering requestedMode null with recordedMode
thread-opt-in to ensure it does not carry forward automatically.

In `@test/e2e/support/platform-parity-cloud-experimental.test.ts`:
- Around line 272-278: The test in platform-parity-cloud-experimental has
regressed from behavior verification to a syntax-only check. Keep the bash parse
check if useful, but also restore an assertion that exercises the actual
thread-auto-approval behavior in 12-deepagents-code-thread-auto-approval.sh,
such as validating the is_default_auto_approval_denial classification or
matching the expected spawnSync output/exit behavior. Use the existing
scriptPath and spawnSync-based flow to ensure the test still guards the
fail-closed logic instead of only confirming valid Bash syntax.

---

Outside diff comments:
In `@src/lib/onboard/dcode-auto-approval.test.ts`:
- Around line 4-15: Add unit coverage for resolveDcodeAutoApprovalRequest in
dcode-auto-approval.test.ts, since it is currently not imported or exercised.
Write a test for the resume/rebuild case where requestedMode is omitted or
undefined and recordedMode is "thread-opt-in", and assert the function returns
"disabled" instead of persisting the recorded value. Use the existing
dcodeAutoApprovalModeOrDefault, normalizeDcodeAutoApprovalMode, and
resolveDcodeAutoApprovalRequest symbols to place the new assertions alongside
the other mode-resolution tests.

In `@src/lib/onboard/machine/handlers/sandbox.test.ts`:
- Around line 164-227: Add a regression test in sandbox.test around
handleSandboxState for the resume-without-explicit-flag case: resume an existing
session whose recorded DCode mode is "thread-opt-in" while
requestedDcodeAutoApprovalMode is omitted. Verify the resume path does not reuse
the recorded mode and that createSandbox is called with dcodeAutoApprovalMode
set to "disabled" (or otherwise confirms the sandbox is reset), using the
existing createSandbox, updateSession, and dcodeRegistryEntry helpers to locate
the behavior.
🪄 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: 1675f570-cec9-414a-8e5e-1c5c43c8ace4

📥 Commits

Reviewing files that changed from the base of the PR and between 9b79edd and 42c4e29.

📒 Files selected for processing (23)
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • docs/about/release-notes.mdx
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • docs/inference/model-capability-audit.mdx
  • docs/reference/commands.mdx
  • docs/security/best-practices.mdx
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
  • src/lib/onboard.ts
  • src/lib/onboard/dcode-auto-approval.test.ts
  • src/lib/onboard/dcode-auto-approval.ts
  • src/lib/onboard/machine/handlers/sandbox.test.ts
  • src/lib/onboard/machine/handlers/sandbox.ts
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/onboard/runtime-control-flow.ts
  • src/lib/onboard/sandbox-registration.test.ts
  • src/lib/onboard/sandbox-registration.ts
  • src/lib/onboard/types.ts
  • src/lib/state/registry.ts
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • test/e2e/support/platform-parity-cloud-experimental.test.ts
💤 Files with no reviewable changes (3)
  • src/lib/onboard/runtime-control-flow.test.ts
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-recreate-phase.ts
✅ Files skipped from review due to trivial changes (2)
  • docs/about/release-notes.mdx
  • docs/inference/model-capability-audit.mdx
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/lib/actions/sandbox/rebuild-durable-config.test.ts
  • src/lib/onboard/sandbox-registration.ts
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • docs/security/best-practices.mdx
  • test/e2e/e2e-cloud-experimental/checks/12-deepagents-code-thread-auto-approval.sh
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
🛑 Comments failed to post (4)
docs/reference/commands.mdx (1)

201-201: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check whether onboarding session state persists dcodeAutoApprovalMode across resume.
rg -nP -C3 'dcodeAutoApprovalMode' src/lib/onboard/runtime-control-flow.ts src/lib/onboard/types.ts src/lib/state 2>/dev/null

Repository: NVIDIA/NemoClaw

Length of output: 3758


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant docs sections around the resume wording and the rebuild section.
sed -n '180,220p' docs/reference/commands.mdx
printf '\n----\n'
sed -n '2280,2325p' docs/reference/commands.mdx
printf '\n----\n'

# Find every mention of the auto-approval mode in this doc.
rg -n 'dcodeAutoApprovalMode|auto-approval|auto approval|--resume' docs/reference/commands.mdx

Repository: NVIDIA/NemoClaw

Length of output: 10997


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the onboarding session/state flow for resume handling and persisted DCode auto-approval mode.
sed -n '1,220p' src/lib/onboard/runtime-control-flow.ts
printf '\n----\n'
sed -n '1,220p' src/lib/onboard/types.ts
printf '\n----\n'
rg -n -C3 'requestedDcodeAutoApprovalMode|dcodeAutoApprovalMode|resume' src/lib/onboard src/lib/state

Repository: NVIDIA/NemoClaw

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read only the small relevant slices around the saved-session projection and resume handling.
wc -l src/lib/onboard/runtime-control-flow.ts src/lib/onboard/types.ts src/lib/state/registry.ts src/lib/state/onboard-session.ts
printf '\n---- runtime-control-flow ----\n'
sed -n '1,140p' src/lib/onboard/runtime-control-flow.ts
printf '\n---- onboard-session ----\n'
sed -n '1,220p' src/lib/state/onboard-session.ts
printf '\n---- registry ----\n'
sed -n '90,140p' src/lib/state/registry.ts

Repository: NVIDIA/NemoClaw

Length of output: 15532


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find every persistence/read path for DCode auto-approval in the onboarding session and registry flow.
rg -n -C3 'dcodeAutoApprovalMode|requestedDcodeAutoApprovalMode|auto-approval' src/lib/onboard src/lib/state docs/reference/commands.mdx

printf '\n---- session write/read slices ----\n'
sed -n '520,660p' src/lib/state/onboard-session.ts
printf '\n---- registry write/read slices ----\n'
sed -n '460,540p' src/lib/state/registry.ts
printf '\n---- runtime control slices ----\n'
sed -n '1,120p' src/lib/onboard/runtime-control-flow.ts

Repository: NVIDIA/NemoClaw

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the resume-related DCode auto-approval logic in the sandbox handler.
sed -n '440,545p' src/lib/onboard/machine/handlers/sandbox.ts
printf '\n----\n'
sed -n '700,740p' src/lib/onboard/machine/handlers/sandbox.ts
printf '\n----\n'
rg -n 'dcodeAutoApprovalMode' src/lib/state/onboard-session.ts src/lib/onboard/machine/handlers/sandbox.ts

Repository: NVIDIA/NemoClaw

Length of output: 7241


Add DCode auto-approval mode to the --resume list.
docs/reference/commands.mdx:201 --resume also preserves the recorded DCode auto-approval mode, so include it in the list or clarify that this state comes from the saved registry entry.

🤖 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 `@docs/reference/commands.mdx` at line 201, Update the `--resume` documentation
in `commands.mdx` so it also mentions the recorded DCode auto-approval mode
alongside the provider, model, sandbox name, agent, observability choice, and
custom Dockerfile path. If the intent is to avoid expanding the sentence,
clarify that this setting is restored from the saved registry entry; otherwise
add it directly to the resumable session state list in the `--resume`
description.
src/lib/onboard/dcode-auto-approval.ts (2)

43-67: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate resolveManagedSandboxFeature's implementation to confirm requested-absent fallback behavior.
rg -nP --type=ts -C 20 'export function resolveManagedSandboxFeature'

Repository: NVIDIA/NemoClaw

Length of output: 153


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== locate symbols ==\n'
rg -n "resolveManagedSandboxFeature|resolveDcodeAutoApprovalRequest|dcode-auto-approval.test|DCODE_AUTO_APPROVAL_FEATURE|DCODE_OBSERVABILITY_FEATURE" src test .

printf '\n== file list ==\n'
git ls-files 'src/lib/**' | rg 'sandbox|dcode|observ'

printf '\n== inspect dcode auto approval ==\n'
sed -n '1,220p' src/lib/onboard/dcode-auto-approval.ts

printf '\n== inspect dcode auto approval tests ==\n'
sed -n '1,260p' src/lib/onboard/dcode-auto-approval.test.ts

printf '\n== inspect sandbox resolution implementation ==\n'
sed -n '1,260p' src/lib/adapters/sandbox.ts

printf '\n== inspect sandbox tests around resolution ==\n'
sed -n '1,320p' src/lib/adapters/sandbox.test.ts

Repository: NVIDIA/NemoClaw

Length of output: 40478


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== managed-sandbox-feature implementation ==\n'
sed -n '1,240p' src/lib/onboard/managed-sandbox-feature.ts

printf '\n== managed-sandbox-feature tests ==\n'
sed -n '1,220p' src/lib/onboard/managed-sandbox-feature.test.ts

printf '\n== sandbox handler around observability and dcode resolution ==\n'
sed -n '450,580p' src/lib/onboard/machine/handlers/sandbox.ts

printf '\n== dcode resume bridge ==\n'
sed -n '1,260p' src/lib/onboard/machine/handlers/sandbox-dcode-resume.ts

printf '\n== sandbox resume tests referencing dcode ==\n'
sed -n '1,260p' src/lib/onboard/machine/handlers/sandbox-resume.test.ts

printf '\n== sandbox handler tests around dcode ==\n'
sed -n '1,260p' src/lib/onboard/machine/handlers/sandbox.test.ts

Repository: NVIDIA/NemoClaw

Length of output: 30922


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== dcode auto approval usages in tests ==\n'
rg -n "requestedDcodeAutoApprovalMode|dcodeAutoApprovalMode|thread-opt-in|resolveDcodeAutoApprovalRequest|preserves recorded observability" src/lib/onboard -g '*test.ts'

printf '\n== sandbox test continuation around observability and dcode ==\n'
sed -n '260,420p' src/lib/onboard/machine/handlers/sandbox.test.ts

printf '\n== sandbox handler dcode-specific section ==\n'
sed -n '520,720p' src/lib/onboard/machine/handlers/sandbox.test.ts

Repository: NVIDIA/NemoClaw

Length of output: 16461


Block silent inheritance of recorded DCode auto-approval
src/lib/onboard/dcode-auto-approval.ts:43-67 resolveManagedSandboxFeature falls back to registryValue when requestedMode is absent, so a resume/rebuild can carry thread-opt-in forward from the prior registry row without a new opt-in flag. Thread resume provenance through this resolver or ignore the recorded mode unless the request was explicit. Add coverage for requestedMode = null with recordedMode = "thread-opt-in".

🤖 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/onboard/dcode-auto-approval.ts` around lines 43 - 67,
resolveDcodeAutoApprovalRequest is silently inheriting the recorded DCode
auto-approval mode when requestedMode is missing because
resolveManagedSandboxFeature still receives registryValue from recordedMode.
Update this resolver so recorded state is only reused when the request
explicitly opted in, or thread the resume/rebuild provenance through the call
and treat null requestedMode as no opt-in. Add a test around
resolveDcodeAutoApprovalRequest covering requestedMode null with recordedMode
thread-opt-in to ensure it does not carry forward automatically.

Source: Path instructions


105-132: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Add a defensive throw after exitProcess(1) to guarantee fail-closed behavior.

Both validation blocks call deps.exitProcess(1) without following it with a throw/return, unlike sandbox.ts's failGatewayRouteCheck, which explicitly throws after exitProcess(1) to guard against a non-throwing exitProcess implementation. If a future caller supplies an exitProcess that logs/records but doesn't actually halt (a real risk in this security-sensitive validation path), execution here falls through to compute and return a plan from orphaned/malformed state.

🛡️ Proposed fix
   if (input.liveExists && input.managedDcodeAgent && !input.registryEntry) {
     deps.error(
       `  Sandbox '${input.sandboxName}' is live but missing its NemoClaw registry record; refusing unverified DCode reuse or recreation.`,
     );
     deps.error(
       "  Choose a different sandbox name, or remove the orphan explicitly with OpenShell.",
     );
     deps.exitProcess(1);
+    throw new Error("exitProcess returned while rejecting an orphaned sandbox");
   }
   if (invalidRecordedDcodeAutoApprovalMode(input.registryEntry?.dcodeAutoApprovalMode)) {
     deps.error(
       "  Recorded DCode auto-approval mode is invalid. Refusing to enable or reuse the sandbox; repair the recorded state to 'disabled' before retrying.",
     );
     deps.exitProcess(1);
+    throw new Error("exitProcess returned while rejecting malformed recorded auto-approval state");
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

export function prepareDcodeAutoApprovalCreatePlan(
  input: {
    sandboxName: string;
    liveExists: boolean;
    managedDcodeAgent: boolean;
    registryEntry: { dcodeAutoApprovalMode?: unknown } | null;
    requestedMode: unknown;
  },
  deps: { error(message: string): void; exitProcess(code: number): never } = {
    error: console.error,
    exitProcess: (code) => process.exit(code),
  },
): { mode: DcodeAutoApprovalMode; hasDrift: boolean; rebuildFlag: string } {
  if (input.liveExists && input.managedDcodeAgent && !input.registryEntry) {
    deps.error(
      `  Sandbox '${input.sandboxName}' is live but missing its NemoClaw registry record; refusing unverified DCode reuse or recreation.`,
    );
    deps.error(
      "  Choose a different sandbox name, or remove the orphan explicitly with OpenShell.",
    );
    deps.exitProcess(1);
    throw new Error("exitProcess returned while rejecting an orphaned sandbox");
  }
  if (invalidRecordedDcodeAutoApprovalMode(input.registryEntry?.dcodeAutoApprovalMode)) {
    deps.error(
      "  Recorded DCode auto-approval mode is invalid. Refusing to enable or reuse the sandbox; repair the recorded state to 'disabled' before retrying.",
    );
    deps.exitProcess(1);
    throw new Error("exitProcess returned while rejecting malformed recorded auto-approval state");
  }
🤖 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/onboard/dcode-auto-approval.ts` around lines 105 - 132,
`prepareDcodeAutoApprovalCreatePlan` should fail closed if `deps.exitProcess(1)`
does not actually terminate, because both validation branches can otherwise fall
through and return a plan from invalid state. After each `exitProcess(1)` call
in this function, add a defensive `throw` so behavior matches the guarded
pattern used in `failGatewayRouteCheck` and cannot continue under a non-throwing
`exitProcess` implementation.
test/e2e/support/platform-parity-cloud-experimental.test.ts (1)

272-278: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Test coverage regression: syntax-only check replaces behavioral assertions.

This test now only validates that the script parses (bash -n), whereas the previous version asserted specific script content/patterns and exercised the is_default_auto_approval_denial classification logic via spawnSync. A syntax check cannot catch regressions in the actual fail-closed/thread-opt-in security logic (e.g., wrong capability file path, incorrect exit-code/output matching, or accidental removal of the denial check), which is the behavior this E2E check is meant to guard. This mirrors the "failing growth guardrails" concern already raised against this PR for the v0.0.78 release disposition.

Consider restoring an assertion that exercises the classification helper (or another behavioral property of the script) in addition to the syntax check, rather than relying on syntax validity alone as proof of correctness.

As per path instructions for test/**/*.test.{ts,js,mts,mjs,cts,cjs}: "Flag copied production algorithms, broad mocks that bypass the behavior under test, and conditionals that make a test pass without exercising its claim."

🤖 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/e2e/support/platform-parity-cloud-experimental.test.ts` around lines 272
- 278, The test in platform-parity-cloud-experimental has regressed from
behavior verification to a syntax-only check. Keep the bash parse check if
useful, but also restore an assertion that exercises the actual
thread-auto-approval behavior in 12-deepagents-code-thread-auto-approval.sh,
such as validating the is_default_auto_approval_denial classification or
matching the expected spawnSync output/exit behavior. Use the existing
scriptPath and spawnSync-based flow to ensure the test still guards the
fail-closed logic instead of only confirming valid Bash syntax.

Source: Path instructions

@jyaunches
jyaunches marked this pull request as draft July 8, 2026 20:03
@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

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

Contributors can view more details about this message here.

jyaunches added 2 commits July 8, 2026 16:04
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches

Copy link
Copy Markdown
Contributor Author

Exact-head follow-up for faf4576c63d422b2a9bbf571a5752df942aa133b:

Resolved in the current head:

  • Thread/session transitions now reset approval before /clear, /force-clear, resume/switch, or agent-swap work begins, including same-ID, None, and exceptional outcomes. The focused regression checks _auto_approve, status-bar state, session state, and approval_mode_key (test/langchain-deepagents-code-direct-module-patch.test.ts:1160-1317).
  • The capability reader documents the image-build source boundary and removal condition, emits non-sensitive rejection reasons only under internal NEMOCLAW_DEBUG=1, and has debug-output coverage (agents/langchain-deepagents-code/managed-dcode-runtime.py:877-934, test/langchain-deepagents-code-direct-module-patch.test.ts:242-312).
  • TUI activation coverage asserts both the active status-bar state and warning content (test/langchain-deepagents-code-direct-module-patch.test.ts:1203-1218).
  • Trailing comments on the managed Dockerfile ARG are already accepted and canonicalized; the current head now pins that behavior (src/lib/onboard/dockerfile-patch-dcode-auto-approval.test.ts:9-21).
  • The three monolith-growth findings are resolved: sandbox.ts is 832 lines versus 841 on main, sandbox.test.ts is 1202 versus 1206, and rebuild-durable-config.test.ts is 434 versus 434. The official growth guard is green.
  • Session-bootstrap findings no longer apply: the earlier generic onboarding-session persistence was removed during scope reduction. The durable source is the named sandbox registry plus transactional rebuild.

Justified without another code change:

  • The prepared DCode preflight image is intentionally temporary and removed after proving the retained context builds. OpenShell then performs the final build from the fingerprinted context after mutation-edge revalidation. Inspecting the removed temporary image would not attest the final OpenShell image. The actual runtime file is validated fail-closed, and the live DCode check verifies the projected mode/status after rebuild.
  • The rollback command is documented in the quickstart and security guide. Adding another static CLI example would duplicate that guidance and expand the generated command-reference surface.

Still outstanding:

Local verification on the current change set includes 285 focused CLI/integration tests, 14 E2E-support tests, npm run docs, npm run typecheck:cli, and npm run check:diff. Exact-head CI has growth guardrails, docs preview, CodeQL, static checks, macOS/WSL, both advisors, and the other completed gates green; CodeRabbit is skipped while the PR remains draft.

@jyaunches
jyaunches marked this pull request as ready for review July 8, 2026 20:54
@jyaunches
jyaunches enabled auto-merge (squash) July 8, 2026 20:59
@cv
cv dismissed cjagwani’s stale review July 8, 2026 21:04

Addressed

…ad-autorun

# Conflicts:
#	src/lib/actions/sandbox/rebuild-preflight-phase.ts

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

Caution

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

⚠️ Outside diff range comments (1)
src/lib/onboard/machine/handlers/sandbox-resume.ts (1)

235-261: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep not-ready sandboxes on the repair path when DCode drift is present. dcodeAutoApprovalChanged is checked before the sandboxReuseState === "not_ready" fallback, so a broken sandbox with invalid recorded DCode auto-approval can take the generic recreate branch and skip repairRecordedSandbox(...). Gate that drift branch when the sandbox isn’t ready, or add a combined test for not_ready + DCode drift.

🤖 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/onboard/machine/handlers/sandbox-resume.ts` around lines 235 - 261,
The resume decision flow in decideSandboxResume and compatibilityResumeDecision
currently lets dcodeAutoApprovalChanged trigger a generic recreate before the
sandboxReuseState === "not_ready" repair path. Update the branching so not-ready
sandboxes with DCode drift still go through repair-and-recreate, either by
gating the DCode drift check when sandboxReuseState is "not_ready" or by
combining both conditions into a dedicated repair decision. Also add/adjust a
test around repairRecordedSandbox to cover the not_ready +
dcodeAutoApprovalChanged case.
🧹 Nitpick comments (1)
test/langchain-deepagents-code-managed-entrypoints.test.ts (1)

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

Simplify to a plain conditional and avoid shadowing the path module.

The configuredContents array-of-zero-or-one plus for loop is a convoluted way to express "write the file only when content is provided". Additionally, the parameter name path shadows the module-level path import; if this helper later needs path.join, it would silently resolve to the string argument instead of the module.

♻️ Proposed simplification
-function writeAutoApprovalCapability(path: string, content?: string): void {
-  const configuredContents = content === undefined ? [] : [content];
-  for (const configuredContent of configuredContents) {
-    fs.writeFileSync(path, configuredContent, { mode: 0o444 });
-    fs.chmodSync(path, 0o444);
-  }
-}
+function writeAutoApprovalCapability(filePath: string, content?: string): void {
+  if (content === undefined) return;
+  fs.writeFileSync(filePath, content, { mode: 0o444 });
+  fs.chmodSync(filePath, 0o444);
+}
🤖 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-managed-entrypoints.test.ts` around lines 34 -
40, In writeAutoApprovalCapability, replace the zero-or-one array and for-loop
with a direct conditional that writes only when content is provided, and rename
the path parameter to avoid shadowing the imported path module. Keep the
existing fs.writeFileSync and fs.chmodSync behavior inside that conditional so
the helper remains functionally identical while being simpler and safer to
extend.
🤖 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.

Outside diff comments:
In `@src/lib/onboard/machine/handlers/sandbox-resume.ts`:
- Around line 235-261: The resume decision flow in decideSandboxResume and
compatibilityResumeDecision currently lets dcodeAutoApprovalChanged trigger a
generic recreate before the sandboxReuseState === "not_ready" repair path.
Update the branching so not-ready sandboxes with DCode drift still go through
repair-and-recreate, either by gating the DCode drift check when
sandboxReuseState is "not_ready" or by combining both conditions into a
dedicated repair decision. Also add/adjust a test around repairRecordedSandbox
to cover the not_ready + dcodeAutoApprovalChanged case.

---

Nitpick comments:
In `@test/langchain-deepagents-code-managed-entrypoints.test.ts`:
- Around line 34-40: In writeAutoApprovalCapability, replace the zero-or-one
array and for-loop with a direct conditional that writes only when content is
provided, and rename the path parameter to avoid shadowing the imported path
module. Keep the existing fs.writeFileSync and fs.chmodSync behavior inside that
conditional so the helper remains functionally identical while being simpler and
safer to extend.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9666766d-47b3-460b-b5d7-bd5eb35b950c

📥 Commits

Reviewing files that changed from the base of the PR and between 42c4e29 and 146d79e.

📒 Files selected for processing (23)
  • agents/langchain-deepagents-code/dcode-wrapper.sh
  • 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
  • docs/reference/commands.mdx
  • src/lib/actions/sandbox/rebuild-dcode-preflight.test.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/status-snapshot.ts
  • src/lib/onboard.ts
  • src/lib/onboard/dcode-auto-approval.test.ts
  • src/lib/onboard/dcode-auto-approval.ts
  • src/lib/onboard/dockerfile-patch-dcode-auto-approval.test.ts
  • src/lib/onboard/machine/handlers/sandbox-dcode-resume.ts
  • src/lib/onboard/machine/handlers/sandbox-dcode-selection.test.ts
  • src/lib/onboard/machine/handlers/sandbox-resume.ts
  • src/lib/onboard/machine/handlers/sandbox.test.ts
  • src/lib/onboard/machine/handlers/sandbox.ts
  • src/lib/onboard/prepared-dcode-rebuild.ts
  • test/helpers/langchain-deepagents-code-patch-fixture.ts
  • test/langchain-deepagents-code-direct-module-patch.test.ts
  • test/langchain-deepagents-code-image.test.ts
  • test/langchain-deepagents-code-managed-entrypoints.test.ts
✅ Files skipped from review due to trivial changes (1)
  • src/lib/onboard/dockerfile-patch-dcode-auto-approval.test.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • test/langchain-deepagents-code-image.test.ts
  • src/lib/actions/sandbox/status-snapshot.ts
  • src/lib/actions/sandbox/rebuild-gpu-opt-out.ts
  • src/lib/actions/sandbox/rebuild-durable-config.ts
  • src/lib/onboard/dcode-auto-approval.test.ts
  • test/helpers/langchain-deepagents-code-patch-fixture.ts
  • src/lib/onboard/prepared-dcode-rebuild.ts
  • agents/langchain-deepagents-code/dcode-wrapper.sh
  • docs/reference/commands.mdx
  • agents/langchain-deepagents-code/managed-dcode-runtime.py
  • agents/langchain-deepagents-code/patch-managed-deepagents-code.py
  • test/langchain-deepagents-code-direct-module-patch.test.ts
  • docs/get-started/quickstart-langchain-deepagents-code.mdx
  • src/lib/onboard/dcode-auto-approval.ts

…ad-autorun

# Conflicts:
#	src/lib/actions/sandbox/status-snapshot.ts
#	src/lib/actions/sandbox/status-text.ts
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 28975917298
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: (default — all supported)
Requested jobs: onboard-resume
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-resume ✅ success

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 28975917250
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: (default — all supported)
Requested jobs: onboard-repair
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-repair ✅ success

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ⚠️ Run cancelled — no signal

Run: 28975917301
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: ubuntu-repo-cloud-langchain-deepagents-code
Requested jobs: (default — all default-enabled free-standing jobs; explicit-only jobs openshell-gateway-auth-contract, mcp-bridge-dev, hermes-gpu-startup, sandbox-rlimits-connect, and jetson-nvmap-gpu are skipped unless selected)
Summary: 0 passed, 0 failed, 1 cancelled, 0 skipped

Job Result
live ⚠️ cancelled

@cv

cv commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Maintainer follow-up at exact head 840394d619722d328ceff0e5d2e79d0e01181be9:

The concrete human security request is addressed:

  • Approval is reset before /clear, /force-clear, resume/switch, and agent-swap transitions.
  • Focused regressions cover same-ID, None, and exceptional outcomes across active state, session state, status state, and approval_mode_key.
  • The enabled-to-disabled rollback path checks capability projection, status, wrapper denial, and runtime denial.
  • The growth guard and merge conflict are resolved, all review threads are resolved, the human change request was dismissed as “Addressed,” and the current review decision is APPROVED.

The complete acceptance/evidence set is still not finished:

  • The Brev launchable embedded-terminal validation required by feat(dcode): allow explicit thread-scoped autorun in managed sandboxes #6478 remains explicitly outstanding. The PR is correctly scoped as only partially addressing that issue, and the prior advisor retained this as PRA-T1.
  • Fresh exact-head live runs are still in progress for DCode, onboard resume, and onboard repair.
  • Current-head CI and both advisors must settle before treating the PR as gate-complete; use those reruns to confirm or disposition the remaining automated test-depth/capability-verification concerns.

Bottom line: review-cleared for the reported fail-open bug, but not yet complete for the full #6478 acceptance claim or exact-head release evidence.

Signed-off-by: cjagwani <cjagwani@nvidia.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ❌ Some jobs failed

Run: 28976266793
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: (default — all supported)
Requested jobs: onboard-repair
Summary: 0 passed, 1 failed, 0 cancelled, 0 skipped

Job Result
onboard-repair ❌ failure

Failed jobs: onboard-repair. Check run artifacts for logs.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 28976984496
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: (default — all supported)
Requested jobs: onboard-resume
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-resume ✅ success

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ✅ All requested jobs passed

Run: 28976984584
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: (default — all supported)
Requested jobs: onboard-repair
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
onboard-repair ✅ success

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

E2E Target Results — ❌ Some jobs failed

Run: 28976984424
Workflow ref: codex/6478-dcode-thread-autorun
Requested targets: ubuntu-repo-cloud-langchain-deepagents-code
Requested jobs: (default — all default-enabled free-standing jobs; explicit-only jobs openshell-gateway-auth-contract, mcp-bridge-dev, hermes-gpu-startup, sandbox-rlimits-connect, and jetson-nvmap-gpu are skipped unless selected)
Summary: 0 passed, 1 failed, 0 cancelled, 0 skipped

Job Result
live ❌ failure

Failed jobs: live. Check run artifacts for logs.

@jyaunches
jyaunches merged commit 0e0807d into main Jul 8, 2026
276 of 277 checks passed
@jyaunches
jyaunches deleted the codex/6478-dcode-thread-autorun branch July 8, 2026 21:41
cv pushed a commit that referenced this pull request Jul 9, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Prepares the user documentation for NemoClaw v0.0.78 by replacing the
unreleased section with release highlights and synchronizing the
affected inference, lifecycle, messaging, and CLI reference pages with
merged behavior.

## Changes

- Publish the v0.0.78 release-notes section with links to the most
specific user guides for each shipped behavior.
- Document authoritative Deep Agents route health, Nemotron Ultra
profile behavior, and Hermes compatible-endpoint context metadata.
- Document forced rebuild recovery after total backup failure and the
ownership-safe tunnel/full-stop behavior.
- Keep command examples and shared agent variants aligned with the
current OpenClaw, Hermes, and Deep Agents interfaces.

Source mapping:

- [#3787](#3787) ->
`docs/about/release-notes.mdx`: Record reliable workspace template
seeding during sandbox startup.
- [#4960](#4960) ->
`docs/about/release-notes.mdx`: Record safer detection of rewritten
OpenClaw gateway processes.
- [#5676](#5676) ->
`docs/about/release-notes.mdx`: Record warning-tolerant agent-list JSON
handling.
- [#5857](#5857) ->
`docs/about/release-notes.mdx`: Record synchronization of explicit
OpenClaw main-agent model state.
- [#5929](#5929) ->
`docs/about/release-notes.mdx`: Record copyable SSH port-forward
guidance for remote dashboards.
- [#6068](#6068) ->
`docs/about/release-notes.mdx`: Record custom-image plugin provenance
reconciliation.
- [#6116](#6116) ->
`docs/about/release-notes.mdx`: Record live-loopback dashboard-forward
recovery.
- [#6122](#6122) ->
`docs/about/release-notes.mdx`: Announce validated, round-trippable
policy YAML output.
- [#6211](#6211) ->
`docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`,
`docs/about/release-notes.mdx`: Explain the explicit no-backup `rebuild
--force` recovery boundary.
- [#6283](#6283) ->
`docs/about/release-notes.mdx`: Record Hermes WebUI port alignment.
- [#6293](#6293) ->
`docs/inference/switch-inference-providers.mdx`,
`docs/about/release-notes.mdx`: Document compatible-endpoint
context-length probing for Hermes.
- [#6320](#6320) ->
`docs/about/release-notes.mdx`: Record bounded gateway-recovery waits.
- [#6377](#6377) ->
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Explain
rebuild diagnostics and prepared MCP-destroy recovery.
- [#6412](#6412) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document authoritative agent-visible
inference route health.
- [#6421](#6421) ->
`docs/about/release-notes.mdx`: Record the longer quiet-pull window for
managed vLLM images.
- [#6431](#6431) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document the version-pinned Nemotron
Ultra profile plugin.
- [#6439](#6439) ->
`docs/about/release-notes.mdx`: Summarize the authenticated, pinned
credential-capture helper boundary.
- [#6450](#6450) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Document
host-forward cleanup and ownership-safe gateway-port release.
- [#6474](#6474) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/about/release-notes.mdx`: Record composable OpenClaw messaging
runtime loaders.
- [#6475](#6475) ->
`docs/about/release-notes.mdx`: Record removal of the unavailable Kimi
K2.6 production endpoint option.
- [#6480](#6480) ->
`docs/about/release-notes.mdx`: Record stderr routing for the plugin
registration banner.
- [#6481](#6481) ->
`docs/about/release-notes.mdx`: Record post-pull Ollama model discovery
checks.
- [#6482](#6482) ->
`docs/about/release-notes.mdx`: Record Ollama model warm-up after daemon
restart.
- [#6486](#6486) ->
`docs/about/release-notes.mdx`: Publish the opt-in, thread-scoped Deep
Agents auto-approval boundary.
- [#6490](#6490) ->
`docs/about/release-notes.mdx`: Record diagnostics for custom images
missing the managed runtime.
- [#6494](#6494) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document nonempty tool-call content
preservation and placeholder rejection.
- [#6497](#6497) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document isolated Deep Agents
route-probe output.
- [#6506](#6506) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document observability-preserving
managed route probes.
- [#6508](#6508) ->
`docs/about/release-notes.mdx`: Link the new extension taxonomy and
SDK-readiness reference from the release summary.

Release-source verification: GitHub reports all 29 cited source PRs as
merged with base `main`, and every merge commit is an ancestor of
`origin/main` at `17bf9a6a9688b3b1d69cf4b37d3f23110acb055e`. No
source-mapping mismatches were found.

## Type of Change

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

## Quality Gates

<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: Documentation-only
release-prep changes; `npm run docs` validates variants, routes, and
Fern content.
- [x] 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:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration 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 — command/result or justification: Tests
are not applicable to this documentation-only change set.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [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) — exited
0 with zero errors; Fern reported the existing unauthenticated
redirect-check and light-mode contrast warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

---------

Signed-off-by: cjagwani <cjagwani@nvidia.com>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
This PR adds an explicit, default-disabled `thread-opt-in` auto-approval
capability for managed LangChain Deep Agents Code sandboxes. Operators
inspect it through status and change it transactionally for a named
sandbox through rebuild, while each DCode thread must still opt in and
NemoClaw's existing sandbox security boundaries remain enforced.

## Related Issue
Partially addresses NVIDIA#6478. This PR intentionally does not close the
issue because Brev launchable embedded-terminal validation remains
outstanding; see Verification for the explicit acceptance gap.

## Changes
- Add the named `rebuild --dcode-auto-approval <disabled|thread-opt-in>`
control, durable registry state, status output, prepared-image
verification, and fail-closed validation.
- Bake a root-owned capability file into managed DCode images, reject
ambient or malformed overrides, gate `-y`/`--auto-approve`, and reset
active approval across thread and agent transitions.
- Add focused CLI and runtime coverage, a live cloud E2E check for
enable, per-thread reset, policy boundaries, and disable rollback, plus
user/security/reference documentation.

## Type of Change

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

## Quality Gates
<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Docs updated for user-facing behavior changes
- [ ] Docs not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: independent read-only
adversarial review covered runtime fail-closed behavior, rebuild
preflight, prepared-image handoff, mutation ordering, and scope
reduction; all concrete findings were addressed with regression tests.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration 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 — 285 focused DCode CLI/integration
tests, 14 E2E-support tests, and `npm run check:diff` passed
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — `npm test`: 1,280 files and 14,344 tests
passed; seven unrelated permission-mode failures passed when rerun under
the expected `umask 0022`; one unchanged gateway process-identity test
remains locally failing
- [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) — passed
with 0 errors and 2 pre-existing Fern warnings
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

The issue's Brev launchable embedded-terminal acceptance run remains
outstanding; the PR includes the reusable live DCode check but does not
claim that external manual evidence.

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

---------

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-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

Prepares the user documentation for NemoClaw v0.0.78 by replacing the
unreleased section with release highlights and synchronizing the
affected inference, lifecycle, messaging, and CLI reference pages with
merged behavior.

## Changes

- Publish the v0.0.78 release-notes section with links to the most
specific user guides for each shipped behavior.
- Document authoritative Deep Agents route health, Nemotron Ultra
profile behavior, and Hermes compatible-endpoint context metadata.
- Document forced rebuild recovery after total backup failure and the
ownership-safe tunnel/full-stop behavior.
- Keep command examples and shared agent variants aligned with the
current OpenClaw, Hermes, and Deep Agents interfaces.

Source mapping:

- [NVIDIA#3787](NVIDIA#3787) ->
`docs/about/release-notes.mdx`: Record reliable workspace template
seeding during sandbox startup.
- [NVIDIA#4960](NVIDIA#4960) ->
`docs/about/release-notes.mdx`: Record safer detection of rewritten
OpenClaw gateway processes.
- [NVIDIA#5676](NVIDIA#5676) ->
`docs/about/release-notes.mdx`: Record warning-tolerant agent-list JSON
handling.
- [NVIDIA#5857](NVIDIA#5857) ->
`docs/about/release-notes.mdx`: Record synchronization of explicit
OpenClaw main-agent model state.
- [NVIDIA#5929](NVIDIA#5929) ->
`docs/about/release-notes.mdx`: Record copyable SSH port-forward
guidance for remote dashboards.
- [NVIDIA#6068](NVIDIA#6068) ->
`docs/about/release-notes.mdx`: Record custom-image plugin provenance
reconciliation.
- [NVIDIA#6116](NVIDIA#6116) ->
`docs/about/release-notes.mdx`: Record live-loopback dashboard-forward
recovery.
- [NVIDIA#6122](NVIDIA#6122) ->
`docs/about/release-notes.mdx`: Announce validated, round-trippable
policy YAML output.
- [NVIDIA#6211](NVIDIA#6211) ->
`docs/manage-sandboxes/lifecycle.mdx`, `docs/reference/commands.mdx`,
`docs/about/release-notes.mdx`: Explain the explicit no-backup `rebuild
--force` recovery boundary.
- [NVIDIA#6283](NVIDIA#6283) ->
`docs/about/release-notes.mdx`: Record Hermes WebUI port alignment.
- [NVIDIA#6293](NVIDIA#6293) ->
`docs/inference/switch-inference-providers.mdx`,
`docs/about/release-notes.mdx`: Document compatible-endpoint
context-length probing for Hermes.
- [NVIDIA#6320](NVIDIA#6320) ->
`docs/about/release-notes.mdx`: Record bounded gateway-recovery waits.
- [NVIDIA#6377](NVIDIA#6377) ->
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Explain
rebuild diagnostics and prepared MCP-destroy recovery.
- [NVIDIA#6412](NVIDIA#6412) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document authoritative agent-visible
inference route health.
- [NVIDIA#6421](NVIDIA#6421) ->
`docs/about/release-notes.mdx`: Record the longer quiet-pull window for
managed vLLM images.
- [NVIDIA#6431](NVIDIA#6431) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document the version-pinned Nemotron
Ultra profile plugin.
- [NVIDIA#6439](NVIDIA#6439) ->
`docs/about/release-notes.mdx`: Summarize the authenticated, pinned
credential-capture helper boundary.
- [NVIDIA#6450](NVIDIA#6450) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/reference/commands.mdx`, `docs/about/release-notes.mdx`: Document
host-forward cleanup and ownership-safe gateway-port release.
- [NVIDIA#6474](NVIDIA#6474) ->
`docs/manage-sandboxes/messaging-channels.mdx`,
`docs/about/release-notes.mdx`: Record composable OpenClaw messaging
runtime loaders.
- [NVIDIA#6475](NVIDIA#6475) ->
`docs/about/release-notes.mdx`: Record removal of the unavailable Kimi
K2.6 production endpoint option.
- [NVIDIA#6480](NVIDIA#6480) ->
`docs/about/release-notes.mdx`: Record stderr routing for the plugin
registration banner.
- [NVIDIA#6481](NVIDIA#6481) ->
`docs/about/release-notes.mdx`: Record post-pull Ollama model discovery
checks.
- [NVIDIA#6482](NVIDIA#6482) ->
`docs/about/release-notes.mdx`: Record Ollama model warm-up after daemon
restart.
- [NVIDIA#6486](NVIDIA#6486) ->
`docs/about/release-notes.mdx`: Publish the opt-in, thread-scoped Deep
Agents auto-approval boundary.
- [NVIDIA#6490](NVIDIA#6490) ->
`docs/about/release-notes.mdx`: Record diagnostics for custom images
missing the managed runtime.
- [NVIDIA#6494](NVIDIA#6494) ->
`docs/inference/model-capability-audit.mdx`,
`docs/about/release-notes.mdx`: Document nonempty tool-call content
preservation and placeholder rejection.
- [NVIDIA#6497](NVIDIA#6497) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document isolated Deep Agents
route-probe output.
- [NVIDIA#6506](NVIDIA#6506) ->
`docs/get-started/quickstart-langchain-deepagents-code.mdx`,
`docs/about/release-notes.mdx`: Document observability-preserving
managed route probes.
- [NVIDIA#6508](NVIDIA#6508) ->
`docs/about/release-notes.mdx`: Link the new extension taxonomy and
SDK-readiness reference from the release summary.

Release-source verification: GitHub reports all 29 cited source PRs as
merged with base `main`, and every merge commit is an ancestor of
`origin/main` at `17bf9a6a9688b3b1d69cf4b37d3f23110acb055e`. No
source-mapping mismatches were found.

## Type of Change

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

## Quality Gates

<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [ ] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [x] Tests not applicable — justification: Documentation-only
release-prep changes; `npm run docs` validates variants, routes, and
Fern content.
- [x] 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:
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration 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 — command/result or justification: Tests
are not applicable to this documentation-only change set.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [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) — exited
0 with zero errors; Fern reported the existing unauthenticated
redirect-check and light-mode contrast warnings.
- [x] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

---------

Signed-off-by: cjagwani <cjagwani@nvidia.com>
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 integration: dcode LangChain Deep Code integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants