Repository navigation
fix(recovery): settle delayed startup and classify forward failures - #11123
harjothkhara wants to merge 2 commits into
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughManaged 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. ChangesManaged gateway recovery
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 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
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation Most changes support issue Full details: Docstring CoverageExplanation 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 💡
🧪 Generate unit tests (beta)
Comment |
9f3d98e to
dc137f5
Compare
|
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. |
629be2e to
2eef27e
Compare
973a0ee to
4e2dbd1
Compare
|
✨ Thanks for the fix. This addresses the sandbox recovery settlement and Hermes forward failure classification. Ready for maintainer review. Related open issues: |
Co-authored-by: harjoth <[email protected]> Signed-off-by: harjoth <[email protected]> Signed-off-by: Prekshi Vyas <[email protected]>
4e2dbd1 to
cdfee1f
Compare
|
PR Review Advisor finished for commit |
<!-- 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]>
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_UNAVAILABLEduring 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
PRIVILEGED_CONTROL_UNAVAILABLEobservation 21 attempts (about 60 seconds at the default 3-second interval) without consuming the existing 11-attempt allowance for other retryable startup transitions.forward-occupied, unavailable/ambiguous forward state, recovery failure, restoration failure, and authority drift in sanitized user-facing diagnostics.Verification
Exact candidate:
4e2dbd1bccbae0b1d4465739e791a2d2f2ed0e92Exact base:
7fe4a76c4e434bd2ba550b9e7b29235c52a94fd9npm 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.b9a33923-386c-405f-92f8-4fa2e1cf1608: five SHA-bound credential-free cases completed withpassed: 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.mainbase/managed image publication completed successfully before E2E dispatch. The post-reboot target reportedpassed: 0,skipped: 1and is deliberately not counted as evidence.Review notes
Signed-off-by: harjoth [email protected]