fix(link-daintree): correct family-gate fallback in fan-out import#153
fix(link-daintree): correct family-gate fallback in fan-out import#153
Conversation
When inferring a family from preset env (e.g. ANTHROPIC_* → "anthropic"), the findVanilla() pool construction erroneously returned [] instead of all candidates when no vanilla slot matched the inferred family. Fix: change pool construction from: familyMatch.length ? familyMatch : (family ? [] : candidates) to: familyMatch.length ? familyMatch : candidates The family gate is still respected when matches exist; when it doesn't, we correctly fall back to all candidates sorted by daintree_preset_id then numeric suffix. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
WalkthroughDocumentation updates for a bug fix in the ChangesLink-Daintree Fan-Out Fallback Fix Documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes /nf:link-daintree fan-out import behavior so Daintree presets are not silently skipped when the inferred provider “family” doesn’t match any vanilla slot provider.
Changes:
- Update
findVanilla()fallback logic to use all vanilla candidates when no family match exists (instead of an empty pool). - Add a changelog entry for version
0.43.1documenting the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| commands/nf/link-daintree.md | Fixes the vanilla-slot selection fallback so family mismatch no longer prevents preset import. |
| CHANGELOG.md | Documents the patch release and describes the link-daintree fan-out fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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)
commands/nf/link-daintree.md (1)
482-496:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEnsure
findVanilla()really searches “vanilla slots” (exclude preset-linked clones).Right now
findVanilla()definescandidatesas all providers withmainTool === agentName, which includes preset-linked clones (daintree_preset_idset). The new fallback (pool = familyMatch.length ? familyMatch : candidates) means that if there are no true vanilla providers for thatmainTool,pool[0]can come back as a clone. Then the “add” path will clone that provider and append— Daintree preset: ..., which can compound descriptions and use clone env/model as the base.To align with the stated objective (“fall back to all candidate vanilla slots”), filter candidates to only those without
daintree_preset_id:🔧 Proposed change
function findVanilla(agentName, family) { - const candidates = providersData.providers.filter(p => p.mainTool === agentName); - const familyMatch = family ? candidates.filter(p => p.provider === family) : candidates; - const pool = familyMatch.length ? familyMatch : candidates; - // Prefer provider without daintree_preset_id, then lowest numeric suffix + const candidates = providersData.providers.filter( + p => p.mainTool === agentName && !p.daintree_preset_id + ); + const familyMatch = family ? candidates.filter(p => p.provider === family) : candidates; + const pool = familyMatch.length ? familyMatch : candidates; + // Prefer the lowest numeric suffix (all in this pool are true vanilla slots) pool.sort((a, b) => { - const aIsClone = !!a.daintree_preset_id; - const bIsClone = !!b.daintree_preset_id; - if (aIsClone !== bIsClone) return aIsClone ? 1 : -1; const an = parseInt((a.name.match(/-(\d+)$/) || [])[1] || '0', 10); const bn = parseInt((b.name.match(/-(\d+)$/) || [])[1] || '0', 10); return an - bn; }); return pool[0] || null; }This keeps your family-mismatch fallback behavior, while preventing clone-as-base edge cases.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@commands/nf/link-daintree.md` around lines 482 - 496, The function findVanilla currently builds candidates from providersData.providers using mainTool === agentName but does not exclude providers that have daintree_preset_id, so the fallback can pick preset-linked clones; modify findVanilla to filter candidates to only providers without daintree_preset_id (i.e., exclude entries where daintree_preset_id is truthy) before applying the family filter/sorting, preserving the existing familyMatch and pool fallback logic and leaving the sort/return behavior unchanged.
🤖 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 `@commands/nf/link-daintree.md`:
- Around line 482-496: The function findVanilla currently builds candidates from
providersData.providers using mainTool === agentName but does not exclude
providers that have daintree_preset_id, so the fallback can pick preset-linked
clones; modify findVanilla to filter candidates to only providers without
daintree_preset_id (i.e., exclude entries where daintree_preset_id is truthy)
before applying the family filter/sorting, preserving the existing familyMatch
and pool fallback logic and leaving the sort/return behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0b23e4d3-9b8b-4923-9e0c-8ca91df3e938
📒 Files selected for processing (2)
CHANGELOG.mdcommands/nf/link-daintree.md
Summary
/nf:link-daintreewhere presets were silently skipped becausefindVanilla()returned[]when the inferred family didn't match any vanilla slot'sproviderfieldTest plan
/nf:link-daintreewith a Daintree config that has presets for an agent whose vanilla slots haveprovider=claude(notanthropic) — confirm presets are imported, not skipped/nf:link-daintree— confirm idempotency (existing preset-linked slots updated in place, no duplicates)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes - Version 0.43.1