Skip to content

fix(recovery): settle delayed startup and classify forward failures - #11123

Closed
harjothkhara wants to merge 2 commits into
NVIDIA:mainfrom
harjothkhara:codex/nemoclaw-11107-2026-09-05
Closed

harjothkhara wants to merge 2 commits into
NVIDIA:mainfrom
harjothkhara:codex/nemoclaw-11107-2026-09-05

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Outcome

Managed gateway startup and recovery now tolerate the exact post-create window where OpenShell reports a sandbox Ready before its labeled Podman container is discoverable. Hermes Portable forward recovery also reports whether a required host port is occupied or the OpenShell forward state cannot be proved, without taking over a listener or mutating ambiguous state.

Reason

Build 346 completed Hermes onboarding and health checks, then hit PRIVILEGED_CONTROL_UNAVAILABLE during the privileged secret-boundary check. A later probe found and reused the healthy container, showing that readiness and labeled-container discovery had not settled together. The subsequent forward-recovery error collapsed an occupied port and unavailable/malformed forward state into one generic message.

Fixes #11107.

Changes

  • Give the exact bare PRIVILEGED_CONTROL_UNAVAILABLE observation 21 attempts (about 60 seconds at the default 3-second interval) without consuming the existing 11-attempt allowance for other retryable startup transitions.
  • Keep one shared retry-budget owner for both managed recovery loops, with a 31-attempt combined ceiling (about 90 seconds at the default interval).
  • Preserve immediate fail-closed behavior for diagnostic-bearing, identity, integrity, malformed, and other terminal results.
  • Distinguish forward-occupied, unavailable/ambiguous forward state, recovery failure, restoration failure, and authority drift in sanitized user-facing diagnostics.
  • Never stop another owner, take over an occupied port, or publish launch-readiness evidence when forward ownership/state is unproved.
  • Extend the existing recovery and Hermes forward-composition tests and update command/troubleshooting documentation.

Verification

Exact candidate: 4e2dbd1bccbae0b1d4465739e791a2d2f2ed0e92
Exact base: 7fe4a76c4e434bd2ba550b9e7b29235c52a94fd9

  • Focused CLI recovery/forward suite: 232 tests passed across 5 resolved test files.
  • npm run validate:pr: passed, including formatting, lint, repository rules, secret scanning, source-shape/growth guards, and CLI typecheck.
  • npm run docs:strict: passed with 0 errors and the repository's 5 existing Fern warnings.
  • Exact-head docs, DCO, title, installer-hash, growth, and maintainer-edit checks: passed.
  • PR Review Advisor: the exact-head migration specialist found no issue and confirmed the old retry authority is removed from both consumers. A prior-head reduction specialist reviewed the same patch after the architecture repair and confirmed the shared retry-budget mechanism is the single owner; the remaining exact-head specialists produced no review artifact because their Advisor lifecycles failed or timed out.
  • Trusted E2E run 34254297760, correlation b9a33923-386c-405f-92f8-4fa2e1cf1608: five SHA-bound credential-free cases completed with passed: 1, failed: 0, skipped: 0, and no unhandled errors each: managed-image buildless onboarding, missing-sandbox repair/conflicting resume, interrupted-onboarding resume, gateway crash-loop recovery, and concurrent sandbox/forward port isolation.
  • The exact matching main base/managed image publication completed successfully before E2E dispatch. The post-reboot target reported passed: 0, skipped: 1 and is deliberately not counted as evidence.

Review notes

  • The forward change is classification and fail-closed guidance, not automatic remediation. It deliberately does not kill a listener, stop another sandbox's forward, or guess how to parse malformed/ambiguous OpenShell output.
  • The 60-second delayed-discovery behavior is covered deterministically; it does not add an unconditional 60-second wait.
  • This remains a fork PR. The OpenShell SDK package job is available only to same-repository PRs, so downstream standard CI jobs can remain policy-blocked even when candidate validation is clean. Secret-backed Hermes managed-image E2E likewise requires an NVIDIA-owned source branch; the external-PR E2E lane stays credential-free.
  • CodeRabbit reviewed the exact prior candidate as minimal merge risk with no actionable code comment. Its docstring-coverage item is a non-blocking generated warning, not a behavioral finding.
  • One unrelated E2E job completed its catalogue test and evidence manifest successfully but failed while uploading artifacts with an intermediary HTTP 403. That infrastructure-only upload failure is not a candidate assertion failure.

Signed-off-by: harjoth [email protected]

@copy-pr-bot

copy-pr-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

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

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 15bee6fe-4c64-4ebb-b2d2-75d23d5463d4

📥 Commits

Reviewing files that changed from the base of the PR and between 973a0ee and 4e2dbd1.

📒 Files selected for processing (1)
  • docs/reference/commands.mdx

