Fix tri-agent failures on large diffs - #31
Merged
Conversation
Three root causes found and fixed: 1. Diff truncation at 30K chars (review.go) — raised to 500K with file-boundary-aware truncation. 500K chars ≈ 125K tokens, well within Claude (200K) and Gemini (1M) context windows. 2. All runners passed prompt as CLI argument (-p prompt) — switched to stdin piping for all three (Claude, Codex, Gemini). Eliminates ARG_MAX risk and handles special characters in diffs safely. 3. Claude runner fails silently with OAuth tokens (sk-ant-oat*) — Added Available() check that skips Claude when OAuth token detected. OAuth tokens only work within the parent session, not for subprocess claude -p calls. When skipped, Codex and Gemini still run.
Code-reviewer caught three issues, all verified: - Claude: -p is print-mode flag, not stdin marker. Reverted to passing prompt as positional arg. Added stderr log when OAuth token detected so skipping is visible, not silent. - Codex: Reverted to passing prompt as arg (verified it works). Removed unnecessary stdin piping and vague placeholder instruction. - Gemini: Dropped -p flag entirely — it was duplicating instructions (stdin + -p both sent to model). Now stdin-only, verified working.
- Claude: JSON parse failure now returns error instead of nil (prevents garbage output presented as legitimate review) - Codex: Non-zero exit codes now treated as errors (matching Gemini) - All runners: "failed to start" → "failed to run" (accurate message) - Truncation: Differentiates file-boundary vs mid-hunk truncation in the warning message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the root causes of all-three-agents-failing on large diffs:
diff --gitmarker).-pCLI arguments. Eliminates ARG_MAX risk and special character mangling.ANTHROPIC_API_KEYprefix. OAuth tokens (sk-ant-oat*) don't work for subprocessclaude -pcalls, so the runner marks itself unavailable and Codex/Gemini still run instead of all three silently failing.Root cause analysis
When the Go harness ran
devkit reviewon a large diff:-pmode)Test plan
go test ./...passes (verified locally — all pass)go build ./...succeeds (verified locally)devkit reviewon a repo with >30K char diff — verify no truncation