-
Notifications
You must be signed in to change notification settings - Fork 3.1k
refactor(arch): add named timeout constants for openshell execution #2683
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 4 commits into
NVIDIA:main
from
jyaunches:issue-2562-unified-timeout-openshell
Apr 29, 2026
+133
−15
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
de124f4
refactor(arch): add named timeout constants for openshell execution
jyaunches d8fe1a3
fix: apply CodeRabbit suggestion — use strict comparison for DOWNLOAD…
jyaunches 6e67943
refactor(arch): bound status/recovery hot path with probe timeouts
jyaunches fdc59a0
fix(review): use OPENSHELL_OPERATION_TIMEOUT_MS for gateway select calls
jyaunches 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { | ||
| OPENSHELL_DOWNLOAD_TIMEOUT_MS, | ||
| OPENSHELL_HEAVY_TIMEOUT_MS, | ||
| OPENSHELL_OPERATION_TIMEOUT_MS, | ||
| OPENSHELL_PROBE_TIMEOUT_MS, | ||
| } from "./openshell-timeouts"; | ||
|
|
||
| describe("openshell-timeouts", () => { | ||
| it("exports positive integer constants", () => { | ||
| const constants = [ | ||
| OPENSHELL_PROBE_TIMEOUT_MS, | ||
| OPENSHELL_OPERATION_TIMEOUT_MS, | ||
| OPENSHELL_HEAVY_TIMEOUT_MS, | ||
| OPENSHELL_DOWNLOAD_TIMEOUT_MS, | ||
| ]; | ||
|
|
||
| for (const value of constants) { | ||
| expect(value).toBeTypeOf("number"); | ||
| expect(value).toBeGreaterThan(0); | ||
| expect(Number.isInteger(value)).toBe(true); | ||
| } | ||
| }); | ||
|
|
||
| it("maintains expected ordering: PROBE < OPERATION <= DOWNLOAD < HEAVY", () => { | ||
| expect(OPENSHELL_PROBE_TIMEOUT_MS).toBeLessThan(OPENSHELL_OPERATION_TIMEOUT_MS); | ||
| expect(OPENSHELL_OPERATION_TIMEOUT_MS).toBeLessThanOrEqual(OPENSHELL_DOWNLOAD_TIMEOUT_MS); | ||
| expect(OPENSHELL_DOWNLOAD_TIMEOUT_MS).toBeLessThan(OPENSHELL_HEAVY_TIMEOUT_MS); | ||
| }); | ||
|
|
||
| it("uses the same probe constant name as PR #2454 for forward compatibility", () => { | ||
| // PR #2454 introduces OPENSHELL_PROBE_TIMEOUT_MS = 15_000 locally. | ||
| // This ensures the shared module stays aligned so #2454 can import it after rebase. | ||
| expect(OPENSHELL_PROBE_TIMEOUT_MS).toBe(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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| /** | ||
| * Named timeout constants for openshell child-process execution. | ||
| * | ||
| * Every openshell CLI call should use one of these categories rather than | ||
| * raw millisecond literals. This ensures consistent behaviour across all | ||
| * call sites and makes it easy to tune timeouts from a single location. | ||
| * | ||
| * Categories: | ||
| * PROBE — read-only queries that should return instantly (list, status, info, ssh-config) | ||
| * OPERATION — mutating commands (provider CRUD, forward start/stop, gateway select) | ||
| * HEAVY — destructive or long-running (sandbox delete, gateway destroy, build) | ||
| * DOWNLOAD — file transfers over the sandbox SSH tunnel (config download) | ||
| */ | ||
|
|
||
| /** Quick probe — sandbox list, status, gateway info, forward list, ssh-config */ | ||
| export const OPENSHELL_PROBE_TIMEOUT_MS = 15_000; | ||
|
|
||
| /** Mutating operations — provider create/delete, gateway select, forward start/stop */ | ||
| export const OPENSHELL_OPERATION_TIMEOUT_MS = 30_000; | ||
|
|
||
| /** Heavy operations — sandbox delete, gateway destroy, full build */ | ||
| export const OPENSHELL_HEAVY_TIMEOUT_MS = 60_000; | ||
|
|
||
| /** Sandbox download (config file fetch over SSH) */ | ||
| export const OPENSHELL_DOWNLOAD_TIMEOUT_MS = 30_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
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.
Uh oh!
There was an error while loading. Please reload this page.