fix(onboard): drop stale disabled web-search providers - #6531
Conversation
📝 WalkthroughWalkthroughAdds ChangesWeb search disabled provider filtering
Estimated code review effort: 2 (Simple) | ~12 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
bb37e07 to
e270203
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/onboard/sandbox-create-plan.ts`:
- Around line 160-167: `normalizeExtraProvidersForWebSearch` only removes
managed web-search providers when web search is disabled, so stale entries can
survive provider switches. Update this helper to also filter out managed
providers that do not match `webSearchConfig.provider` when a web search config
is present, keeping only the selected provider’s managed extra provider and
discarding old state. Use `normalizeExtraProvidersForWebSearch`,
`MANAGED_WEB_SEARCH_EXTRA_PROVIDERS`, and `webSearchConfig.provider` to locate
the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: fdd24d8e-9630-4ef0-83bf-e49feddba6be
📒 Files selected for processing (4)
src/lib/onboard.tssrc/lib/onboard/sandbox-create-plan.test.tssrc/lib/onboard/sandbox-create-plan.tstest/onboard.test.ts
Signed-off-by: Ho Lim <subhoya@gmail.com>
e270203 to
81556b1
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/onboard/sandbox-create-plan.test.ts (1)
592-631: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd explicit coverage for
webSearchConfig: null(the actual bug scenario).This test covers the "provider selected" filtering branch (brave selected, tavily/brave-search filtered per selection). But the linked issue's actual failure mode is
webSearchConfig: null(web search disabled entirely), wherenormalizeExtraProvidersForWebSearchshould strip bothbrave-searchandtavily-searchwhile keepingcustom-provider. Adding a sibling test case assertingproviderArgsexcludes both managed providers whenwebSearchConfigisnullwould directly pin down the regression this PR fixes at the unit level, rather than relying only on the higher-leveltest/onboard.test.tsassertion.Want me to draft the additional
webSearchConfig: nulltest case?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/onboard/sandbox-create-plan.test.ts` around lines 592 - 631, Add a sibling unit test in prepareSandboxCreatePlan coverage for the actual disabled-web-search case by setting webSearchConfig to null and asserting normalizeExtraProvidersForWebSearch removes both managed providers. Reuse prepareSandboxCreatePlan and inspect result.createArgs/providerArgs the same way as the existing test, but verify only custom-provider remains when webSearchConfig is null.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/onboard/sandbox-create-plan.test.ts`:
- Around line 592-631: Add a sibling unit test in prepareSandboxCreatePlan
coverage for the actual disabled-web-search case by setting webSearchConfig to
null and asserting normalizeExtraProvidersForWebSearch removes both managed
providers. Reuse prepareSandboxCreatePlan and inspect
result.createArgs/providerArgs the same way as the existing test, but verify
only custom-provider remains when webSearchConfig is null.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: b9480918-0607-424e-bb61-5091a6fff5c0
📒 Files selected for processing (4)
src/lib/onboard.tssrc/lib/onboard/sandbox-create-plan.test.tssrc/lib/onboard/sandbox-create-plan.tstest/onboard.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/lib/onboard.ts
- test/onboard.test.ts
- src/lib/onboard/sandbox-create-plan.ts
cjagwani
left a comment
There was a problem hiding this comment.
Two blockers remain on exact head 81556b12a7ccfd84704973a7392d11df641a67b2.
- The new name-based ownership rule is incorrect and regresses the documented Deep Agents flow. Bare
tavily-searchis a user-registered, gateway-wide extra provider created bynemoclaw credentials add tavily-search ...; it is recorded inregistry.listExtraProviders()and intentionally attaches to every later build/rebuild. Managed OpenClaw/Hermes web-search providers are instead sandbox-scoped (<sandbox>-brave-search/<sandbox>-tavily-search) and travel through the messaging/provider preparation path. Because Deep Agents haswebSearchConfig: null,normalizeExtraProvidersForWebSearch()now silently drops exactly its documentedtavily-searchcredential provider. Conversely, if Tavily is selected, a stale missing baretavily-searchremains and can still reproduce the original create failure.
Please preserve healthy user-owned extra providers and reconcile stale state by provider existence or explicit provenance rather than reserving bare names. Add regression coverage that (a) a valid gateway-wide tavily-search extra provider still attaches for Deep Agents / disabled managed web search and (b) a missing stale entry cannot break create regardless of the current managed web-search choice. The existing null-config integration assertion covers the reported symptom but not this ownership contract.
- The exact-head DCO gate failed in run 28988332864 because the PR body has only a checkbox. Please add the literal contributor declaration yourself:
Signed-off-by: Ho Lim <subhoya@gmail.com>. The commit itself is already signed and GitHub-verified; this request is only for the required PR-body declaration.
Local clean-merge validation otherwise passed the focused planner (12/12) and onboard (65/65) suites. The manually dispatched advisors failed on provider 429s and produced no verdict; those infrastructure failures are not code blockers.
|
Superseded by a clean current-main replacement that preserves this narrow implementation and credits Ho Lim as co-author. The replacement uses a GitHub-verified, signed/DCO-compliant commit and has completed targeted plus aggregate validation; I will link it here as soon as GitHub creates the PR. |
|
Replacement opened as #6587. It preserves the narrow provider-filtering implementation, credits Ho Lim as co-author, and uses a GitHub-verified signed/DCO-compliant commit from current main. |
<!-- markdownlint-disable MD041 --> ## Summary Reconcile registry-recorded extra providers against the authoritative OpenShell gateway list before sandbox creation. This prevents a stale `tavily-search` record from breaking onboarding while preserving every healthy gateway-wide user provider. The PR replaces #6531, preserves Ho Lim's original issue work, and credits Shawn Xie's provider-reconciliation direction from #6518. ## Related Issue Fixes #6501. ## Changes - Query `provider list -g <gateway> --names` once when registry extras exist. - Attach only exact provider names returned by a successful authoritative list. - Preserve all recorded providers if the gateway query fails or throws, avoiding silent user-state loss during an outage. - Keep local registry state unchanged; reconciliation affects only the current sandbox-create plan. - Preserve healthy bare `brave-search`, `tavily-search`, custom, and bridge providers without treating their names as NemoClaw-owned. - Add focused and spawn-level regressions for healthy providers, stale records, exact-name matching, gateway scoping, and fail-open behavior. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: this silently restores the documented provider source-of-truth contract without adding or changing a command, option, output, configuration, or remediation step. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — exact-name gateway reconciliation was independently audited; it avoids diagnostic regexes, preserves healthy user-owned providers, fails open on gateway-list failure, and does not mutate registry state. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior — 17 focused reconciliation tests and all 65 onboard integration tests passed. - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) Additional exact-head validation: CLI type-check, file/commit/push hooks, commitlint, test-size/source-shape budgets, secret scan, and `npm run check:diff` passed. Documentation review found no update required. `src/lib/onboard.ts` is net-neutral. --- Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Sandbox creation now better matches configured providers to what’s actually available, reducing unexpected provider options during onboarding. * **Bug Fixes** * Fixed cases where stale or unavailable extra providers could still appear in sandbox setup. * Improved behavior when provider lookup fails, helping preserve previously configured choices instead of removing them unexpectedly. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> Co-authored-by: Ho Lim <subhoya@gmail.com> Co-authored-by: Shawn Xie <shaxie@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary Reconcile registry-recorded extra providers against the authoritative OpenShell gateway list before sandbox creation. This prevents a stale `tavily-search` record from breaking onboarding while preserving every healthy gateway-wide user provider. The PR replaces NVIDIA#6531, preserves Ho Lim's original issue work, and credits Shawn Xie's provider-reconciliation direction from NVIDIA#6518. ## Related Issue Fixes NVIDIA#6501. ## Changes - Query `provider list -g <gateway> --names` once when registry extras exist. - Attach only exact provider names returned by a successful authoritative list. - Preserve all recorded providers if the gateway query fails or throws, avoiding silent user-state loss during an outage. - Keep local registry state unchanged; reconciliation affects only the current sandbox-create plan. - Preserve healthy bare `brave-search`, `tavily-search`, custom, and bridge providers without treating their names as NemoClaw-owned. - Add focused and spawn-level regressions for healthy providers, stale records, exact-name matching, gateway scoping, and fail-open behavior. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: this silently restores the documented provider source-of-truth contract without adding or changing a command, option, output, configuration, or remediation step. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — exact-name gateway reconciliation was independently audited; it avoids diagnostic regexes, preserves healthy user-owned providers, fails open on gateway-list failure, and does not mutate registry state. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior — 17 focused reconciliation tests and all 65 onboard integration tests passed. - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) Additional exact-head validation: CLI type-check, file/commit/push hooks, commitlint, test-size/source-shape budgets, secret scan, and `npm run check:diff` passed. Documentation review found no update required. `src/lib/onboard.ts` is net-neutral. --- Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Sandbox creation now better matches configured providers to what’s actually available, reducing unexpected provider options during onboarding. * **Bug Fixes** * Fixed cases where stale or unavailable extra providers could still appear in sandbox setup. * Improved behavior when provider lookup fails, helping preserve previously configured choices instead of removing them unexpectedly. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> Co-authored-by: Ho Lim <subhoya@gmail.com> Co-authored-by: Shawn Xie <shaxie@nvidia.com>
Summary
webSearchConfig: nullas an authoritative managed web-search disable when preparing sandbox create providersbrave-search/tavily-searchextra providers while preserving unrelated custom extra providerstavily-searchregistry entry no longer reachesopenshell sandbox createwhen web search is disabledTests
npm run build:clinpx vitest run src/lib/onboard/sandbox-create-plan.test.ts test/onboard.test.tsnpx vitest run test/onboard.test.ts -t "builds the sandbox without uploading an external OpenClaw config file"npm run check:diffDCO
Signed-off-by.Closes #6501
Summary by CodeRabbit