Skip to content

feat(onboard): bind external gateway lifecycle authority#7246

Merged
jyaunches merged 30 commits into
mainfrom
codex/pr-7110
Jul 24, 2026
Merged

feat(onboard): bind external gateway lifecycle authority#7246
jyaunches merged 30 commits into
mainfrom
codex/pr-7110

Conversation

@jyaunches

@jyaunches jyaunches commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

External systemd supervisors can now remain the sole OpenShell gateway lifecycle authority while NemoClaw validates and attaches to their exact endpoint. The authority is persisted across onboarding resume, and every preflight, start, recovery, attachment, stop, final-sandbox cleanup, and uninstall path fails closed instead of creating or tearing down the wrong gateway.

Thank you to @souvikDevloper for the original contribution in #6842, and to @apurvvkumaria for the follow-up work. The underlying onboarding architecture shifted to per-gateway bindings and versioned checkpoints while that PR was open, so this needed a fresh implementation. Its central ideas and structure remain here: an explicit authority contract, pure ownership evaluation, host attestation, and composed lifecycle guards.

Related Issue

Refs #6576

Supersedes #6842

Changes

  • Add a versioned, secret-free gateway management declaration for the external systemd supervisor required by Define and enforce one OpenShell gateway lifecycle authority on Brev #6576. A direct port-conflict exception is insufficient because preflight cleanup, recovery, resume, and downstream gateway selection are separate effect boundaries; the authority contract and composed preflight tests protect all of them.
  • Bind the canonical gateway name, port, owner, endpoint, supervisor, and capabilities into checkpoint schema v2 before gateway effects. Resume migrates v1 checkpoints and rejects cross-process authority drift.
  • Expose the checkpointed management mode and redacted owner through nemoclaw status, status --json, and nemoclaw debug, without the external state directory or credential values.
  • Reject an endpoint-port mismatch before host inspection or any HTTP health request.
  • Attest the listener through its systemd cgroup, executable, complete listener set, capabilities, and exact HTTP or mTLS gRPC health endpoint.
  • Register and select the exact validated endpoint before provider selection, including first attachment with no prior OpenShell registration and replacement of stale registration metadata.
  • Revalidate the exact gateway authority before stop, final-sandbox cleanup, and uninstall. External gateways keep their process, Docker resources, and OpenShell binaries; NemoClaw never uses legacy gateway destroy for them.
  • Document managed and externally supervised modes, TLS bundle layout, registration behavior, teardown behavior, and resume remediation.

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: exact-head security review passes declaration input, listener identity, systemd ownership, mTLS material, exact endpoint selection, lifecycle effects, teardown revalidation, and durable resume boundaries.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: Head bcbbef70c adds only an empty signed CI-retry commit. Its tree and effective PR documentation diff are identical to reviewed head 1bd90ae67. git diff --check passed.
  • Agent: Codex Desktop documentation writer subagent

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — focused authority and credential tests passed 11/11; changed tests passed 356/356; the hermetic GPU recreate test passed 2/2 with CI coverage; CLI type-check, npm run check:diff, and normal commit/pre-push hooks passed.
  • Applicable broad gate passed — exact-head CI and E2E passed for bcbbef70c on current base 46ecb8677; final coordination passed.
  • 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)

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

Summary by CodeRabbit

  • Documentation
    • Added a new “Gateway Lifecycle Authority” deployment page describing versioned externally supervised gateway lifecycle and strict attach/recovery validation.
  • New Features
    • Externally supervised gateway attachment mode with non-destructive behavior, TLS readiness checks, and identity/health probing.
    • Durable gateway authority checkpointing (schema v2) with resume revalidation.
    • Extended status/debug to display redacted gateway authority details.
    • Added an unfiltered gateway port listener scan to improve ownership detection.
  • Bug Fixes
    • Ensured preflight and recovery refuse destructive actions when gateway lifecycle authority is externally supervised.
  • Tests
    • Expanded coverage across onboarding attachment gating, checkpointing/resume, recovery guarding, cleanup/reuse, and listener enumeration.

