fix(quorum): backport CLI fallback to probe-quorum-slots#180
Conversation
probe-quorum-slots.cjs would crash with `spawn: file argument must be of type string. Received null` when invoked because `provider.cli` is null for all 5 sub slots (codex-1, gemini-1, opencode-1, copilot-1, claude-1) in the canonical providers.json. PR #164 fixed this in call-quorum-slot via a `resolvedCli || cli || mainTool` fallback chain — this patch applies the same fix to the probe script. Also backports the findProviders() skip-empty + canonical-first ordering from PR #165 so the repo's empty `bin/providers.json` skeleton doesn't short-circuit the search before the real installed providers.json is found. Surfaced by a /nf:quorum self-test run where codex-1 caught the gap; 6/6 voters reached consensus that hot-path was fine but the probe tool needed the same backport. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Walkthrough
ChangesQuorum slot probing with CLI resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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)
bin/probe-quorum-slots.cjs (1)
35-38:⚠️ Potential issue | 🟠 Major | ⚡ Quick winKeep the canonical providers file first.
Line 38 prepends
path.dirname(serverScript)/providers.json, so a non-empty sibling file can still override~/.claude/nf/bin/providers.json. That undermines the canonical-first lookup this backport is trying to restore and can make the probe read a stale repo/local config instead of the live quorum config.Suggested fix
try { const claudeJson = JSON.parse(fs.readFileSync(path.join(os.homedir(), '.claude.json'), 'utf8')); const u1args = claudeJson?.mcpServers?.['unified-1']?.args ?? []; const serverScript = u1args.find(a => typeof a === 'string' && a.endsWith('unified-mcp-server.mjs')); - if (serverScript) searchPaths.unshift(path.join(path.dirname(serverScript), 'providers.json')); + if (serverScript) { + const siblingProviders = path.join(path.dirname(serverScript), 'providers.json'); + if (!searchPaths.includes(siblingProviders)) searchPaths.splice(1, 0, siblingProviders); + } } catch (_) {}🤖 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 `@bin/probe-quorum-slots.cjs` around lines 35 - 38, The code currently prepends the sibling providers.json (found via serverScript) into searchPaths which allows that file to override the canonical ~/.claude/nf/bin/providers.json; change the logic so the sibling providers.json is appended (use searchPaths.push(path.join(path.dirname(serverScript), 'providers.json')) or otherwise insert it after the canonical entry) so the canonical providers file remains first; update the block that reads claudeJson, computes u1args and serverScript and replace the unshift call on searchPaths with a push (or equivalent insertion after the canonical path) to preserve canonical-first lookup.
🤖 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.
Outside diff comments:
In `@bin/probe-quorum-slots.cjs`:
- Around line 35-38: The code currently prepends the sibling providers.json
(found via serverScript) into searchPaths which allows that file to override the
canonical ~/.claude/nf/bin/providers.json; change the logic so the sibling
providers.json is appended (use
searchPaths.push(path.join(path.dirname(serverScript), 'providers.json')) or
otherwise insert it after the canonical entry) so the canonical providers file
remains first; update the block that reads claudeJson, computes u1args and
serverScript and replace the unshift call on searchPaths with a push (or
equivalent insertion after the canonical path) to preserve canonical-first
lookup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ef3456b1-2454-4f08-87a9-abee50183f3f
📒 Files selected for processing (1)
bin/probe-quorum-slots.cjs
Summary
Why
`provider.cli` is null for all 5 sub slots (codex-1, gemini-1, opencode-1, copilot-1, claude-1) in the canonical `~/.claude/nf/bin/providers.json`. The hot path (`call-quorum-slot.cjs`) handles this via the three-tier fallback added in #164, but the diagnostic probe script was missing the same fix. Calling it directly would crash before reaching any slot.
Surfaced by a `/nf:quorum` self-test run where codex-1 caught the gap (cited `bin/probe-quorum-slots.cjs:27,67`). Quorum reached consensus that the hot-path was fine but the probe tool needed the same backport.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Improvements