Skip to content

testbot: target 3 files per run instead of 1 - #1289

Closed
jiaenren wants to merge 1 commit into
mainfrom
jiaenr/testbot-bigger-prs
Closed

testbot: target 3 files per run instead of 1#1289
jiaenren wants to merge 1 commit into
mainfrom
jiaenr/testbot-bigger-prs

Conversation

@jiaenren

@jiaenren jiaenren commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Description

Testbot PRs have been consistently small in scope — every recent one covers exactly one source file:

PR Files Added Target
#1288 2 +553 copying.py
#1283 2 +652 downloading.py
#1280 2 +634 streaming.py
#1278 2 +1193 workflow.py
#1273 1 +522 common.py

(The second changed file is the BUILD entry, not a second target.)

Changes

  • max_targets 1 → 3, on both the dispatch input default and the schedule-path fallback. Nothing hardcodes the count — SELECT_TARGETS_PROMPT.md already renders pick at most {max_targets} and the generator prompt already loops per target — so this is a pure parameter change.
  • max_turns 200 → 400. The generator runs the full read/write/verify/coverage loop per target, and a single target has already exhausted the limit once (runs/26536045087, 101/100, after context auto-compaction).
  • README table refreshed: it documented max_turns=100 and timeout_minutes=30 against the workflow's actual 200 and 60.

Deliberately unchanged

  • max_uncovered stays 500. It is a per-target cap (_cap_ranges is applied inside the per-file loop in parse_coverage_entries, with remaining reset per file), and recent targets carried only 35–231 uncovered lines. Raising it would change nothing; max_targets is the binding constraint. The per-PR ceiling still rises 500 → 1500 as a side effect of targeting 3 files.
  • Schedule and timeout_minutes. Note the workflow is hourly with concurrency.cancel-in-progress: true, so a run is cancelled when the next hourly trigger fires — the effective wall-clock ceiling is ~60 min regardless of timeout_minutes. If 3-target runs start getting cancelled mid-generation, the fix is to slow the cron rather than raise the timeout.

Verification

bazel test //src/scripts/testbot:all //src/scripts/testbot/tests:all — 19 targets pass, including -pylint siblings. Workflow YAML parses with the expected defaults.

Issue - None

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Increased the default number of files processed per test generation run from 1 to 3.
    • Increased the default agent turn limit from 200 to 400.
    • Extended the default run timeout from 30 to 60 minutes.
    • Updated guidance to reflect the expanded processing limits.