Included review availability: Your plan provides up to 12 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Managed gateway recovery separates retry budgets for delayed container discovery and supervisor transitions. Hermes forward recovery reports sanitized failure diagnostics and avoids mutation when ownership or forward state is unproven. Documentation also clarifies download and upload behavior.

Changes

Managed gateway recovery

Layer / File(s) Summary
Retry budget accounting
src/lib/actions/sandbox/process-recovery.ts
Discovery and transition failures use separate limits with a combined attempt ceiling.
Startup and recovery regression coverage
src/lib/actions/sandbox/process-recovery-managed-startup.test.ts
Tests cover delayed discovery, diagnostic refusal, identity changes, retry bounds, configured limits, and Hermes recovery timing.
Hermes forward recovery diagnostics
src/lib/actions/sandbox/connect.ts, src/lib/actions/sandbox/probe/hermes-portable-forward-recovery.test.ts
Forward recovery distinguishes occupied and unavailable state and stops before readiness publication or forward mutation when state is unproven.
Reference behavior documentation
docs/reference/commands.mdx, docs/reference/troubleshooting.mdx
Documentation describes recovery limits, forward recovery outcomes, download validation, upload path behavior, and the corrected troubleshooting link.

Priority: ➖ Normal — Schedule the managed gateway recovery change because it expands bounded startup handling for delayed container discovery and adds safeguards for Hermes forward failures.

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

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 4e2db

Managed gateway recovery now tolerates delayed container discovery within bounded limits while preserving terminal failure and identity checks. The documented retry behavior and covered recovery paths show no remaining merge-blocking risk.

Sequence Diagram(s)

sequenceDiagram
  participant ManagedRecovery
  participant PrivilegedControl
  participant Supervisor
  participant HermesForwardRecovery
  ManagedRecovery->>PrivilegedControl: discover managed container
  PrivilegedControl-->>ManagedRecovery: discovery result
  ManagedRecovery->>Supervisor: evaluate startup transition
  Supervisor-->>ManagedRecovery: transition result
  ManagedRecovery->>HermesForwardRecovery: recover host forwards
  HermesForwardRecovery-->>ManagedRecovery: sanitized diagnostic or readiness evidence
Loading

Suggested reviewers: prekshivyas, yanyunl1991

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes support issue #11107, including recovery documentation and Hermes forward-failure handling. However, the command documentation also adds unrelated download and upload behavior clarificati… Remove the unrelated download/upload documentation changes and the Deep Agents link correction, or link issues that define those requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #11107. They add separate transient discovery retry handling, preserve the exact sanitized marker requirement, retain bounded attempts and identity checks, keep terminal diag…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: delayed startup recovery and forward-failure classification.
Full details: Out of Scope Changes check

Explanation

Most changes support issue #11107, including recovery documentation and Hermes forward-failure handling. However, the command documentation also adds unrelated download and upload behavior clarifications, and the troubleshooting documentation corrects an unrelated Deep Agents link.

Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@harjothkhara
harjothkhara marked this pull request as ready for review September 6, 2026 05:32
@prekshivyas
prekshivyas force-pushed the codex/nemoclaw-11107-2026-09-05 branch from 9f3d98e to dc137f5 Compare September 8, 2026 15:07
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@prekshivyas
prekshivyas force-pushed the codex/nemoclaw-11107-2026-09-05 branch 4 times, most recently from 629be2e to 2eef27e Compare September 8, 2026 16:04
@prekshivyas prekshivyas changed the title fix(recovery): wait for delayed container discovery fix(recovery): settle delayed startup and classify forward failures Sep 8, 2026
@prekshivyas
prekshivyas force-pushed the codex/nemoclaw-11107-2026-09-05 branch 2 times, most recently from 973a0ee to 4e2dbd1 Compare September 8, 2026 16:28
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior labels Sep 8, 2026
@wscurran

wscurran commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✨ Thanks for the fix. This addresses the sandbox recovery settlement and Hermes forward failure classification. Ready for maintainer review.


Related open issues:

@prekshivyas
prekshivyas force-pushed the codex/nemoclaw-11107-2026-09-05 branch from 4e2dbd1 to cdfee1f Compare September 8, 2026 18:26
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit cdfee1f. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

All previous runs

prekshivyas added a commit that referenced this pull request Sep 8, 2026
<!-- markdownlint-disable MD041 -->
## Outcome

Managed OpenClaw and Hermes recovery now survives delayed container
discovery within one 210-second deadline. It retries only a proven
container-not-found result, keeps identity and diagnostic failures
terminal, and reports sanitized Hermes Portable forward failures without
publishing readiness.

## Reason

A newly created OpenShell sandbox can report Ready before its managed
container is discoverable. The earlier recovery bound could expire
during that valid transition, while broader retry classification could
also hide terminal privileged-control failures.

### Related issues

Fixes #11107.

Replaces #11123.

## Changes

