feat: add batch querying for multi-agent dispatch#223
Conversation
Add `codegraph batch <command> [targets...]` CLI command, `batchData()` programmatic API, and `batch_query` MCP tool. Runs the same query against multiple targets in one call, returning all results in a single JSON payload with per-target error isolation. Supports 10 commands: fn-impact, context, explain, where, query, fn, impact, deps, flow, complexity. Accepts targets via positional args, --from-file (JSON array or newline-delimited), or --stdin. Impact: 3 functions changed, 3 affected
|
Claude finished @carlos-alm's task —— View job PR Review: Batch Querying FeatureReview Tasks:
Phase 1: Root Cause Analysis ✅Problem Being Solved: The PR addresses issue #28 requesting batch querying capability for multi-agent swarms that need to execute 20+ queries efficiently in a single call rather than individual API calls. Why This Approach: The implementation is well-justified:
Risk Assessment: LOW RISK - This is a pure additive feature that doesn't modify existing functionality. Phase 2: Configuration Change Detection ✅No high-risk configuration changes detected:
Phase 3: Test Integrity Assessment ✅Test coverage is comprehensive:
Phase 4: Code Quality Assessment ✅Strengths:
Minor observations:
No security or performance issues identified Root Cause AnalysisProblem Being Solved: Multi-agent systems need efficient batch querying to avoid N+1 API call patterns when analyzing multiple targets simultaneously. Critical ConcernsNone identified. This is a well-implemented feature addition. Final Recommendation
|
Greptile SummaryThis PR adds batch querying functionality that enables running the same query command against multiple targets in a single call, returning consolidated JSON output. The implementation spans batch orchestration ( Key implementation details:
The code is clean, well-documented, and follows project conventions. All query function signatures are correctly mapped to their respective call patterns. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant Batch
participant QueryFns
participant DB
User->>CLI: batch <command> [targets...] --db path
CLI->>CLI: Parse input (args/file/stdin)
CLI->>CLI: Validate command & options
CLI->>Batch: batch(command, targets, dbPath, opts)
Batch->>Batch: batchData(command, targets, dbPath, opts)
loop For each target
alt sig === 'dbOnly' (complexity)
Batch->>QueryFns: fn(dbPath, {...opts, target})
else sig === 'name'/'target'/'file'
Batch->>QueryFns: fn(target, dbPath, opts)
end
QueryFns->>DB: Query graph.db
DB-->>QueryFns: Return data
alt Success
QueryFns-->>Batch: data
Batch->>Batch: results.push({target, ok:true, data})
else Error
QueryFns-->>Batch: throw error
Batch->>Batch: results.push({target, ok:false, error})
end
end
Batch-->>CLI: {command, total, succeeded, failed, results}
CLI->>User: JSON output
Last reviewed commit: 2355b43 |
| * - 'name' → dataFn(target, dbPath, opts) | ||
| * - 'target' → dataFn(target, dbPath, opts) | ||
| * - 'file' → dataFn(target, dbPath, opts) | ||
| * - 'dbOnly' → dataFn(dbPath, { target, ...opts }) (target goes into opts) |
There was a problem hiding this comment.
Comment shows spread order backwards from implementation on line 68
| * - 'dbOnly' → dataFn(dbPath, { target, ...opts }) (target goes into opts) | |
| * - 'dbOnly' → dataFn(dbPath, { ...opts, target }) (target goes into opts) |
| try { | ||
| let data; | ||
| if (entry.sig === 'dbOnly') { | ||
| // complexityData(dbPath, { target, ...opts }) |
There was a problem hiding this comment.
Comment shows spread order backwards from implementation
| // complexityData(dbPath, { target, ...opts }) | |
| // complexityData(dbPath, { ...opts, target }) |
Impact: 1 functions changed, 1 affected
|
Claude finished @carlos-alm's task —— View job PR Review: Batch Querying FeatureReview Tasks:
Phase 1: Root Cause Analysis ✅Problem Being Solved: The PR addresses issue #28 requesting batch querying capability for multi-agent swarms that need to execute 20+ queries efficiently in a single call rather than individual API calls. Why This Approach: The implementation is well-justified:
Risk Assessment: LOW RISK - This is a pure additive feature that doesn't modify existing functionality. Phase 2: Configuration Change Detection ✅No high-risk configuration changes detected:
Phase 3: Test Integrity Assessment ✅Test coverage is comprehensive:
Phase 4: Code Quality Assessment ✅Strengths:
Minor observations:
No security or performance issues identified Root Cause AnalysisProblem Being Solved: Multi-agent systems need efficient batch querying to avoid N+1 API call patterns when analyzing multiple targets simultaneously. Critical ConcernsNone identified. This is a well-implemented feature addition. Final Recommendation
|
Summary
codegraph batch <command> [targets...]CLI command that runs the same query against multiple targets in one call, returning all results in a single JSON payloadbatchData()programmatic API andbatch_queryMCP tool for AI agent consumptionfn-impact,context,explain,where,query,fn,impact,deps,flow,complexity--from-file(JSON array or newline-delimited), or--stdinCloses #28 (Backlog)
Test plan
batch_queryin tool list, all 36 MCP tests pass