Skip to content

Stop Codex resume retries after invalid request-body rejection - #66553

Merged
pelikhan merged 4 commits into
mainfrom
copilot/aw-top-10-stop-codex-resume-retries
Oct 7, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/aw-top-10-stop-codex-resume-retries

Conversation

Copilot AI commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex resume attempts can repeatedly submit invalid item IDs, exhausting retries on the same invalid_request_body rejection and producing a generic driver-failure report.

  • Retry handling: Recognize invalid_request_body in structured turn.failed events and stop replaying the rejected session, preserving the nonzero exit.
  • Failure reporting: Emit report_incomplete details naming the request-body rejection and explaining why retries stopped.
  • Regression coverage: Reproduce invalid-item-ID rejection during resume on stdout and stderr; assert no repeated resume and a structured failure diagnostic. Keep transcript mentions excluded from classification.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix codex resume retries from invalid item IDs Stop Codex resume retries after invalid request-body rejection Oct 7, 2026
Copilot AI requested a review from pelikhan October 7, 2026 12:25
@pelikhan
pelikhan marked this pull request as ready for review October 7, 2026 12:26
Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:26
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed for PR #66553: no 'implementation' label (has_implementation_label=false) and 0 added lines in business logic directories (threshold 100, no custom .design-gate.yml). Only 2 files changed.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #66553

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The focused changes satisfy the retry and reporting requirements, with regression coverage and no unresolved findings.

Review effort: Balanced
Findings: None

What changed in this PR

Addresses #66490 by stopping Codex retries after deterministic request-body rejections and reporting the cause.

Changes:

  • Recognizes invalid_request_body in structured failure events and emits report_incomplete.
  • Adds regression coverage for stdout/stderr resume failures and excludes transcript mentions from classification.
File Description
actions/​setup/​js/​codex_harness.test.cjs Tests retry termination, diagnostics, and classification boundaries.
actions/​setup/​js/​codex_harness.cjs Detects request-body rejections, stops retries, and reports the cause.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-07T12:29:27Z
review_event: COMMENT
top_themes:
  - no blocking issues found in changed lines
  - retry classification remains scoped to structured turn.failed events
  - regression coverage added for stdout/stderr invalid_request_body resume failures
files_reviewed:
  - actions/setup/js/codex_harness.cjs
  - actions/setup/js/codex_harness.test.cjs
comment_count: 0

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35.9 AIC · ⌖ 5.3 AIC · ⊞ 19.6K · ◷
Comment /review to run again

@github-actions github-actions 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.

Verdict

No blocking issues in the changed lines.

Reviewed scope

I checked the retry classification change in actions/setup/js/codex_harness.cjs and the added regression coverage in actions/setup/js/codex_harness.test.cjs. The new handling stays scoped to structured turn.failed events, preserves the existing unsupported-model special case ordering, and adds coverage for the observed stdout/stderr resume failure shape without broadening transcript-based false positives.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 35.9 AIC · ⌖ 5.3 AIC · ⊞ 19.6K
Comment /review to run again

@github-actions github-actions Bot mentioned this pull request Oct 7, 2026

@github-actions github-actions 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — this is a tight, well-targeted fix with strong regression coverage. Approving with one minor suggestion.

📋 Key Themes & Highlights

Key Themes

  • Root cause correctly addressed: the pattern now recognizes invalid_request_body (not just invalid_request_error), and the refactor from boolean to code-extraction (extractInvalidRequestErrorCode) is a clean way to carry the matched reason into both the log line and the new report_incomplete diagnostic.
  • Minor seam gap: extractInvalidRequestErrorCode isn't exported alongside isInvalidRequestError, so it can only be unit-tested indirectly (see inline comment).

Positive Highlights

  • ✅ Regression test reproduces the exact observed failure (nested JSON item-ID rejection) on both stdout and stderr via it.each, matching the bug report precisely.
  • ✅ New test asserts the harness does not replay the resumed session (calls length stays at 2) and that the diagnostic text ends up in report_incomplete details — verifying both the retry-stop behavior and the improved failure reporting called out in the PR description.
  • ✅ Existing negative-case tests were extended to cover invalid_request_body appearing in transcript/tool-output noise, preserving the "ignore transcript mentions" guarantee.
  • ✅ Doc comments above the pattern and function were updated to reflect the new scope.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 120.4 AIC · ⌖ 14.5 AIC · ⊞ 10.1K
Comment /matt to run again

* @param {string} output
* @returns {string | null}
*/
function extractInvalidRequestErrorCode(output) {

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.

[/codebase-design] Nice extraction — extractInvalidRequestErrorCode gives the caller the matched code for richer diagnostics, which is exactly why this refactor was worth doing. One small seam gap: it isn't added to module.exports (compare the sibling isInvalidRequestError a few lines below), so the new test file can only exercise it indirectly through isInvalidRequestError and the full harness fixture.

💡 Why this matters

Exporting it would let a focused unit test assert the exact returned code string (invalid_request_error vs invalid_request_body) without needing a full turn.failed JSON fixture and process spawn, improving navigability for the next person who extends this pattern (e.g. adding another invalid_request_* variant).

module.exports = {
  ...
  isInvalidRequestError,
  extractInvalidRequestErrorCode, // add this
  ...
};

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exported extractInvalidRequestErrorCode and added direct assertions for both returned codes and transcript-only content in actions/setup/js/codex_harness.test.cjs. Commit: a567b9f.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:258): [/codebase-design] Nice extraction — extractInvalidRequestErrorCode gives the caller the matched code for richer diagnostics, which is exactly why this refactor was worth doing. One small seam gap: it isn't added to module.exports (compare the sibling isInvalidRequestError a few lines below), so the new test file can only exercise it indirectly through isInvalidRequestError and the full harness fixture. - Stop Codex resume retries after invalid request-body rejection #66553 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: aa98660
Sous-chef work: 12c2c92e4c9a9778947cc052cc4668caa051e8c0e73da1fab95d9b6cc2a62e35
Sous-chef state: be8252b759e0a52bcf9543dfddb60876d0a67bbed1e1daf5f699ad2159381b0c

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 3.14 AIC · ⌖ 12 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 7, 2026 13:12
…p-codex-resume-retries

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 7, 2026 13:23
@pelikhan
pelikhan merged commit 3cd8e42 into main Oct 7, 2026
3 checks passed
@pelikhan
pelikhan deleted the copilot/aw-top-10-stop-codex-resume-retries branch October 7, 2026 13:28
Copilot AI added a commit that referenced this pull request Oct 7, 2026
* Initial plan

* Stop Codex resume retries on deterministic request-body rejection

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Export Codex request error code helper

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
pelikhan added a commit that referenced this pull request Oct 7, 2026
…66554)

* Initial plan

* Align nine workflow tool permissions and warn on denied prompt tools

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* docs(adr): add draft ADR-66554 for advisory prompt tool validation

* Classify stalled Codex MCP calls as transport wedges (#66303)
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

* Stop Codex resume retries after invalid request-body rejection (#66553)

* Initial plan

* Stop Codex resume retries on deterministic request-body rejection

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

* Export Codex request error code helper

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

* Blog Auditor: add agentic-workflows MCP tool for snippet validation (#66560)

* Initial plan

* Apply remaining changes

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

* Fix prompt tool validation review findings

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

* Address follow-up prompt validation findings

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.5

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.

[AW Top 10] 06 Stop codex resume retries from invalid item IDs

4 participants