Every recent testbot PR covered exactly one source file (#1273, #1278,
#1280, #1283, #1288 — the second changed file is just the BUILD entry).
Raise max_targets 1 -> 3.

max_turns goes 200 -> 400 to match: the generator runs the full
read/write/verify/coverage loop per target, and a single target has
already hit the limit once (runs/26536045087, 101/100).

max_uncovered stays at 500. It is a per-target cap, and recent targets
carried 35-231 uncovered lines, so it is not the binding constraint --
max_targets is. Schedule and timeout are unchanged.

Also refresh the README table, which still documented max_turns=100 and
timeout_minutes=30 against the workflow's 200 and 60.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jiaenren
jiaenren requested a review from a team as a code owner August 11, 2026 21:55
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Testbot defaults now allow up to 3 targets and 400 agent turns. README guidance documents these values and a 60-minute workflow timeout.

Changes

Testbot limits

Layer / File(s) Summary
Workflow defaults and configuration guidance
.github/workflows/testbot.yaml, src/scripts/testbot/README.md
Workflow dispatch, target selection, and Claude test generation now use higher target and turn limits. README guidance documents 3 targets, 400 turns, and a 60-minute timeout.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: adelbertc, aruns-nv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: increasing testbot targets from one file to three per run.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jiaenr/testbot-bigger-prs

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 @.github/workflows/testbot.yaml:
- Line 214: Update the workflow step containing the max-targets argument so
inputs.max_targets is passed through the step’s env as MAX_TARGETS, validated as
a decimal integer before use, and supplied to the command as the quoted
"$MAX_TARGETS" value; remove direct shell interpolation of inputs.max_targets
while preserving the existing default of 3.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 464a01cc-c29f-47a9-a33f-ec7cafa8afae

📥 Commits

Reviewing files that changed from the base of the PR and between 5dc4c8f and 58cc70c.

📒 Files selected for processing (2)
  • .github/workflows/testbot.yaml
  • src/scripts/testbot/README.md

PYTHONPATH=. python src/scripts/testbot/select_targets_agent.py \
--shortlist "$RUNNER_TEMP/shortlist.json" \
--max-targets ${{ inputs.max_targets || '1' }} \
--max-targets ${{ inputs.max_targets || '3' }} \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Do not interpolate inputs.max_targets into the shell command.

GitHub Actions expands this expression before the shell runs. A user who can dispatch the workflow can provide shell metacharacters and alter the generated command. The command can then execute arbitrary code in a step that has ANTHROPIC_API_KEY.

Pass the value through env, validate it as a decimal integer, and quote "$MAX_TARGETS".

Proposed fix
       - name: Pick targets via subagent (Stage 2)
         run: |
+          if ! [[ "$MAX_TARGETS" =~ ^[0-9]+$ ]]; then
+            echo "max_targets must be a non-negative integer, got: $MAX_TARGETS" >&2
+            exit 2
+          fi
           PYTHONPATH=. python src/scripts/testbot/select_targets_agent.py \
             --shortlist "$RUNNER_TEMP/shortlist.json" \
-            --max-targets ${{ inputs.max_targets || '3' }} \
+            --max-targets "$MAX_TARGETS" \
             --output "$RUNNER_TEMP/targets.txt" \
             --meta-output "$RUNNER_TEMP/targets_meta.json"
         env:
+          MAX_TARGETS: ${{ inputs.max_targets || '3' }}
           ANTHROPIC_API_KEY: ${{ secrets.NVIDIA_NIM_KEY }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
--max-targets ${{ inputs.max_targets || '3' }} \
- name: Pick targets via subagent (Stage 2)
run: |
if ! [[ "$MAX_TARGETS" =~ ^[0-9]+$ ]]; then
echo "max_targets must be a non-negative integer, got: $MAX_TARGETS" >&2
exit 2
fi
PYTHONPATH=. python src/scripts/testbot/select_targets_agent.py \
--shortlist "$RUNNER_TEMP/shortlist.json" \
--max-targets "$MAX_TARGETS" \
--output "$RUNNER_TEMP/targets.txt" \
--meta-output "$RUNNER_TEMP/targets_meta.json"
env:
MAX_TARGETS: ${{ inputs.max_targets || '3' }}
ANTHROPIC_API_KEY: ${{ secrets.NVIDIA_NIM_KEY }}
🧰 Tools
🪛 zizmor (1.29.0)

[error] 214-214: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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 @.github/workflows/testbot.yaml at line 214, Update the workflow step
containing the max-targets argument so inputs.max_targets is passed through the
step’s env as MAX_TARGETS, validated as a decimal integer before use, and
supplied to the command as the quoted "$MAX_TARGETS" value; remove direct shell
interpolation of inputs.max_targets while preserving the existing default of 3.

Source: Linters/SAST tools

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.95%. Comparing base (566e2e8) to head (58cc70c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1289      +/-   ##
==========================================
+ Coverage   70.82%   70.95%   +0.12%     
==========================================
  Files         239      239              
  Lines       28501    28501              
  Branches     4298     4298              
==========================================
+ Hits        20186    20222      +36     
+ Misses       7491     7456      -35     
+ Partials      824      823       -1     
Flag Coverage Δ
backend 73.65% <ø> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jiaenren

Copy link
Copy Markdown
Collaborator Author

Superseded by #1290, which combines this with the other open testbot changes.

@jiaenren jiaenren closed this Aug 11, 2026
@jiaenren
jiaenren deleted the jiaenr/testbot-bigger-prs branch August 11, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant