-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(onboard): pre-approve gateway scope upgrades after onboard and recover #4763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jyaunches
merged 5 commits into
NVIDIA:main
from
TonyLuo-NV:fix/4504-onboard-scope-upgrade-autopair
Jun 9, 2026
+423
−27
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c25fc1
fix(onboard): pre-approve gateway scope upgrades after onboard and re…
TonyLuo-NV 6ab4c05
docs(connect): clarify approve env strips full gateway triplet
TonyLuo-NV 059a9b4
merge: integrate upstream/main into fix/4504-onboard-scope-upgrade-au…
TonyLuo-NV 8bbef2d
Merge branch 'main' into fix/4504-onboard-scope-upgrade-autopair
TonyLuo-NV 7c97388
Merge branch 'main' into fix/4504-onboard-scope-upgrade-autopair
TonyLuo-NV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Budget constants for the connect-time auto-pair scope-approval pass | ||
| // (runConnectAutoPairApprovalPass in ./connect). Kept in a dependency-free leaf | ||
| // module so tests can import and assert the invariant on the real values | ||
| // without pulling in connect.ts's heavy transitive requires (#4504). | ||
|
|
||
| export const CONNECT_AUTO_PAIR_MAX_APPROVALS = 1; | ||
| // `openclaw devices list` budget (seconds), interpolated into the in-sandbox | ||
| // script so the invariant below is asserted on real values, not source text. | ||
| export const CONNECT_AUTO_PAIR_LIST_TIMEOUT_S = 2; | ||
| // `openclaw devices approve` budget (seconds); matches the in-sandbox watcher's | ||
| // RUN_TIMEOUT_SECS = 10 (nemoclaw-start.sh). | ||
| export const CONNECT_AUTO_PAIR_APPROVE_TIMEOUT_S = 10; | ||
| // Outer spawnSync cap (ms). Must exceed the internal worst case | ||
| // (CONNECT_AUTO_PAIR_LIST_TIMEOUT_S + CONNECT_AUTO_PAIR_APPROVE_TIMEOUT_S × | ||
| // CONNECT_AUTO_PAIR_MAX_APPROVALS) PLUS shell/python startup, since the outer | ||
| // timer starts at `sh` spawn before the proxy env is sourced and python3 | ||
| // launches; the ~3s slack means a legitimate slow approve is never SIGKILLed | ||
| // mid-loop, which would strand the allowlisted request. | ||
| export const CONNECT_AUTO_PAIR_TIMEOUT_MS = 15_000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Lazy-require runtime dependencies for the onboarding finalization handler. | ||
| // Kept in a focused module under src/lib/onboard/ so the top-level onboard | ||
| // entrypoint stays lean (codebase-growth-guardrails). The lazy `require` calls | ||
| // avoid an import cycle: connect.ts and process-recovery.ts both pull in | ||
| // onboard helpers, so they must not be statically imported here. | ||
| export const finalizationHandlerDeps = { | ||
| checkAndRecoverSandboxProcesses(name: string, options: { quiet: boolean }): void { | ||
| const processRecovery: typeof import("../actions/sandbox/process-recovery") = | ||
| require("../actions/sandbox/process-recovery"); | ||
| processRecovery.checkAndRecoverSandboxProcesses(name, options); | ||
| }, | ||
| // Best-effort device-approval sweep that clears pending allowlisted | ||
| // CLI/webchat scope upgrades so onboard hands off without a stuck pairing | ||
| // request (#4504). Never throws. | ||
| autoPairScopeApproval(name: string): void { | ||
| const connect: typeof import("../actions/sandbox/connect") = | ||
| require("../actions/sandbox/connect"); | ||
| connect.runConnectAutoPairApprovalPass(name); | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return type mismatch breaks the upstream contract.
The upstream
checkAndRecoverSandboxProcessesfunction returns a structured object with{ checked, wasRunning, recovered, forwardRecovered }fields (seesrc/lib/actions/sandbox/process-recovery.ts:421-545), but this wrapper changes the return type tovoid. This contract break prevents the finalization handler from:checked: false)In
src/lib/actions/sandbox/connect.ts:203-241, the same function's return value is actively used to control probe behavior and user messaging. Even if the current finalization handler doesn't need this information, preserving the return type:🔧 Proposed fix to preserve the upstream return type
📝 Committable suggestion
🤖 Prompt for AI Agents