fix(onboard): persist model and provider per sandbox in registry (#1689)#1975
fix(onboard): persist model and provider per sandbox in registry (#1689)#1975
Conversation
📝 WalkthroughWalkthroughThe changes add model and provider field persistence to per-sandbox registry records during onboarding, modify the setupInference call to receive the sandbox name instead of a gateway constant, and refactor the deduplication logic in the uninstall script to use string matching instead of Bash associative arrays. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/onboard.ts (1)
5395-5402:⚠️ Potential issue | 🟡 MinorAdd explicit guard or clarify that setupInference's updateSandbox call is intentional before sandbox creation.
setupInference (line 3717) calls
registry.updateSandbox(sandboxName, { model, provider })at line 3865. On a fresh run,sandboxNameisnullhere (initialized at line 5335, not assigned untilcreateSandbox()at line 5474). However,updateSandbox()safely no-ops because its guard checksif (!data.sandboxes[name]) return false;, which catches the null/missing entry case. The pattern is already documented at lines 5487-5488 (referencing issue#1881), but this earlier call site lacks that context. Either add an explicit guard likeif (sandboxName) registry.updateSandbox(...)before thesetupInference()call, or add a clarifying comment explaining the intentional deferred update.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard.ts` around lines 5395 - 5402, The call to setupInference(sandboxName, model, provider, endpointUrl, credentialEnv) may cause registry.updateSandbox(sandboxName, { model, provider }) inside setupInference (via the updateSandbox call in that function) before sandboxName is set by createSandbox(); add an explicit guard or clarifying comment: either wrap the setupInference invocation with a check if (sandboxName) to avoid passing null to setupInference/registry.updateSandbox, or leave the call but add a concise comment at the startRecordedStep/setupInference call site noting that setupInference intentionally calls registry.updateSandbox and that updateSandbox no-ops when the sandbox is not yet registered (referencing createSandbox and the existing guard in updateSandbox) so reviewers know this is deliberate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/lib/onboard.ts`:
- Around line 5395-5402: The call to setupInference(sandboxName, model,
provider, endpointUrl, credentialEnv) may cause
registry.updateSandbox(sandboxName, { model, provider }) inside setupInference
(via the updateSandbox call in that function) before sandboxName is set by
createSandbox(); add an explicit guard or clarifying comment: either wrap the
setupInference invocation with a check if (sandboxName) to avoid passing null to
setupInference/registry.updateSandbox, or leave the call but add a concise
comment at the startRecordedStep/setupInference call site noting that
setupInference intentionally calls registry.updateSandbox and that updateSandbox
no-ops when the sandbox is not yet registered (referencing createSandbox and the
existing guard in updateSandbox) so reviewers know this is deliberate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 19ab9882-d93b-487f-b174-722e0dce989b
📒 Files selected for processing (2)
src/lib/onboard.tsuninstall.sh
ericksoa
left a comment
There was a problem hiding this comment.
LGTM. Three clean fixes:
-
setupInference()call:GATEWAY_NAME→sandboxName— theregistry.updateSandbox()insidesetupInference()(line 3959) was silently no-oping because no sandbox entry has the gateway name. Clear bug. -
registerSandbox()increateSandbox(): Addingmodelandproviderto the initial entry is the right call — these should be recorded at creation time, not deferred to a laterupdateSandbox. -
uninstall.shBash 3.2 compat: Thelocal -A→ string-based dedup is portable and correct. Theset -uguard on empty arrays is also needed.
Note: this will need a trivial merge with #1967 which also modifies the registerSandbox() call in createSandbox() (adds providerCredentialHashes). No semantic conflict — just adjacent lines.
Summary
nemoclaw listandnemoclaw statusshow incorrect model/provider information for multi-sandbox setups because (1)setupInference()writes the registry update to the gateway name"nemoclaw"instead of the actual sandbox name, silently no-oping, and (2)registerSandbox()increateSandbox()never includesmodelorproviderin the initial entry. This PR fixes both issues and also fixes a Bash 3.2 compatibility regression inuninstall.shintroduced by #1957.Related Issue
Fixes #1689
Changes
src/lib/onboard.ts(line ~5397): PasssandboxNameinstead ofGATEWAY_NAMEtosetupInference()so the internalregistry.updateSandbox()call writes model/provider to the correct sandbox entry.src/lib/onboard.ts(line ~3005): Includemodelandproviderin theregisterSandbox()call insidecreateSandbox()so the initial registry entry is born with the correct inference config.uninstall.sh(line ~327): Replacelocal -A(Bash 4+ associative array) with a portable string-based dedup that works on macOS Bash 3.2, and guard empty-array iteration againstset -uunbound variable errors.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)AI Disclosure
Signed-off-by: Brandon Pelfrey bpelfrey@nvidia.com
Summary by CodeRabbit