ci(pr-automation): reserve turns a repair can spend - #1939
Conversation
790024d to
2cad70e
Compare
|
Investigation notes and validation detail, kept out of the commit message. How the run was diagnosedRun 34446208599 looked like a clean success, and the only annotation was
That last pair is the tell: the stage died with half its repair budget unspent. Counting the The reporting path was not at faultWorth stating explicitly, since the green run invites the opposite conclusion. Everything downstream handled the failure correctly:
The run stays green because review state is written to the pull request rather than by failing the job. That is by design, so the fix belongs in the runtime, not in reporting. Why two turns per attempt, and not moreA repair round is genuinely bounded at two provider calls. It does over-reserve for schema and JSON rejections, which never get tools and so cost one call per attempt. That is the safe direction: over-reserving costs investigation turns, while under-reserving silently discards configured repair attempts. Why
|
There was a problem hiding this comment.
🟡 Changes recommended
The unconditional reservation unnecessarily reduces investigation capacity for agents without tool-assisted semantic validation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes CI review automation so all configured output-repair attempts remain reachable.
Changes:
- Reserves two provider turns per tool-assisted repair.
- Preserves the general reviewer’s investigation budget.
- Adds regression tests and rebuilds the bundled action.
Protocol review was skipped because no RDP behavior changes.
File summaries
| File | Description |
|---|---|
.github/actions/openai-agent/src/agent.js |
Revises turn reservation logic. |
.github/actions/openai-agent/test/agent.test.js |
Adds repair-budget regression coverage. |
.github/actions/openai-agent/test/main.test.js |
Adjusts fixture turn budgets. |
.github/pr-automation/agents/general-reviewer.json |
Preserves 27 investigation turns. |
.github/actions/openai-agent/dist/index.js |
Bundles the runtime change. |
Review details
- Files reviewed: 4/5 changed files
- Comments generated: 1
- Review effort level: Balanced
2cad70e to
50772bc
Compare
|
Revised across two review rounds. Superseded by the notes below; kept for the record. The reservation is conditional on a tool-assisted repair being possible, not merely on a repair happening: A second guard was added after review: Validation
How run 34446208599 failedThe stage was not a review-generation failure and the publication path was not at fault. The model finished a review ( With Exhaustion now exits through the repair-limit branch, so the failure carries the actual validation reason ( Still out of scope
On the general reviewer's Note Written by Copilot App (Claude Opus 5), on behalf of Benoît Cortier (@CBenoit). |
50772bc to
9ca2d1d
Compare
There was a problem hiding this comment.
Independent review confirms the core fix: with a validator and tool budget, a semantic repair can spend two provider calls (evidence plus corrected answer), so reserving 1 + 2*attempts is exact, and the conditional correctly mirrors toolsPermitted's reachability (kind 'validator' requires a validator; tools require max_tool_calls > 0). The regression test adapts to whatever window the formula produces and fails against the old expression; the max_turns bump to 32 preserves the 27-turn investigation window. Both code-compressor nits (stale fixture comment, redundant Boolean coercion) verified and accepted; one independent low-severity note on clamped degenerate configs where a tool-assisted repair still cannot finish.
A semantic rejection lets a repair spend one tool-enabled call on evidence before it answers, so a repair attempt costs two provider calls wherever such a repair is possible and one otherwise. The runtime reserved a single call per attempt, so a long investigation left the last attempts unreachable: the stage died on the turn ceiling with its repair budget unspent, reporting an opaque limit rather than what the model kept getting wrong. The general reviewer hit exactly this. It produced a review, had it rejected twice on the same validation error, then exceeded its turn count with one of its two repairs still unused, so the pull request went unreviewed while every job reported success. Reserve the calls a repair can actually spend, withhold the evidence call when the answer after it would not fit, and raise the general reviewer's ceiling so its investigation window is unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
9ca2d1d to
c6fe02e
Compare
There was a problem hiding this comment.
The PR fixes turn accounting in the openai-agent runtime: reservedFinalTurns now reserves two provider calls per repair attempt when tool-assisted repair is possible (validator present and max_tool_calls > 0) and one otherwise, matching how repair() actually spends calls; a new toolsPermitted guard withholds the evidence call when the follow-up answer would not fit, and the general reviewer's max_turns rises 30 to 32 to keep its 27-turn investigation window. I traced the repair loop, validateCandidate, the reservation arithmetic, and both new tests: the formula is exact for the reachable worst case, the conditional mirrors the toolsPermitted condition so validator-free callers keep their prior window, and the saturated test is genuinely sensitive to the reservation. I found no correctness defect; only the pre-existing, PR-acknowledged residual that a very small max_turns with multiple repairs can still exhaust the ceiling before the last repair attempt.
A semantic rejection lets a repair spend one tool-enabled call on evidence before it answers, so a repair attempt costs two provider calls wherever such a repair is possible and one otherwise. The runtime reserved a single call per attempt, so a long investigation left the last attempts unreachable: the stage died on the turn ceiling with its repair budget unspent, reporting an opaque limit rather than what the model kept getting wrong.
The general reviewer hit exactly this. It produced a review, had it rejected twice on the same validation error, then exceeded its turn count with one of its two repairs still unused, so the pull request went unreviewed while every job reported success.
Reserve the calls a repair can actually spend, withhold the evidence call when the answer after it would not fit, and raise the general reviewer's ceiling so its investigation window is unchanged.
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com