Repository navigation
fix(openclaw): exit devices approve after local fallback - #12178
Conversation
Adopt the vetted contribution from PR #12109 and retain its regression coverage. Co-authored-by: Cestercian <yashafaid@gmail.com> Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com>
…/adopt-12109 Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com>
|
This repository limits you to 10 open pull requests. Please close or merge an existing PR before opening another one. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA/NemoClaw/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe patch drains approval output streams and exits successfully after OpenClaw device approval. It applies this behavior across patch layouts and upgrades. Tests cover human-readable and JSON output, child-process termination, marker validation, and idempotent upgrades. ChangesDevice approval exit handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Warning Some tools did not complete. Review the errors below. 🔧 Checkov (3.3.16)DockerfileCheckov output exceeded the maximum buffer for this file Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall line coverage in commit 16947cd in the TypeScript / code-coverage/cliThe overall line coverage in commit 16947cd in the Show a line coverage summary of the most impacted files.
Updated |
|
@coderabbitai review |
✅ Action performedReview finished.
|
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed exact head ae57eae. I found no blocking runtime defect in this change. I verified the patch against the real OpenClaw 2026.9.1 distribution: the forced exit is inserted immediately after the awaited approvePairingWithFallback result, the patch audit reports 7 OK and 0 missing, and the focused suite passes 97/97 tests. CodeRabbit also reports no actionable comments.
Two follow-ups remain, but I do not consider either proof that the implementation is broken: align the Dockerfile removal criteria with the new exit requirement, and consider extending the subprocess test through the local-fallback producer. I would wait to approve until the repository Advisor blockers and the currently failing growth-guardrail check are cleared.
|
PR Review Advisor finished for commit Request review only when Require no Advisor blockers is green. |
<!-- markdownlint-disable MD041 --> ## Outcome OpenClaw device approval no longer hangs after a durable approval, and uncertain output delivery exits nonzero instead of reporting false success. The runtime patch now validates its complete installed shape, including the explicit-admin scope-upgrade behavior. The OpenClaw 2026.9.1 CLI bootstrap still settles its bounded non-admin scopes automatically. A same-device local CLI upgrade to `operator.admin` remains pending for explicit approval. The managed-image activation gate now captures the exact request ID from that failed agent turn, approves only that request through `nemoclaw <sandbox> connect`, retries the normal agent turn, and still requires `PONG`. ## Reason PR #12178 fixed the reported approval hang, but follow-up E2E and automated review exposed several adjacent defects: direct approval retained handles, delayed exit regressed onboarding, stalled or failed stream callbacks could hide uncertain delivery, marker-only validation could accept damaged patches, the operational snapshot read a retired JSON identity, malformed pairing records could look settled, and OpenClaw silently approved the later CLI admin upgrade. Exact-head managed-image run `35722871242` then showed that the repaired authorization boundary invalidated the general activation gate's old assumption. Both Docker and rootless Podman reached OpenClaw and correctly stopped at `scope upgrade pending approval`; direct managed startup and cleanup passed. This was a candidate-caused test-contract failure, not a runner or platform flake. ### Related issues Refs #12064 Follow-up to #12178. ## Changes - Validate exactly one approval-exit marker and the complete expected handler before accepting an installed patch. - Exit `0` only after both output callbacks confirm delivery; exit `1` on callback error, synchronous write failure, or the referenced one-second timeout. - Migrate the previously shipped unbounded and prior scope-upgrade patches, reject unknown or structurally changed shapes, and prove reapplication is byte-for-byte idempotent. - Keep bounded non-admin CLI bootstrap settlement automatic while routing the closed same-device `operator.admin` upgrade through explicit approval. - Read canonical OpenClaw SQLite pairing state through the reviewed adapter, reject malformed records, and keep sensitive values out of diagnostics. - Make the managed activation gate prove the pending-admin outcome, bind approval to the single UUID emitted by that failed turn, approve it through the existing operator connect boundary, and retry the user-facing agent command. - Preserve the existing focused issue #4462 approval flow while teaching its strict selector to use canonical SQLite identity state. ## Verification - Focused OpenClaw patch tests passed on `82a21f121711e26872f2a33aed2823720e95591b`: 15 tests across the current-layout and migration suites. - Focused E2E-support tests passed: 27 tests across the approval fixture, canonical snapshot, and managed activation diagnostics suites. - `npm run test:changed` passed: the 7-test growth-guardrail lane and 27 selected E2E-support tests passed. - `npm run e2e:assertions:check` passed without increasing the live E2E assertion budget. - `npm run validate:pr`, commit hooks, and pre-push validation passed, including repository checks, source-shape budgets, publication validation, builds, and CLI TypeScript checks. - GitHub marks `82a21f121711e26872f2a33aed2823720e95591b` as Verified. - The 11-file diff from `main` contains no secrets, API keys, or credentials. - Focused E2E run `35686303357` on prior commit `e9028a90d745a9a32ff5bf457498d31f6697a052` proved delayed exit regressed direct approval; bindings were exact and cleanup completed. - Focused E2E run `35708085195` on `b1a526bac125f7a98dfb5015db935459de7a36be` exposed the stale JSON-only identity probe; bindings were exact and cleanup completed. - Focused E2E run `35718399558` on `a7372929b2a2cc3ebcd0fb39a85ce91f638c3cef` exposed silent CLI admin elevation; bindings were exact and cleanup completed. - Managed-image run `35722871242` on `59cdf7cd44802eec83adeec6601ce7ed85480481` published the exact candidate, passed direct startup, and failed both exact activation jobs at the newly required explicit-admin boundary with complete cleanup. ## Review notes Sensitive paths: `scripts/patch-openclaw-device-self-approval.mts` and the OpenClaw managed activation approval gate. CodeRabbit's exact-shape, observable-outcome, and idempotence findings on `59cdf7cd44802eec83adeec6601ce7ed85480481` are addressed in `82a21f121711e26872f2a33aed2823720e95591b`. Exact-head source CI run `35729243783` and managed-image publication run `35729243593` are pending. CodeRabbit, all PR Review Advisor specialists, and the focused manual E2E target `issue-4462-scope-upgrade-approval` must be clear for this unchanged commit before the draft is ready. --- Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved device approval handling for output-drain failures, stalled output, and premature exits. - Preserved safe, repeatable approval-flow updates and rejected incomplete or structurally invalid updates. - Expanded eligible administrator-scope approvals while retaining safeguards for other requests. - Strengthened pairing-state validation so malformed or incomplete records fail clearly. - Added clearer administrator-approval failure diagnostics while protecting sensitive data from output. - **Tests** - Expanded end-to-end coverage for approvals, pairing state, request validation, and secret redaction. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Signed-off-by: Rebecca Sliter <rsliter@nvidia.com> Co-authored-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com> Co-authored-by: Prekshi Vyas <prekshiv@nvidia.com>
Outcome
openclaw devices approvenow exits successfully after its approval output is fully written, including when a failed gateway connection leaves Node handles open. Both human-readable and JSON output paths are covered.Reason
The local fallback printed
Approvedand returned without callingdefaultRuntime.exit(0). Leftover gateway handles could therefore keep the CLI alive and leavenemoclaw connectwaiting indefinitely.Related issues
Fixes #12064
Adopts the vetted contribution from #12109 onto a same-repository branch so required SDK-backed CI can run. Original contributor attribution is preserved in the commit.
Changes
Verification
npx vitest run --project integration test/agents/openclaw/openclaw-device-self-approval-patch-upgrade.test.ts test/agents/openclaw/openclaw-device-self-approval-output-exit.test.ts test/agents/openclaw/openclaw-device-self-approval-patch.test.ts(97 tests passed)npm run validate:pr(passed on the exact adoption branch after refreshing canonicalmain)DCO Sign-Off
Signed-off-by: Rebecca Sliter 571084+rsliter@users.noreply.github.com
Summary by CodeRabbit
Bug Fixes
Tests