fix(pr-review): robust engine fallback and context optimization - #227
Conversation
- engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export
Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility.
📝 WalkthroughWalkthroughThis PR refactors GitHub Actions intent context metadata to include actor and review body, centralizes engine model configuration, rewrites Copilot integration to use gh copilot CLI directly instead of REST API, expands rate-limit detection patterns, and hardens triage error handling with stderr capture and JSON validation. ChangesIntent Metadata Enrichment and Engine Integration Updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
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)
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 |
There was a problem hiding this comment.
Code Review
This pull request enhances the robustness and efficiency of the LLM-driven development scripts. Key improvements include refactoring engine configuration into a reusable function, implementing a fallback to gpt-4o for Copilot when encountering payload size errors, and optimizing GitHub CLI metadata retrieval to conserve tokens. Additionally, JSON handling was improved using jq and heredocs with random delimiters. Review feedback suggests further hardening the scripts by ensuring consistent authorization guards for API retries, simplifying redundant fallback logic in the writer functions, and using temporary files to process large JSON payloads to avoid shell argument limits.
| " "$_body_file" > "$_body_file.tmp" && mv "$_body_file.tmp" "$_body_file" | ||
|
|
||
| timeout "$timeout_sec" curl -sSL \ | ||
| -H "Authorization: Bearer ${COPILOT_GITHUB_TOKEN}" \ |
There was a problem hiding this comment.
For consistency and robustness, use the same authorization guard for the retry call as used in the initial call (line 191). This ensures the script fails with a clear error message if the token is missing or unset.
| -H "Authorization: Bearer ${COPILOT_GITHUB_TOKEN}" \ | |
| -H "Authorization: Bearer ${COPILOT_GITHUB_TOKEN:?COPILOT_GITHUB_TOKEN is required for copilot engine}" \ |
| copilot) | ||
| # Copilot (gh copilot suggest) is text-only — falls back to Claude for write ops | ||
| echo "::warning::Copilot engine is text-only; falling back to Claude for write operations" >&2 | ||
| local saved="$REVIEW_ENGINE" | ||
| REVIEW_ENGINE="claude" timeout "$ACTION_TIMEOUT_SEC" claude --print \ | ||
| --model "$model" \ | ||
| # Copilot (gh copilot suggest) is text-only — falls back to other engines for write ops | ||
| echo "::warning::Copilot engine is text-only; falling back to Claude/Gemini for write operations" >&2 | ||
| local saved_engine="$REVIEW_ENGINE" | ||
| local fallback_rc=1 | ||
|
|
||
| # Try Claude first | ||
| export REVIEW_ENGINE="claude" | ||
| set_engine_config | ||
| # run_writer calls itself via case, but since we exported REVIEW_ENGINE and called set_engine_config, | ||
| # we can just call the claude logic directly or recursively. | ||
| # To avoid infinite recursion, we'll just use a subshell or call claude logic. | ||
| timeout "$ACTION_TIMEOUT_SEC" claude --print \ | ||
| --model "$ENGINE_ACTION_MODEL" \ | ||
| --permission-mode acceptEdits \ | ||
| --allowed-tools "Bash,Read,Write,Edit,Grep,Glob" \ | ||
| < "$prompt_file" | tee "$_tmp" || rc=${PIPESTATUS[0]} | ||
| REVIEW_ENGINE="$saved" | ||
| < "$prompt_file" | tee "$_tmp" && fallback_rc=0 || fallback_rc=${PIPESTATUS[0]} | ||
|
|
||
| # If Claude is rate-limited, try Gemini | ||
| if [ "$fallback_rc" -eq 2 ] || [ "$fallback_rc" -eq 127 ]; then | ||
| echo "::warning::Claude fallback rate-limited or unavailable, trying Gemini" >&2 | ||
| export REVIEW_ENGINE="gemini" | ||
| set_engine_config | ||
| timeout "$ACTION_TIMEOUT_SEC" gemini --prompt "" \ | ||
| --model "$ENGINE_ACTION_MODEL" \ | ||
| --approval-mode auto_edit \ | ||
| --output-format text \ | ||
| < "$prompt_file" | tee "$_tmp" && fallback_rc=0 || fallback_rc=${PIPESTATUS[0]} | ||
| fi | ||
|
|
||
| rc=$fallback_rc | ||
| export REVIEW_ENGINE="$saved_engine" | ||
| set_engine_config | ||
| ;; |
There was a problem hiding this comment.
The copilot case in run_writer manually implements a fallback to Claude and Gemini. However, run_writer_with_fallback (lines 573-590) already iterates through all available engines when a rate limit (exit code 2) is encountered. By implementing a nested fallback here, you are effectively trying each engine multiple times if they are rate-limited, which is redundant and increases complexity. Simplifying this to return exit code 2 aligns with repository standards for LLM retry loops and correctly triggers the outer fallback mechanism.
| copilot) | |
| # Copilot (gh copilot suggest) is text-only — falls back to Claude for write ops | |
| echo "::warning::Copilot engine is text-only; falling back to Claude for write operations" >&2 | |
| local saved="$REVIEW_ENGINE" | |
| REVIEW_ENGINE="claude" timeout "$ACTION_TIMEOUT_SEC" claude --print \ | |
| --model "$model" \ | |
| # Copilot (gh copilot suggest) is text-only — falls back to other engines for write ops | |
| echo "::warning::Copilot engine is text-only; falling back to Claude/Gemini for write operations" >&2 | |
| local saved_engine="$REVIEW_ENGINE" | |
| local fallback_rc=1 | |
| # Try Claude first | |
| export REVIEW_ENGINE="claude" | |
| set_engine_config | |
| # run_writer calls itself via case, but since we exported REVIEW_ENGINE and called set_engine_config, | |
| # we can just call the claude logic directly or recursively. | |
| # To avoid infinite recursion, we'll just use a subshell or call claude logic. | |
| timeout "$ACTION_TIMEOUT_SEC" claude --print \ | |
| --model "$ENGINE_ACTION_MODEL" \ | |
| --permission-mode acceptEdits \ | |
| --allowed-tools "Bash,Read,Write,Edit,Grep,Glob" \ | |
| < "$prompt_file" | tee "$_tmp" || rc=${PIPESTATUS[0]} | |
| REVIEW_ENGINE="$saved" | |
| < "$prompt_file" | tee "$_tmp" && fallback_rc=0 || fallback_rc=${PIPESTATUS[0]} | |
| # If Claude is rate-limited, try Gemini | |
| if [ "$fallback_rc" -eq 2 ] || [ "$fallback_rc" -eq 127 ]; then | |
| echo "::warning::Claude fallback rate-limited or unavailable, trying Gemini" >&2 | |
| export REVIEW_ENGINE="gemini" | |
| set_engine_config | |
| timeout "$ACTION_TIMEOUT_SEC" gemini --prompt "" \ | |
| --model "$ENGINE_ACTION_MODEL" \ | |
| --approval-mode auto_edit \ | |
| --output-format text \ | |
| < "$prompt_file" | tee "$_tmp" && fallback_rc=0 || fallback_rc=${PIPESTATUS[0]} | |
| fi | |
| rc=$fallback_rc | |
| export REVIEW_ENGINE="$saved_engine" | |
| set_engine_config | |
| ;; | |
| copilot) | |
| # Copilot (gh copilot suggest) is text-only — trigger fallback to other engines for write ops | |
| echo "::warning::Copilot engine is text-only; triggering fallback for write operations" >&2 | |
| return 2 | |
| ;; |
References
- In shell scripts implementing retry loops for LLM-based tasks, detect rate limits and exit with code 2 to enable engine fallback mechanisms in the calling process.
| if [ "${REVIEW_ENGINE:-claude}" = "copilot" ]; then | ||
| _diff_limit=50 | ||
| # Remove the bulky body from metadata for Copilot to save tokens and avoid content filters | ||
| PR_METADATA=$(echo "$PR_METADATA" | jq 'del(.body)') |
There was a problem hiding this comment.
Using echo to pipe a variable containing arbitrary JSON can be unsafe. Furthermore, for large JSON payloads (like PR metadata which includes the body), passing data via command-line arguments can exceed the ARG_MAX limit. To ensure robustness and follow repository guidelines, use a temporary file to process the JSON.
| PR_METADATA=$(echo "$PR_METADATA" | jq 'del(.body)') | |
| printf '%s' "$PR_METADATA" > pr_metadata.json && PR_METADATA=$(jq 'del(.body)' pr_metadata.json) && rm pr_metadata.json |
References
- When passing large JSON payloads in shell scripts, use a temporary file to avoid exceeding the ARG_MAX command-line argument limit.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 846afe1ce3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ "${REVIEW_ENGINE:-claude}" = "copilot" ]; then | ||
| _diff_limit=50 | ||
| # Remove the bulky body from metadata for Copilot to save tokens and avoid content filters | ||
| PR_METADATA=$(echo "$PR_METADATA" | jq 'del(.body)') |
There was a problem hiding this comment.
Keep enough diff context before approving Copilot triage
When REVIEW_ENGINE=copilot, triage now sees only the first 50 lines of the PR diff even though prompts/triage.md says this tier has no tools and must decide from the inlined context. In the existing approval path, a TRIAGE_ESCALATE=false result can proceed to the single-review/post step, so any risky hunk or obvious anti-pattern after line 50 in a large PR is invisible to the gate except for the filename summary. This can let the automation approve PRs whose relevant changes are simply beyond the truncated head; prefer truncating in a way that preserves all changed file/hunk headers or forcing escalation when the diff is truncated.
Useful? React with 👍 / 👎.
| { | ||
| echo "INTENT_CONTEXT<<$EOF_DELIMITER" | ||
| echo "${context}" | ||
| echo "$EOF_DELIMITER" | ||
| } >> "$GITHUB_ENV" |
There was a problem hiding this comment.
Update local context readers for heredoc output
Switching INTENT_CONTEXT to the KEY<<EOF format means the existing local test/helpers that read the classifier output with grep '^INTENT_CONTEXT=' no longer find any context; for example the repository_dispatch context tests now parse an empty string instead of the PR/check payload. If CI runs these Bats suites, this change breaks the dev-lead tests even though the workflow runner can consume heredoc env files, so the helper/parser needs to be updated alongside this output format change.
Useful? React with 👍 / 👎.
| # If 413 (Payload Too Large) and we used o4-mini, try gpt-4o as a last-resort fallback. | ||
| # o4-mini sometimes has very tight (4k) input limits on the free-tier gateway. | ||
| if [ "$http_code" -eq 413 ] && [[ "${COPILOT_API_MODEL:-}" == *"o4-mini"* ]]; then |
There was a problem hiding this comment.
Retry 413s when Copilot is used as the duck engine
In the default Claude review flow, DUCK_ENGINE=copilot calls copilot_chat while COPILOT_API_MODEL is unset, so the request still defaults to openai/o4-mini but this [[ ... == *"o4-mini"* ]] guard is false. A 413 from the Copilot rubber-duck pass therefore never retries with gpt-4o, and large PRs lose the cross-engine check exactly in the payload-limit case this change is meant to handle. Compare against the effective default model or initialize COPILOT_API_MODEL before all Copilot calls.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 327cbbbf5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| timeout "$timeout_sec" gh copilot \ | ||
| --model "$COPILOT_API_MODEL" \ | ||
| -p "$(cat "$prompt_file")" \ |
There was a problem hiding this comment.
Initialize Copilot model before duck calls
When the default Claude review reaches the rubber-duck path, DUCK_ENGINE=copilot but set_engine_config never sets COPILOT_API_MODEL unless the primary REVIEW_ENGINE is copilot; with set -u, expanding $COPILOT_API_MODEL here aborts before gh copilot runs. I reproduced this by sourcing this version of engine.sh with REVIEW_ENGINE=claude and calling copilot_chat, which fails with COPILOT_API_MODEL: unbound variable, so the cross-engine duck check is silently unavailable for escalated Claude reviews.
Useful? React with 👍 / 👎.
| TRIAGE_STDERR=$(cat "$TRIAGE_LOG" 2>/dev/null || true) | ||
| # TRIAGE_STDERR is always process output — safe to check unconditionally. | ||
| # TRIAGE_RESULT is gated on rc != 0 to avoid false positives: the triage prompt | ||
| # inlines the full PR diff, so a PR adding "429 rate-limit handling" could | ||
| # produce valid JSON with matching text in signals/summary, incorrectly | ||
| # triggering engine fallback on a healthy call that exited 0. | ||
| if is_rate_limited "$TRIAGE_STDERR"; then | ||
| if is_rate_limited "$TRIAGE_STDERR" || is_rate_limited "$TRIAGE_RESULT"; then |
There was a problem hiding this comment.
Only scan triage stdout after failures
For a successful triage response, TRIAGE_RESULT is model JSON and can legitimately contain strings like rate-limit or 429 in signals/summary when the PR itself changes rate-limit handling; this unconditional check then exits 2 and tells review-batch.sh to switch engines even though the model call succeeded. The previous gating avoided this exact false positive by only inspecting stdout for rate-limit text on nonzero exits; keep stdout checks tied to TRIAGE_RC != 0 and use stderr unconditionally.
Useful? React with 👍 / 👎.
| < "$prompt_file" | tee "$_tmp" || rc=${PIPESTATUS[0]} | ||
| REVIEW_ENGINE="$saved" | ||
| # Self-sufficient write support via gh copilot --yolo | ||
| copilot_chat "$prompt_file" "$ACTION_TIMEOUT_SEC" --yolo | tee "$_tmp" || rc=${PIPESTATUS[0]} |
There was a problem hiding this comment.
Add autopilot to non-interactive Copilot writers
When Copilot is the primary or final fallback engine for fix-ci/fix-reviews/issue work, this invokes prompt mode with only --yolo; the Copilot CLI docs distinguish this as permissions-only and state that --autopilot is what enables programmatic continuation through successive steps, with the example copilot --autopilot --yolo ... -p. In a CI writer flow with no human present, Copilot can stop at the first continuation/decision point instead of carrying the task through edits/tests, so the new “self-sufficient write support” is unreliable unless these write calls also opt into autopilot with a continuation cap.
Useful? React with 👍 / 👎.
| # is plenty for PR diffs and metadata. | ||
| timeout "$timeout_sec" gh copilot \ | ||
| --model "$COPILOT_API_MODEL" \ | ||
| -p "$(cat "$prompt_file")" \ |
There was a problem hiding this comment.
Avoid passing large Copilot prompts via argv
For Copilot triage, the prompt now includes PR metadata plus up to 1000 diff lines, but $(cat "$prompt_file") expands the whole prompt into a single command-line argument; a PR with minified/generated lines or a large body can exceed the runner's ARG_MAX and fail before gh copilot even starts. The previous REST path wrote the payload to a temp file to avoid this, so this should use a stdin/file-based CLI mode or enforce a byte-size cap rather than a line count.
Useful? React with 👍 / 👎.
| ENGINE_SINGLE_MODEL="gpt-4o" | ||
| # GitHub Models API model identifier. openai/gpt-4o is a flagship model | ||
| # with full tool support in the Copilot CLI. | ||
| COPILOT_API_MODEL="${COPILOT_API_MODEL:-openai/gpt-4o}" |
There was a problem hiding this comment.
This default is still a GitHub Models REST identifier, but the new copilot_chat path passes it directly to gh copilot --model; Copilot CLI model selection uses Copilot model names/aliases such as gpt-4o, auto, or the displayed Copilot model names, not the provider-prefixed openai/... API IDs. When REVIEW_ENGINE=copilot or writer fallback reaches Copilot, the first call can fail as an invalid model instead of reviewing or applying fixes.
Useful? React with 👍 / 👎.
| < "$prompt_file" | tee "$_tmp" || rc=${PIPESTATUS[0]} | ||
| REVIEW_ENGINE="$saved" | ||
| # Self-sufficient write support via gh copilot --yolo | ||
| copilot_chat "$prompt_file" "$ACTION_TIMEOUT_SEC" --yolo | tee "$_tmp" || rc=${PIPESTATUS[0]} |
There was a problem hiding this comment.
Capture Copilot writer stderr for rate-limit fallback
In the writer path this only tees stdout into _tmp, so if gh copilot reports a quota/rate-limit error on stderr—as the triage path in this same script accounts for—the subsequent is_rate_limited "$(cat "$_tmp")" check misses it and returns a plain failure. In that scenario run_writer_with_fallback stops without trying the remaining engines or posting the rate-limited marker, which is exactly the recovery path this change is meant to provide.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/engine.sh (1)
432-432: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winUpdate function signature comment.
The comment states
run_writer_with_fallback <prompt_file> [model], but the function no longer accepts or uses amodelparameter. Line 436 only capturesprompt_file, and line 450 callsrun_writerwithout passing a model argument (intentionally using$ENGINE_ACTION_MODELfrom the refreshed config per line 447).Proposed fix
-# run_writer_with_fallback <prompt_file> [model] +# run_writer_with_fallback <prompt_file> # Tries primary engine, falls back through claude → gemini → copilot on rate-limit. # Only rate-limit (exit 2) triggers fallback; other failures propagate immediately.🤖 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 `@scripts/engine.sh` at line 432, Update the function signature comment for run_writer_with_fallback to reflect that it only accepts a single parameter (prompt_file) and no longer takes a model; change the comment from "run_writer_with_fallback <prompt_file> [model]" to "run_writer_with_fallback <prompt_file>" and ensure references to run_writer and ENGINE_ACTION_MODEL remain unchanged in the surrounding code.
🤖 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.
Inline comments:
In `@scripts/engine.sh`:
- Around line 161-164: Remove the speculative comment about COPILOT_PROMPT in
scripts/engine.sh and replace it with a factual note: either delete the line
claiming "The Copilot CLI supports COPILOT_PROMPT env var as an alternative to
-p" or change it to state that such an env var is not currently supported by
this script and that the script uses -p with careful handling to avoid ARG_MAX;
reference COPILOT_PROMPT and -p in the note so future maintainers know the exact
symbols to check.
- Around line 161-173: The current code reads the prompt_file into prompt_text
and passes it with -p (lines using prompt_text and prompt_file), which risks
ARG_MAX; change the gh copilot invocation in the block that references
COPILOT_API_MODEL and timeout_sec to call gh copilot --prompt-file
"$prompt_file" (remove the prompt_text="$(cat ...)" and the -p "$prompt_text"
usage), keeping the timeout "$timeout_sec" and other flags intact; optionally
preserve COPILOT_PROMPT support by exporting it earlier but do not pass large
prompt data via command-line arguments.
- Around line 35-72: The COPILOT_API_MODEL value uses a GitHub Models REST API
identifier ("openai/gpt-4o") which is not a valid gh copilot CLI model name;
update the copilot case to either remove the provider prefix (set
COPILOT_API_MODEL to "gpt-4o") or set it to a CLI-supported token like "auto"
(or remove/export it entirely) so the gh copilot CLI receives a supported model
string; edit the copilot block where COPILOT_API_MODEL is set and exported to
replace "openai/gpt-4o" with a CLI-compatible model name or fallback "auto", or
alternatively stop using COPILOT_API_MODEL and switch to calling the GitHub
Models REST API if provider-prefixed identifiers are required.
In `@scripts/review-one-pr.sh`:
- Around line 343-348: The script currently checks is_rate_limited on
TRIAGE_RESULT before verifying TRIAGE_RESULT is valid JSON, causing legitimate
JSON verdicts that mention rate limits to trigger fallback; modify the logic
around TRIAGE_RESULT and TRIAGE_STDERR so you first sanitize TRIAGE_RESULT
(remove triple-backtick fences), then test JSON validity with jq (or check the
triage process exit), and only if JSON parsing fails run is_rate_limited against
TRIAGE_RESULT (and still always inspect TRIAGE_STDERR); update the block that
references TRIAGE_RESULT, TRIAGE_STDERR and is_rate_limited to gate the
TRIAGE_RESULT rate-limit check behind a failed jq parse while keeping stderr
handling unconditional.
---
Outside diff comments:
In `@scripts/engine.sh`:
- Line 432: Update the function signature comment for run_writer_with_fallback
to reflect that it only accepts a single parameter (prompt_file) and no longer
takes a model; change the comment from "run_writer_with_fallback <prompt_file>
[model]" to "run_writer_with_fallback <prompt_file>" and ensure references to
run_writer and ENGINE_ACTION_MODEL remain unchanged in the surrounding code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 659f9193-b2ab-45bf-bf1b-3c381129da8b
📒 Files selected for processing (6)
.github/workflows/dev-lead.ymlscripts/dev-lead-fix-issue.shscripts/dev-lead-fix-reviews.shscripts/dev-lead-intent.shscripts/engine.shscripts/review-one-pr.sh
| # Avoid ARG_MAX by using an env var for the prompt if possible, or attachment. | ||
| # The Copilot CLI supports COPILOT_PROMPT env var as an alternative to -p. | ||
| # (Assuming this in 2026 based on common patterns). | ||
| # If not, we'll just use -p with the file content but very carefully. | ||
| local prompt_text | ||
| prompt_text=$(cat "$prompt_file") | ||
|
|
||
| echo " [copilot] calling gh copilot (model=$COPILOT_API_MODEL, timeout=${timeout_sec}s, flags=$*)" >&2 | ||
|
|
||
| # Extract the assistant message from the JSON response. | ||
| printf '%s' "$response_body" | python3 -c " | ||
| import json, sys | ||
| try: | ||
| data = json.load(sys.stdin) | ||
| except json.JSONDecodeError as e: | ||
| print('copilot_chat: invalid JSON response: ' + str(e), file=sys.stderr) | ||
| sys.exit(1) | ||
| if 'error' in data: | ||
| err = data['error'] | ||
| msg = err.get('message', str(err)) if isinstance(err, dict) else str(err) | ||
| print('copilot_chat: API error: ' + str(msg), file=sys.stderr) | ||
| sys.exit(1) | ||
| choices = data.get('choices', []) | ||
| if not choices: | ||
| print('copilot_chat: empty choices in response', file=sys.stderr) | ||
| sys.exit(1) | ||
| content = choices[0].get('message', {}).get('content', '') | ||
| print(content, end='') | ||
| " || return 1 | ||
| # We use -p for the prompt. | ||
| timeout "$timeout_sec" gh copilot \ | ||
| --model "$COPILOT_API_MODEL" \ | ||
| -p "$prompt_text" \ |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check gh copilot CLI prompt options
if command -v gh &>/dev/null && gh copilot --version &>/dev/null; then
echo "=== gh copilot help output ==="
gh copilot --help 2>&1 | grep -E -A2 -i 'prompt|input|file'
fiRepository: petry-projects/.github-private
Length of output: 105
🌐 Web query:
gh copilot CLI how to pass large prompts file or stdin
💡 Result:
To pass large prompts or file content to the GitHub Copilot CLI, you can use the --prompt-file option or pipe content via stdin, depending on your specific version and requirements. Using --prompt-file For large prompts or file contents, the recommended approach is to use the --prompt-file flag [1]. This method avoids issues with command-line argument length limits (such as ARG_MAX on Linux) that can occur when passing very large strings directly via the -p or --prompt option [1]. The Copilot CLI driver handles --prompt-file with size-aware logic [1]: - Files <= 100KB: The CLI reads the file contents and processes them as if they were passed via the standard -p option [1]. - Files > 100KB: The CLI passes a compact instruction to the agent, directing it to read and execute the prompt directly from the specified file path on disk [1]. Using Stdin You can also pipe content into the Copilot CLI using standard input (stdin) [2][3]. This is useful for scripting and avoiding complex shell escaping for multiline prompts [3]. Example usage: cat my_large_prompt.txt | copilot --stdin Note that while piping data to stdin is supported, behavior regarding the combination of stdin and specific flags (like --agent) has evolved in recent versions [3][4]. If you encounter issues with argument length when using -p, switching to --prompt-file or --stdin is the standard solution [1][3]. For programmatic automation, you can also use the -p or --prompt option for smaller, one-off requests [2][5]. However, for large inputs, always prefer --prompt-file to ensure stability [1].
Citations:
- 1: Use
--prompt-filefor Copilot execution and add Copilot driver fallback handling github/gh-aw#26492 - 2: https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically
- 3: Allow prompts to be passed via stdin for advanced scripting and usability github/copilot-cli#1046
- 4: The
--agentflag should be compatible with standard input (stdin) usage through a pipe. github/copilot-cli#691 - 5: https://github.blog/ai-and-ml/github-copilot-cli-101-how-to-use-github-copilot-from-the-command-line/
🏁 Script executed:
# Check the exact code at lines 161-173 in scripts/engine.sh
cat -n scripts/engine.sh | sed -n '155,180p'Repository: petry-projects/.github-private
Length of output: 1297
🏁 Script executed:
# Search for copilot_chat function to understand full context
grep -n "copilot_chat" scripts/engine.sh | head -5Repository: petry-projects/.github-private
Length of output: 431
🏁 Script executed:
# Look for usage of --yolo, --deny-tool flags mentioned in review
grep -n "\-\-yolo\|\-\-deny-tool" scripts/engine.sh | head -10Repository: petry-projects/.github-private
Length of output: 786
ARG_MAX risk: prompt passed via -p instead of --prompt-file.
The comment (lines 161–164) acknowledges the ARG_MAX concern and mentions using a COPILOT_PROMPT environment variable, but the implementation reads the entire prompt file into a shell variable (line 166) and passes it via -p "$prompt_text" (line 173). This approach exposes the code to command-line argument length limits (typically ~2MB on Linux, less on macOS).
GitHub's official Copilot CLI documentation explicitly recommends using --prompt-file for large prompts, which handles size-aware logic internally: files ≤100KB are read inline, while larger files are processed by directing the agent to read from disk. The current implementation should use --prompt-file instead:
Recommended fix
- # Avoid ARG_MAX by using an env var for the prompt if possible, or attachment.
- # The Copilot CLI supports COPILOT_PROMPT env var as an alternative to -p.
- # (Assuming this in 2026 based on common patterns).
- # If not, we'll just use -p with the file content but very carefully.
- local prompt_text
- prompt_text=$(cat "$prompt_file")
echo " [copilot] calling gh copilot (model=$COPILOT_API_MODEL, timeout=${timeout_sec}s, flags=$*)" >&2
- # We use -p for the prompt.
timeout "$timeout_sec" gh copilot \
--model "$COPILOT_API_MODEL" \
- -p "$prompt_text" \
+ --prompt-file "$prompt_file" \
-s "$@"🤖 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 `@scripts/engine.sh` around lines 161 - 173, The current code reads the
prompt_file into prompt_text and passes it with -p (lines using prompt_text and
prompt_file), which risks ARG_MAX; change the gh copilot invocation in the block
that references COPILOT_API_MODEL and timeout_sec to call gh copilot
--prompt-file "$prompt_file" (remove the prompt_text="$(cat ...)" and the -p
"$prompt_text" usage), keeping the timeout "$timeout_sec" and other flags
intact; optionally preserve COPILOT_PROMPT support by exporting it earlier but
do not pass large prompt data via command-line arguments.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f02d03b910
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Stream directly to stdout; tee to OUTPUT_FILE when set. | ||
| if [ -n "${OUTPUT_FILE:-}" ]; then | ||
| copilot_chat "$prompt_file" "$DEEP_TIMEOUT_SEC" | tee "$OUTPUT_FILE" | ||
| copilot_chat "$prompt_file" "$DEEP_TIMEOUT_SEC" --yolo | tee "$OUTPUT_FILE" |
There was a problem hiding this comment.
Preserve Copilot-written verdict files
When REVIEW_ENGINE=copilot reaches the agentic tiers, the prompts for deep/action runs tell the agent to write the verdict to $OUTPUT_FILE (for example prompts/cascade-action.md writes JSON there and then prints a status line, while explicitly saying not to print JSON). Piping Copilot stdout through tee "$OUTPUT_FILE" means that status/transcript output can truncate or overwrite the JSON the agent just wrote, so review-one-pr.sh later sees an invalid verdict and fails the review even though Copilot completed the task; keep stdout in the raw log only and let the agent-owned file remain untouched.
Useful? React with 👍 / 👎.
| copilot) | ||
| copilot_chat "$prompt_file" "$TRIAGE_TIMEOUT_SEC" || rc=$? | ||
| # In triage mode, we deny all tools to keep it fast and restricted. | ||
| copilot_chat "$prompt_file" "$TRIAGE_TIMEOUT_SEC" --deny-tool "*" || rc=$? |
There was a problem hiding this comment.
Use a valid Copilot tool-deny rule
When REVIEW_ENGINE=copilot is used for triage, this newly added --deny-tool "*" is passed directly to Copilot CLI; GitHub’s Copilot CLI docs describe --deny-tool=TOOL as denying a specific tool and state that wildcards are only supported for shell and URL filters, not as a catch-all tool name. In that Copilot primary/fallback path, triage can fail before producing JSON and be classified as a CLI invocation error instead of reviewing the PR; use documented deny entries such as read,write,shell,url or another supported no-tool mode.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf848d5cc8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ENGINE_SINGLE_MODEL="gpt-5.4" | ||
| # GitHub Copilot CLI model identifier. gpt-5.4 is a flagship model | ||
| # with full tool support in the Copilot CLI. | ||
| COPILOT_API_MODEL="${COPILOT_API_MODEL:-gpt-5.4}" |
There was a problem hiding this comment.
Split the Copilot CLI model from REST preflight
When REVIEW_ENGINE=copilot, scripts/review-batch.sh still sources this value and sends it as the model in the GitHub Models REST smoke test before any gh copilot review runs; GitHub's Models REST docs require model IDs in {publisher}/{model_name} form such as openai/gpt-4.1, while this change makes the default a bare Copilot CLI alias. In that primary-Copilot configuration the batch can fail in preflight before reaching the new CLI path; use separate REST/CLI model variables or update the smoke test to exercise gh copilot instead.
Useful? React with 👍 / 👎.
| timeout "$timeout_sec" gh copilot \ | ||
| --model "$COPILOT_API_MODEL" \ | ||
| -p "$prompt_text" \ |
There was a problem hiding this comment.
Smoke-test the same Copilot interface used here
In primary Copilot runs, this new path uses gh copilot, but I checked scripts/review-batch.sh and its preflight still calls the GitHub Models REST endpoint before this line can run. GitHub's REST docs say Models inference needs models: read, while the Copilot CLI docs say headless CLI auth can use a fine-grained PAT with only the Copilot Requests permission, so a token that is valid for the new CLI review path can still fail preflight and abort the batch. Point the smoke test at gh copilot (or skip the REST check) when using the CLI backend.
Useful? React with 👍 / 👎.
| timeout "$timeout_sec" gh copilot \ | ||
| --model "$COPILOT_API_MODEL" \ | ||
| -p "$prompt_text" \ |
There was a problem hiding this comment.
Invoke the standalone Copilot CLI for prompt mode
The new agentic path is using prompt-mode flags (-p, --yolo, --deny-tool, etc.), but the GitHub Copilot CLI docs show those flags on the standalone copilot command (for example copilot -p ...) while gh copilot is the GitHub CLI extension/builtin checked elsewhere in the workflows. In any Copilot primary or fallback run where only gh copilot is available, these prompt-mode arguments can be rejected before triage or writer work starts; install and call the standalone copilot CLI, or keep using the interface supported by gh copilot.
Useful? React with 👍 / 👎.
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
* fix(dev-lead): use heredoc for multiline environment variables * fix(dev-lead): ensure all engines are installed and context is consistent * fix(dev-lead): resolve stale model name in engine fallbacks * fix(dev-lead): improve fallback reliability and script quality - engine.sh: resolve stale model names in fallback loop; use -latest Gemini aliases - dev-lead-fix-reviews.sh: remove unused code and fix PR_URL export * fix(dev-lead): resolve Gemini model names and shell lint warnings * security(dev-lead): use random heredoc delimiter to prevent injection Also updates Gemini models to 3.1 family (pro/flash) for May 2026 compatibility. * fix(dev-lead): update Gemini models to 2.5 stable family * fix(dev-lead): use auto model selection for Gemini * security(dev-lead): harden env var parsing and use high-quota Gemini fallback * fix(dev-lead): use auto model for Gemini * fix(pr-review): robust fallback for write ops and handle copilot 413 * fix(pr-review): optimize triage context size for copilot/low-token engines * fix(pr-review): aggressively trim copilot triage context * fix(pr-review): reduce copilot diff limit to 50 lines for triage * feat(pr-review): self-sufficient agentic copilot with gpt-4o * fix(pr-review): robust rate limit detection and triage debugging * debug(pr-review): verbose copilot chat logging * feat(pr-review): switch copilot to agentic gpt-5.4 and ensure non-interactivity * fix(pr-review): ensure COPILOT_API_MODEL is always bound and valid * fix(dev-lead): correct author_association for comment events
This PR improves the robustness of the PR review agent when primary engines (Claude, Gemini) are rate-limited.
Changes:
Testing:
Summary by CodeRabbit