- Distinguish successful no-container discovery from Docker transport
failures and stopped or paused Podman state.
- Share one bounded deadline across managed discovery and startup
settlement while preserving the existing bound for other transitions.
- Keep untyped, malformed, identity, integrity, and diagnostic
privileged-control failures terminal.
- Classify Hermes Portable list, reachability, mutation, settlement, and
occupied-port failures with sanitized operator guidance.
- Add regression coverage for delayed discovery beyond the former bound
and for terminal provider, identity, and forward failures.
- Document the managed recovery deadlines and Hermes-only
forward-recovery actions.

## Verification

- `npm run build:cli` — passed on the final rebased source.
- `npx vitest run
src/lib/actions/sandbox/process-recovery-managed-startup.test.ts
src/lib/actions/sandbox/probe/hermes-portable-forward-recovery.test.ts
test/process-recovery/process-recovery-primitives.test.ts
src/lib/sandbox/privileged-exec.test.ts
src/lib/onboard/runtime-provider/podman.test.ts` — passed 5 files and
181 tests.
- `npx vitest run
test/process-recovery/process-recovery-supervisor-relaunch.test.ts` —
passed 1 file and 28 tests after CI exposed the outdated call
expectation.
- `npx vitest run src/lib/sandbox/privileged-exec.test.ts
src/lib/actions/sandbox/process-recovery-managed-startup.test.ts
test/process-recovery/process-recovery-primitives.test.ts
test/process-recovery/process-recovery-supervisor-relaunch.test.ts` —
passed 4 files and 126 tests after review fixes.
- `npx vitest run test/process-recovery/process-recovery.test.ts
test/cli/connect-recovery.test.ts` — passed 2 files and 22 tests after
correcting the CI expectations.
- `npx vitest run src/lib/sandbox/privileged-exec.test.ts` — passed 1
file and 36 tests after pinning the reviewed ambiguity diagnostic.
- `npx vitest run
test/process-recovery/process-recovery-managed-controller.test.ts
src/lib/sandbox/privileged-exec.test.ts` — passed 2 files and 63 tests
after addressing the exact-head maintainer review.
- `npx vitest run
test/automation/pull-requests/growth-guardrails.test.ts` — passed 1 file
and 45 tests after the review fix.
- `npm run typecheck:cli` — passed after the CI and review fixes.
- `npm run docs` — passed; route validation passed and Fern reported 0
errors and 5 existing warnings.
- Normal `pre-commit` and `commit-msg` hooks — passed, including
repository checks, formatting, lint, growth checks, and gitleaks.
- Normal `pre-push` hook — passed the path-scoped CLI TypeScript check.
- GitHub commit verification — all PR commits are Verified with reason
`valid`.
- Independent documentation writer review — passed on the exact final
commit.
- Secret scan — gitleaks passed; the diff contains no secrets, API keys,
or credentials.

## Review notes

The commit preserves original contributor credit by naming `harjoth
<[email protected]>` as author and `Prekshi Vyas
<[email protected]>` as committer and co-author.

This changes security-sensitive recovery classification. Retries require
a typed, exact sanitized no-container result; process presence, unproved
listeners, captured command output, and ambiguous provider state do not
establish authority.

Accepted scope and validation ownership are recorded in [issue
#11107](#11107 (comment)).

<!-- nemoclaw-docs-review:start -->
- Documentation review: `docs-updated`
- Documentation evidence: `docs/reference/commands.mdx`,
`docs/reference/troubleshooting.mdx`
- Documentation agent: Codex Desktop
<!-- docs-review-head-sha: a26945b -->
<!-- docs-review-agents-blob-sha:
8e61417 -->
<!-- nemoclaw-docs-review:end -->

---
Signed-off-by: harjoth <[email protected]>

Signed-off-by: Prekshi Vyas <[email protected]>

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

## Summary by CodeRabbit

- **Bug Fixes**
- Improved sandbox startup recovery by distinguishing missing containers
from other control failures.
- Added bounded retry handling, shared deadlines, and safer timeout
enforcement.
- Improved portable forwarding diagnostics for occupied ports, invalid
state, failed mutations, reachability issues, and restoration
uncertainty.
- Recovery no longer declares readiness when forwarding state cannot be
verified or restored.
  - Improved detection of stopped and missing sandbox containers.

- **Documentation**
- Added troubleshooting guidance for discovery, startup, forwarding
failures, and authority changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Prekshi Vyas <[email protected]>
Co-authored-by: harjoth <[email protected]>
@prekshivyas

Copy link
Copy Markdown
Collaborator

Thank you for the contribution and the validation work here. This change was carried forward in same-repository PR #11236, which has now merged and closed #11107. Closing this superseded PR in favor of #11236.

@prekshivyas prekshivyas closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(onboard): extend Podman container discovery settlement after OpenShell Ready

3 participants