Add a versioned gateway lifecycle declaration and durable resume binding.

Register the exact endpoint and fail closed across preflight and recovery.

Co-authored-by: Souvik Ghosh <138186578+souvikDevloper@users.noreply.github.com>

Co-authored-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches added platform: brev Affects Brev hosted development environments area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality v0.0.90 labels Jul 20, 2026
@jyaunches jyaunches self-assigned this Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 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 change adds a versioned gateway lifecycle authority contract, validates externally supervised gateways, persists authority across onboarding checkpoints, prevents destructive lifecycle actions, and integrates attachment-only behavior into onboarding, recovery, runtime, and diagnostic output.

Changes

Gateway lifecycle authority

Layer / File(s) Summary
Management contract and ownership validation
src/lib/onboard/gateway-management.ts, src/lib/onboard/gateway-ownership.ts, docs/deployment/..., docs/index.yml
Adds strict declaration loading, owner resolution, fail-closed attachment validation, supervisor identity checks, and lifecycle authority documentation.
Authority checkpoint persistence
src/lib/state/onboard-checkpoint*, src/lib/onboard/gateway-authority-checkpoint.ts, src/lib/onboard/*checkpoint*.test.ts
Adds checkpoint schema version 2 support, migration handling, authority serialization, and resume mismatch rejection.
Host runtime and attachment wiring
src/lib/onboard/gateway-host-runtime.ts, src/lib/onboard/docker-driver-gateway-*.ts, src/lib/onboard/gateway-host-runtime*.test.ts
Centralizes owner binding, supervisor/listener probing, mTLS readiness, exact endpoint registration, and raw listener enumeration.
Preflight ownership guards
src/lib/onboard/preflight-*.ts, src/lib/onboard/gateway-stale-port-reuse.ts, src/lib/onboard/gateway-port-conflict.ts
Adds role-aware port handling and prevents reuse, cleanup, recovery, and conflict exits for externally supervised gateways.
Onboarding and recovery integration
src/lib/onboard.ts, src/lib/onboard/machine/handlers/gateway.ts, src/lib/onboard/gateway-recovery.ts
Wires attachment-only gateway handling, start guards, checkpoint binding, owner metadata, and runtime cleanup.
Authority diagnostics and CLI output
src/lib/inventory/index.ts, src/lib/state/onboard-session.ts, src/lib/status-command-deps.ts, test/cli/*, test/helpers/*
Adds sanitized gateway authority data to status and debug output and covers externally supervised session rendering.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Onboarding
  participant GatewayManagement
  participant GatewayHostRuntime
  participant Supervisor
  participant OpenShell
  Onboarding->>GatewayManagement: Load and validate declaration
  GatewayManagement-->>Onboarding: Resolve lifecycle owner
  Onboarding->>GatewayHostRuntime: Probe attachment
  GatewayHostRuntime->>Supervisor: Check unit, cgroup, and listener identity
  Supervisor-->>GatewayHostRuntime: Return runtime evidence
  GatewayHostRuntime->>OpenShell: Register and select exact endpoint
  OpenShell-->>Onboarding: Return attached gateway
  Onboarding->>Onboarding: Checkpoint authority and continue onboarding
Loading

Possibly related issues

Possibly related PRs

  • NVIDIA/NemoClaw#6842: Adds closely related gateway lifecycle authority parsing, ownership enforcement, checkpointing, and attachment handling.

Suggested labels: area: docs, security, refactor

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately captures the main change: binding external gateway lifecycle authority during onboarding.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/pr-7110

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

@github-actions

Copy link
Copy Markdown
Contributor

@github-code-quality

github-code-quality Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit bcbbef7 in the codex/pr-7110 branch remains at 96%, unchanged from commit 46ecb86 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit bcbbef7 in the codex/pr-7110 branch remains at 80%, unchanged from commit 46ecb86 in the main branch.

Show a code coverage summary of the most impacted files.
File main 46ecb86 codex/pr-7110 bcbbef7 +/-
src/lib/onboard...eway-service.ts 85% 76% -9%
src/lib/inventory/index.ts 97% 90% -7%
src/lib/onboard.ts 31% 31% 0%
src/lib/shields/index.ts 71% 72% +1%
src/lib/onboard...y-management.ts 0% 82% +82%
src/lib/onboard...host-runtime.ts 0% 86% +86%
src/lib/onboard...y-checkpoint.ts 0% 93% +93%
src/lib/onboard...wn-authority.ts 0% 96% +96%
src/lib/onboard...ay-ownership.ts 0% 99% +99%
src/lib/onboard...eway-cleanup.ts 0% 100% +100%

Updated July 24, 2026 11:50 UTC

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

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

Model lanes

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

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

E2E guidance

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

Recommended E2E: cloud-onboard, credential-sanitization, security-posture, onboard-repair, onboard-resume

1 optional E2E recommendation
  • gateway-guard-recovery

Workflow run details

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/lib/onboard/gateway-ownership.ts (1)

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

Doc comment overstates what listenerPids contains. The externally-supervised probe path feeds this field from getGatewayPortListenerRawScan (unfiltered enumeration), not identity-verified gateways — see probeGatewayAttachment in gateway-host-runtime.ts, which sets listenerPids: scan.pids from the raw scan. That is intentional and load-bearing: the multiple_owners check at Line 336 must count every listener (e.g. SO_REUSEPORT) to fail closed. The current wording could lead a future maintainer to add identity filtering upstream and silently weaken that guarantee. Consider clarifying the comment to "All processes holding the port; identity is established separately below."

🤖 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/gateway-ownership.ts` around lines 237 - 238, Update the doc
comment for listenerPids in the gateway ownership model to state that it
contains all processes holding the port, including unfiltered listeners, and
that identity is established separately. Do not change the raw scan flow or the
multiple_owners counting behavior.
🤖 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 `@src/lib/onboard/gateway-authority-checkpoint.test.ts`:
- Around line 61-69: Update the round-trip test “accepts the same authority
after a process resume round-trip (`#6576`)” so it distinguishes a persisted
checkpoint from a reset one, rather than only comparing the returned owner.
Assert an observable outcome specific to the already-recorded branch of
bindGatewayAuthorityToCheckpoint, while retaining the existing same-owner resume
scenario.

In `@src/lib/onboard/gateway-host-runtime.ts`:
- Around line 186-195: The listener identity check in probeGatewayAttachment
must close the PID-reuse gap between reading /proc/<pid>/exe and
/proc/<pid>/cgroup. Revalidate that the PID still represents the originally
scanned listener before accepting its supervisor match, or combine the
executable and cgroup identity reads into one consistent probe; update
readListenerSupervisorMatch or the surrounding probe flow while preserving the
existing attach-gate behavior.

In `@src/lib/state/onboard-checkpoint.ts`:
- Around line 4-9: Move SUPPORTED_GATEWAY_CAPABILITIES out of the onboard layer
into a shared core/domain module such as ports.ts or a dedicated
gateway-capabilities module, then update onboard-checkpoint.ts and
gateway-management.ts to import it from there. Re-export it from
gateway-management.ts to preserve existing onboard callers, while ensuring the
shared module becomes the single source of truth and the state layer no longer
imports ../onboard/gateway-management.

---

Nitpick comments:
In `@src/lib/onboard/gateway-ownership.ts`:
- Around line 237-238: Update the doc comment for listenerPids in the gateway
ownership model to state that it contains all processes holding the port,
including unfiltered listeners, and that identity is established separately. Do
not change the raw scan flow or the multiple_owners counting 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: 2b375967-eb1f-4218-93a0-a307c5443b57

📥 Commits

Reviewing files that changed from the base of the PR and between 5b547cd and 6a86b42.

📒 Files selected for processing (45)
  • docs/deployment/gateway-lifecycle-authority.mdx
  • docs/index.yml
  • src/lib/onboard.ts
  • src/lib/onboard/checkpoint-replay.test.ts
  • src/lib/onboard/checkpoint-resume-guard.test.ts
  • src/lib/onboard/dashboard-preflight-ports.test.ts
  • src/lib/onboard/docker-driver-gateway-port-listener.test.ts
  • src/lib/onboard/docker-driver-gateway-port-listener.ts
  • src/lib/onboard/docker-driver-gateway-runtime.ts
  • src/lib/onboard/gateway-authority-checkpoint.test.ts
  • src/lib/onboard/gateway-authority-checkpoint.ts
  • src/lib/onboard/gateway-host-runtime-https.test.ts
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/onboard/gateway-host-runtime.ts
  • src/lib/onboard/gateway-management.test.ts
  • src/lib/onboard/gateway-management.ts
  • src/lib/onboard/gateway-ownership.test.ts
  • src/lib/onboard/gateway-ownership.ts
  • src/lib/onboard/gateway-port-conflict.test.ts
  • src/lib/onboard/gateway-port-conflict.ts
  • src/lib/onboard/gateway-recovery.test.ts
  • src/lib/onboard/gateway-recovery.ts
  • src/lib/onboard/gateway-stale-port-reuse.test.ts
  • src/lib/onboard/gateway-stale-port-reuse.ts
  • src/lib/onboard/machine/handlers/gateway.test.ts
  • src/lib/onboard/machine/handlers/gateway.ts
  • src/lib/onboard/machine/handlers/sandbox-checkpoint-crash-recovery.test.ts
  • src/lib/onboard/machine/handlers/sandbox-messaging.test.ts
  • src/lib/onboard/machine/handlers/sandbox.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/preflight-gateway-cleanup-decision.test.ts
  • src/lib/onboard/preflight-gateway-cleanup-decision.ts
  • src/lib/onboard/preflight-gateway-reuse.test.ts
  • src/lib/onboard/preflight-gateway-reuse.ts
  • src/lib/onboard/preflight-gateway-sequence.test.ts
  • src/lib/onboard/preflight-gateway-sequence.ts
  • src/lib/onboard/preflight-orphan-gateway-cleanup.test.ts
  • src/lib/onboard/preflight-orphan-gateway-cleanup.ts
  • src/lib/onboard/preflight-ports.ts
  • src/lib/onboard/session-bootstrap.test.ts
  • src/lib/state/onboard-checkpoint-migrate.test.ts
  • src/lib/state/onboard-checkpoint-migrate.ts
  • src/lib/state/onboard-checkpoint-types.ts
  • src/lib/state/onboard-checkpoint.test.ts
  • src/lib/state/onboard-checkpoint.ts

Comment thread src/lib/onboard/gateway-authority-checkpoint.test.ts
Comment thread src/lib/onboard/gateway-host-runtime.ts Outdated
Comment thread src/lib/state/onboard-checkpoint.ts Outdated
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/gateway-host-runtime.ts (1)

353-358: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Bind the owner before mutating OpenShell.

attachGateway trusts its owner parameter without comparing it to getGatewayOwner(). A stale resumed owner can therefore register/select its endpoint after the declaration resolves to a different authority. Call bindGatewayOwner(owner) before the early return and before any OpenShell command; add a test proving mismatches fail without registration.

Proposed fix
 async function attachGateway(
   owner: GatewayOwner,
   expectedProbe: GatewayAttachmentProbe,
 ): Promise<void> {
+  bindGatewayOwner(owner);
   if (!isExternallySupervised(owner) || !owner.endpoint) return;

As per path instructions, in-scope callers must use one authoritative 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 `@src/lib/onboard/gateway-host-runtime.ts` around lines 353 - 358, Update
attachGateway to call bindGatewayOwner(owner) as its first operation, before the
supervision/endpoint early return and any OpenShell mutation. Ensure mismatched
owners fail immediately without registering or selecting an endpoint, and add a
test covering this rejection and absence of registration.

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.

Outside diff comments:
In `@src/lib/onboard/gateway-host-runtime.ts`:
- Around line 353-358: Update attachGateway to call bindGatewayOwner(owner) as
its first operation, before the supervision/endpoint early return and any
OpenShell mutation. Ensure mismatched owners fail immediately without
registering or selecting an endpoint, and add a test covering this rejection and
absence of registration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: edc6f847-f11e-4d6e-a07e-bb281e13a7ca

📥 Commits

Reviewing files that changed from the base of the PR and between c5bd355 and dfbd96d.

📒 Files selected for processing (8)
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/onboard/gateway-host-runtime.ts
  • src/lib/onboard/gateway-management.test.ts
  • src/lib/onboard/gateway-management.ts
  • src/lib/onboard/gateway-ownership.test.ts
  • src/lib/onboard/gateway-ownership.ts
  • src/lib/onboard/machine/handlers/gateway.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/lib/onboard/gateway-management.test.ts
  • src/lib/onboard/machine/initial-flow-phases.test.ts
  • src/lib/onboard/gateway-host-runtime.test.ts
  • src/lib/onboard/gateway-management.ts
  • src/lib/onboard/gateway-ownership.test.ts
  • src/lib/onboard/machine/handlers/gateway.test.ts
  • src/lib/onboard/gateway-ownership.ts

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

Copy link
Copy Markdown
Collaborator

Security re-review: PASS at exact head aff3e3ebae1b05a3e19674ccc10ac4c5a1dcf0f5.

The delta from the prior nine-category PASS (57ebaf79e0a5e25f3f07c9033a7688efe1ab5627) changes only test structure in src/lib/actions/uninstall/run-plan-gateway-segregation.test.ts: it replaces two test-body if statements with a keyed setup function and response map. Production code, privilege boundaries, command construction, credential handling, network behavior, filesystem behavior, dependencies, and user-facing documentation are unchanged. The prior nine-category findings therefore remain PASS with no new findings.

@prekshivyas

Copy link
Copy Markdown
Collaborator

Advisor finding disposition at aff3e3eba

I checked the Nemotron advisor ledger against the accepted #6576 design and the exact tree. No follow-up code change is warranted:

  1. Composed preflight test — already present. preflight-gateway-sequence.test.ts runs the full reuse → cleanup → orphan sequence with gatewayReuseState: "missing", external supervision, and an orphan-looking container, then asserts every destructive effect stayed at zero.
  2. Failure injection — already covered at the behavior boundaries. Stale/reused PID state fails closed during identity read and confirmation; a supervisor/listener restart during onboarding is detected by PID/generation revalidation before attachment completes; interrupted onboarding is covered by the durable process-resume round trip and authority-drift rejection.
  3. v1 checkpoint migration — unset is intentional and safe. A v1 checkpoint cannot encode whether the historical managed owner was packaged-service or standalone, so synthesizing a selected owner would invent authority. The migration test preserves unset; resume then resolves the live owner and durably binds it before preflight or other gateway effects. External supervision did not exist in v1, so there is no older selected external owner to recover.

The GPT-5.6 Terra advisor independently returned no actionable findings. I am keeping the current exact head and allowing its selected live E2E checks to finish.

@prekshivyas

Copy link
Copy Markdown
Collaborator

Exact-head sensitive-path re-review for 6236527652279ef2aaaa227b070fe0a0efaaeb0a0 against base 04e6dfa883071dda9df429c66e73168e1a995cba: PASS.

I rechecked the complete PR diff after the clean main refresh in all nine required categories: input validation; authentication and authorization; secrets and credentials; data/privacy exposure; dependency and supply-chain risk; command/code injection; network/SSRF behavior; sandbox and privilege boundaries; and CI/release integrity. The external declaration remains strict and fail-closed; endpoint input is restricted to exact loopback origins; systemd scope, service cgroup, executable, listener identity, and mTLS evidence are bound before attachment; authority drift aborts before lifecycle effects; stop/final cleanup/uninstall preserve externally supervised process authority; diagnostics remain secret-free; and the PR adds no dependency. The commits after the prior full review are a clean merge of current main plus documentation/JSDoc accuracy corrections, with no new runtime behavior. Local exact-head evidence: 32 changed test files passed (423 passed, 1 skipped), npm run docs passed, and npm run check:diff passed.

@prekshivyas

Copy link
Copy Markdown
Collaborator

@apurvvkumaria, the requested fixes are now complete on exact head 6236527652279ef2aaaa227b070fe0a0efaaeb0a0, based on current main 04e6dfa883071dda9df429c66e73168e1a995cba. All 57 current checks are green, including the three selected live E2E jobs; all 23 commits are Verified; the exact-head docs receipt and nine-category sensitive-path review pass; and check-gates.ts reports allPass: true. Your earlier CHANGES_REQUESTED review is on pre-fix commit 2539a25de431b4884bc99b82021dde996ba54c2b. Please re-review the current head when available.

@souvikDevloper

Copy link
Copy Markdown
Contributor

@apurvvkumaria i also think that your proposed changes are in place check it and i think its mergeable now. Also eagerly waiting for your response regarding joining these NVIDIA team

@prekshivyas

Copy link
Copy Markdown
Collaborator

Exact-head sensitive-path re-review for f757878a7c8f17d2990476aeb538da9d1a54c5fd against base 04e6dfa883071dda9df429c66e73168e1a995cba: PASS.

This review carries forward the complete 68-file security review and re-read the exact six-file delta in this SHA.

Category Verdict Evidence
Secrets and credentials PASS No credential value or new persistence surface was added. Failure output contains only the existing secret-free authority description.
Input validation and data sanitization PASS The mutation guard derives the canonical gateway name and port and reuses the strict declaration parser and exact checkpoint comparison.
Authentication and authorization PASS credentials add and credentials reset now revalidate the bound lifecycle owner after recovery and before every provider mutation. Read-only credentials list does not use the mutation guard.
Dependencies and third-party libraries PASS No dependency or supply-chain input changed.
Error handling and logging PASS Authority failures return fail-closed CLI guidance without credential material, stack traces, or declaration-file contents.
Cryptography and data protection PASS No cryptographic behavior changed; the reviewed mTLS and secret-free checkpoint boundaries remain intact.
Configuration and security headers PASS No HTTP surface, container privilege, port exposure, or security-header behavior changed. Invalid or changed authority still fails closed.
Security testing PASS The real resolver test rejects declaration/checkpoint drift. The command regression models an already-healthy gateway and proves both add and reset make zero provider calls after drift.
System security PASS The change closes PRA-1 by moving current-authority revalidation to the immediate credential-mutation boundary. Recovery remains guarded, and authority drift cannot silently select another owner.

No findings. Delta files reviewed: src/lib/onboard/gateway-teardown-authority.ts, src/lib/onboard/gateway-teardown-authority.test.ts, src/lib/credentials/command-support.ts, src/lib/actions/credentials-add.ts, src/commands/credentials/reset.ts, and src/commands/credentials.test.ts.

Local exact-head evidence: focused tests 11/11 passed; npm run test:changed passed 356/356 tests across 31 files; npm run typecheck:cli passed; npm run check:diff and normal commit/pre-push hooks passed. GitHub reports the new commit Verified.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
@jyaunches
jyaunches dismissed apurvvkumaria’s stale review July 24, 2026 12:33

Stale after the blocking teardown-authority gap was fixed in 57ebaf7 and covered by zero-effect tests for stop, final-sandbox cleanup, scoped uninstall, and full uninstall for both systemd supervisor kinds. Issue #6576 now records the accepted design. Current head bcbbef7 is current with main and has green required CI, selected live E2E, CodeRabbit, and both advisor lanes. Apurv remains requested for current-head review.

@jyaunches
jyaunches merged commit 99776d3 into main Jul 24, 2026
108 checks passed
@jyaunches
jyaunches deleted the codex/pr-7110 branch July 24, 2026 12:37
@senthilr-nv senthilr-nv mentioned this pull request Jul 25, 2026
23 tasks
senthilr-nv added a commit that referenced this pull request Jul 25, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Adds the canonical pre-tag `## v0.0.95` release entry to
`docs/changelog/2026-07-24.mdx`, before the existing v0.0.94 entry. The
entry summarizes approved user-visible changes merged since v0.0.94 and
excludes internal-only prerequisites.

## Changes

- Adds the v0.0.95 summary and detailed bullets for gateway lifecycle,
recovery, state transfer, inference compatibility, sandbox security,
Discord policy, and E2E evidence.
- Links each user-facing theme to the most specific published
documentation.
- Records the release entry in the shared native changelog used by the
OpenClaw, Hermes, and Deep Agents guides.

Source summary:

- [#7246](#7246),
[#7228](#7228),
[#7267](#7267),
[#7489](#7489),
[#7509](#7509),
[#7351](#7351), and
[#7290](#7290) ->
`docs/changelog/2026-07-24.mdx`: Gateway authority, forward teardown and
retry, managed recovery, Hermes restart recovery, scoped uninstall, and
orphan-aware backup behavior.
- [#7344](#7344) and
[#7416](#7416) ->
`docs/changelog/2026-07-24.mdx`: Atomic SQLite restore and host download
verification.
- [#7476](#7476),
[#7347](#7347),
[#7281](#7281),
[#7485](#7485),
[#7491](#7491), and
[#7422](#7422) ->
`docs/changelog/2026-07-24.mdx`: Windows Ollama reuse, CDI fallback,
bounded OpenRouter connection setup, Nemotron-3 request compatibility,
and managed Deep Agents retry and provider-error behavior.
- [#6884](#6884),
[#7481](#7481),
[#6878](#6878),
[#7467](#7467),
[#7502](#7502),
[#7503](#7503),
[#7504](#7504), and
[#7486](#7486) ->
`docs/changelog/2026-07-24.mdx`: Trusted base-image overrides, local
rebuild images, runtime validation, config preservation, reviewed
package updates, and fewer final-image payload layers.
- [#7303](#7303) ->
`docs/changelog/2026-07-24.mdx`: Scoped Discord application-command
management.
- [#7488](#7488),
[#7465](#7465),
[#7497](#7497),
[#7464](#7464),
[#7501](#7501),
[#7494](#7494), and
[#7493](#7493) ->
`docs/changelog/2026-07-24.mdx`: Selected-test risk signals, retry
cleanup, full root-image validation, direct-main Hermes setup, executed
PR-gate evidence, nightly history, and runner wait reporting.
- [#7447](#7447) is an internal
pinned-runtime prerequisite and is intentionally excluded from canonical
supported-integration documentation.
- [#7370](#7370) adds
maintainer-only advisory reconciliation tooling and does not change
supported user behavior.
- [#7495](#7495) updates existing
documentation and does not add a new v0.0.95 behavior claim.

## Type of Change

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

## Quality Gates

- [ ] Tests added or updated for changed behavior
- [x] Existing tests cover changed behavior — justification:
`test/changelog-docs.test.ts` validates the dated changelog structure,
heading uniqueness, and published links.
- [ ] Tests not applicable — justification:
- [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:

## Documentation Writer Review

- [x] Documentation writer subagent reviewed the completed changes
- Result: `docs-updated`
- Evidence: `docs/changelog/2026-07-24.mdx`; writing rules,
documentation style, factual release meaning, and published links
reviewed at exact head `58b02f2bf`.
- Agent: Codex documentation writer reviewer
<!-- docs-review-head-sha: 58b02f2 -->
<!-- docs-review-agents-blob-sha: 9c9b36d -->

## DGX Station Hardware Evidence

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

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run 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: `npx
vitest run test/changelog-docs.test.ts` passed 6 tests.
- [ ] 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) — the
build passed with 0 errors and 2 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)

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


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

* **Documentation**
  * Added a new v0.0.95 changelog entry above v0.0.94.
* Documented improved externally supervised gateway lifecycle ownership.
  * Improved snapshot restore reliability and SQLite state handling.
  * Tightened CLI `backup-all` behavior and host artifact verification.
* Updated Windows onboarding guidance (including Ollama service reuse
and CDI directory fallback).
* Noted inference compatibility fixes, deeper agent failure
classification, stricter base-image validation, updated Discord bot
command permissions, and refined E2E release automation evidence
handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

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

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality platform: brev Affects Brev hosted development environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants