The per-reviewer summary step was removed in 0f03726, dropping the
summaries field from DebateResult, but this test still asserted on it
and failed. Remove the stale assertion.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
By default the orchestrator is resilient: a single reviewer (or context
gatherer) failure is logged and the round continues with the survivors,
aborting only when all reviewers fail.
The new --fail-fast flag flips to strict mode — any reviewer or
context-gathering failure re-throws immediately and terminates the
whole flow. Wired through the review and discuss commands via
OrchestratorOptions.failFast, with a regression test and README docs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The summarizer now generates the final conclusion directly from the full
debate conversation history, eliminating the intermediate step where each
reviewer was asked to summarize their own points. This saves one round of
API calls per reviewer without losing information.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After the summarizer produces the final conclusion, a new verification step
re-examines it against the original PR diff/code to confirm correctness,
flag false positives, catch missed issues, and produce an authoritative
verified final conclusion.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow CLI providers (claude-code, codex-cli, gemini-cli, qwen-code) to
accept a model override using colon syntax (e.g., `claude-code:claude-opus-4-6`).
Display the model name alongside reviewer IDs in review and discuss output.
Update default Gemini API model to gemini-3.1-pro-preview.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gh pr diff returns HTTP 406 for PRs with >20,000 lines of diff.
Added fallback: fetch full diff via commit diff API endpoint (no line
limit), split into per-file sections, prioritize core files over tests,
and truncate to 15k lines to fit model context windows.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce an optional General Discussion phase for PR reviews that sits
between review completion and the issue-by-issue comment loop. Users can
select participants, ask general questions, and resolve issues inline
(/post, /skip, /edit, /discuss, /issues) so only remaining issues flow
into the per-issue loop.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move language instructions from user message suffix to system prompt prefix
where LLMs give them higher weight. Add langPrefix/withLang() to orchestrator
so all reviewer/analyzer/summarizer calls get the language requirement.
Also wire discuss command to use config.defaults.language instead of only
following user input language.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add extractDiffLineRanges() to include valid line ranges in structurizer prompt
- Add content-based matching (extractCodeFromBody + findLineByContent) as fallback
- Add full diff fallback via gh api when per-file patches are null
- Widen nearest-line threshold from 20 to 50 for better coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace execSync with spawnSync in getFileHistory() and getPRDetails()
to prevent shell injection through file paths and PR numbers. Add input
validation for prNumber (must be a positive integer).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace execSync with spawnSync in findReferences() to prevent shell
injection through malicious symbol names in PR diffs. Use -F (fixed-string)
and -e flags for safe argument passing to ripgrep.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the AI reviewer references a line not exactly in a diff hunk,
find the nearest valid diff line (within 20 lines) and post inline
there instead of falling back to file-level. Also constrain the
structurizer prompt to only reference files actually in the diff.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Allow convergence check on round 1: independent reviewers reaching
the same conclusions is valid convergence
- Adapt convergence prompt to distinguish independent reviews (round 1)
from cross-examined reviews (round 2+)
- Stop any running spinner in onRoundComplete before printing round
results to prevent terminal output artifacts
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Add stdin EPIPE error handlers to prevent unhandled exception crashes
when child processes exit before reading all input
- Clear CLAUDECODE env var to avoid nested session detection when
running from within Claude Code
- Write large prompts (>100KB) to temp files instead of stdin to bypass
CLI prompt size limits; CLI tools read the file via their built-in
file access capabilities
- Capture stderr in claude-code streaming mode for better error reporting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix readline hanging after ora spinner pauses stdin: add process.stdin.resume()
before rl.question() at all spinner→input transition points across review, discuss,
and interactive modules
- Fix Ctrl+C not working during analysis/debate: replace silent flag-only SIGINT
handler with double-press-to-force-exit pattern; add InterruptedError + checkpoint
checks in orchestrator between analysis, debate rounds, and summarization
- Add diff filtering: new diff-filter utility with built-in patterns for generated
files (*.pb.go, vendor/**, lockfiles, etc.) and user-configurable diff_exclude
- Add language support to context gatherer: pass config.defaults.language to
ContextGatherer so System Context section respects language setting
Signed-off-by: Buqian Zheng <zhengbuqian@gmail.com>
- Add interactivePostReviewDiscussion() for chatting with any role after review conclusion
- Show all roles (reviewers + analyzer + summarizer) in comment discussion picker
- Add comment style prompt before issue loop to style-guide first-gen comments
- Add /skip and /drop to abandon issues mid-discussion
- Add defaults.language config for localized output (e.g. language: zh)
- Expose getAnalyzer() and getSummarizer() from orchestrator
- Share reviewer sessions across discussion and comment phases
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Li Liu <li.liu@zilliz.com>
Allow users to configure `base_url` per provider to connect to
compatible third-party endpoints (Azure OpenAI, Ollama, vLLM, one-api,
etc.). All four API providers (Anthropic, OpenAI, Gemini, MiniMax) now
accept an optional `base_url` in config which is passed through to
their respective SDKs.
Co-authored-by: Cursor <cursoragent@cursor.com>
When a bare PR number is given while in a fork's local clone, the code
now uses `gh pr view` to resolve the actual upstream repo before falling
back to git remote detection. This prevents 404 errors when posting
review comments on PRs that live on the upstream repository.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewer prompts previously allowed LLMs to stop after finding a handful
of issues. Now every round demands systematic coverage of all changed
files/functions, and debate rounds additionally require reviewers to
identify what others missed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Classify comments against PR diff before posting. When comments cannot
be placed inline (line not in diff), show user the fallback plan and
offer choices: post all with fallback, inline only, retry as inline,
or skip.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use GitHub Reviews API to batch-post comments as a proper code review.
Parse PR diff to determine valid line placements, with three-level
fallback: inline (exact line) → file-level (attached to file) → global.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show a dim "Enter to end discussion" hint at the input prompt that
automatically clears when the user starts typing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Maintain a single session per reviewer across all issue discussions,
so that context (PR diff, gathered context, debate history) is sent
once at session start and subsequent issues use --resume for
claude-code provider. This enables cross-issue context sharing and
eliminates cold-start overhead per issue.
- Add ReviewerSessionState interface and session management helpers
- buildInitialSessionContext: rich first message with full PR context
- getOrCreateSession: lazy session creation with provider startSession
- Use DebateResult type instead of inline type for better type safety
- Wrap discussion flow in try/finally to guarantee session cleanup
- Synthetic assistant reply after initial context to maintain
user/assistant alternation for API-based providers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When reviewing a PR from a different repository using a full GitHub URL,
the commenter commands (gh pr view, gh pr comment) defaulted to the
current directory's git remote, causing "Could not resolve PullRequest"
errors. Now extracts owner/repo from the PR URL and passes --repo flag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After discuss generates a comment, users can now press [r] to
regenerate with custom instructions (e.g. "more concise", "add code
example"). Supports unlimited regeneration cycles with full
conversation context preserved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrote commenter to post each issue as an individual inline comment
on the specific line via GitHub PR comments API. If the line is not
in the diff, falls back to a regular PR comment with file:line context.
Previously used batch PR review API where one invalid line would fail
the entire batch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Discussion mode ('d') now auto-sends first message asking the
reviewer to explain the issue in detail (where, why, how to fix)
before user interaction begins
- Progress bar shows running tally: posted/edited/discussed/skipped
counts displayed on each issue header
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: ora's default discardStdin=true calls process.stdin.pause()
when spinner stops. This makes the stdin handle inactive in libuv, and
since readline's question() does not call resume(), the event loop sees
no active handles and the process exits silently. Only affects TTY
environments (stdinDiscarder checks isTTY).
Fix: use discardStdin:false on all ora spinners that coexist with
readline, plus explicit process.stdin.resume() safety net.
Also includes:
- Multi-turn discussion with conversation history and debate context
- AI-generated final comments after discussion
- unhandledRejection guard for async generator cleanup
- Pre-fetch PR diff so API-only models get the code
- Solo review/discuss support (min 1 reviewer, skip convergence)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- AnthropicProvider: stream.abort() in finally block ensures HTTP
connection is released even if consumer breaks early
- OpenAIProvider: stream.controller.abort() for same reason
- GeminiProvider: document that consuming all chunks is sufficient
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MockProvider for debug mode: supports MAGPIE_MOCK_DELAY,
MAGPIE_MOCK_RESPONSE, MAGPIE_MOCK_FILE env vars; echoes input by default
- QwenCodeProvider: wraps qwen-code CLI (OAuth-based)
- MiniMaxProvider: API-based provider using MiniMax-M2.5
- config.mock top-level flag: when true, all models route to MockProvider
- model prefix matching: mock, mock1, mock2 etc. all map to mock provider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use `codex exec --json` and `codex exec resume <thread_id>` to maintain
multi-turn conversation state, matching Claude and Gemini CLI behavior.
In debate rounds, only the last message is sent instead of full history.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Structurizer now requests comprehensive markdown descriptions with
original code quotes, impact analysis, and fix rationale — suitable
for GitHub PR comments.
2. Fix discuss (d) silently skipping: raisedBy was stripped by
parseReviewerOutput, defaulting to ['summarizer'] which matched no
reviewer. Now preserved through parsing pipeline, with fallback to
first available reviewer.
3. Issue display now renders markdown via marked() for proper formatting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When extracting structured issues from review text, Claude Code with
--dangerously-skip-permissions would interpret file paths and fix suggestions
as instructions to modify code, producing "All fixes applied..." instead of
JSON. Fix by passing --tools "" to disable all tools for the structurizer call.
Also: end summarizer session before structurization for clean non-session call,
make issue-parser more lenient (accept raw JSON objects, optional verdict/summary).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The analysis content was still buffered when onContextGathered fired,
causing the context section to appear before the analysis text.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewer output format is not under our control. Instead of trying to
parse JSON blocks from reviewer messages (which may not match our schema),
always use the summarizer to extract structured issues from the review
discussion text. This is more robust and removes any dependency on
reviewer prompt configuration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When reviewers don't include structured JSON blocks in their output,
the summarizer is called to extract issues from the unstructured review
text into the standard JSON format. This ensures the per-issue
interactive post-processing flow always works for PR reviews.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Session names now include explicit role: "reviewer:gemini" instead of
just "gemini", matching analyzer/summarizer pattern
2. PR post-processing no longer requires structured JSON issues. When
reviewers don't output JSON blocks, offers to post the final
conclusion as a general PR comment instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move onContextGathered callback to after Promise.all resolves, so context
displays after analysis finishes streaming. Work is still parallel, only
the display is sequential.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents AI from outputting chatty preamble like "Here's my analysis"
before the actual content.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>