fix(onboard): preserve tier-default brave/tavily on re-onboard reuse - #6855
fix(onboard): preserve tier-default brave/tavily on re-onboard reuse#6855yanyunl1991 wants to merge 1 commit into
Conversation
On the re-onboard reuse path, a Balanced-tier default preset that doubles as a built-in web-search provider preset (`brave`, `tavily`) was silently dropped even when the policy tier and web-search choice were unchanged. The other tier defaults (`npm`, `pypi`, `huggingface`, `brew`) persisted, so only the search-provider egress (e.g. `api.search.brave.com`) was narrowed out of the reapplied set. Root cause: `isStaleBuiltinWebSearchPolicyPreset` treats `brave`/`tavily` as a stale web-search leftover whenever no matching web-search provider is configured, without distinguishing the case where the same preset is a default egress preset of the tier being applied. `preparePolicyPresetResume- Selection` pruned it, which forced a reconcile and a reapply that dropped it. Fix: add a `tierDefaultPresetNames` exemption to the staleness predicate and thread the recorded tier's defaults through the resume-selection prune and the reuse reapply prune. A preset that is a default of the applied tier is a tier egress default, not a stale web-search leftover, so it is preserved regardless of the web-search provider choice. The Restricted tier lists no such default, so a genuinely stale `brave`/`tavily` there still prunes, and provider-switch replacement (brave -> tavily) still adds the active provider. Fixes #6844 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe onboarding flow now resolves tier default preset names during resume and passes them through stale-preset detection and unavailable-preset pruning. Built-in web-search presets matching tier defaults are preserved, with tests covering Balanced and Restricted tier behavior. ChangesTier-default preset preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Onboard
participant ResumeSelection
participant Tiers
participant PresetReconciliation
Onboard->>ResumeSelection: provide policies and tiers
ResumeSelection->>Tiers: resolve tier presets
Tiers-->>ResumeSelection: return tier default names
ResumeSelection->>PresetReconciliation: evaluate presets with tier defaults
PresetReconciliation-->>ResumeSelection: preserve or prune presets
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage remains at 96%, unchanged from the Updated |
PR Review Advisor — InformationalAdvisor assessment: Informational / medium confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: 2 optional E2E recommendations
1 warning · 0 suggestionsWarningsWarnings do not block.
|
|
Superseded by #6856 (same fix, commit re-signed for the DCO check). Closing this one. |
Summary
On the re-onboard reuse path, the Balanced-tier default preset
brave(Brave Search API access) was silently dropped even when the policy tier (Balanced) and the web-search choice (No web search) were unchanged from the initial onboard. The other four Balanced defaults (npm,pypi,huggingface,brew) persisted — onlybravewas narrowed out of the reapplied set, removing its egress (api.search.brave.com).Fixes #6844.
Root cause
isStaleBuiltinWebSearchPolicyPresettreatsbrave/tavilyas a stale web-search leftover whenever no matching web-search provider is configured. It did not account for the case where the same preset is also a default egress preset of the tier being applied. On reuse,preparePolicyPresetResumeSelectionprunedbraveunder this rule, which flippedrecordedPolicyPresetsNeedReconcileto true and drove a reapply whose set omittedbrave.Fix
tierDefaultPresetNamesexemption toisStaleBuiltinWebSearchPolicyPreset: a preset that is a default of the tier being applied is a tier egress default, not a stale web-search leftover, so it is kept regardless of the web-search provider choice.preparePolicyPresetResumeSelection) and the reuse reapply prune (createUnavailablePolicyPresetPrunervia the pruning options).The change is scoped to the reuse/resume path; fresh-onboard suggestion behavior is unchanged.
Behavior preserved
brave/tavilydefault, so a genuinely stale preset there still prunes.Testing
policy-resume-selection.test.ts: brave preserved on Balanced reuse with web search off (no reconcile); still pruned on Restricted; kept on Balanced alongside a switched-intavily.onboardpolicy/tier/preset test suites pass (118 tests across 12 files);build:cli+typecheckgreen.braveapplied, then re-onboarded via the reuse path.npm, pypi, huggingface, brew→Removed preset: brave→ brave inactive.npm, pypi, huggingface, brew, brave→ brave stays active ([from balanced tier]), no egress narrowing.The reporter's environment is DGX Station (aarch64); the reapply logic is platform-independent (verified byte-identical on the paths exercised), but cross-arch confirmation on aarch64 was not separately run.
Summary by CodeRabbit
Bug Fixes
Tests