Skip to content

fix(coding-loop): never report an unrun reviewer as an approval - #178

Merged
AbirAbbas merged 6 commits into
Agent-Field:mainfrom
Jack11111eee:fix/review-unavailable-not-approve
Nov 23, 2026
Merged

AbirAbbas merged 6 commits into
Agent-Field:mainfrom
Jack11111eee:fix/review-unavailable-not-approve

Conversation

@Jack11111eee

Copy link
Copy Markdown
Contributor

Summary

  • An exception from run_code_reviewer / run_qa is now recorded as unavailable (review_unavailable / qa_unavailable) instead of being turned into a verdict.
  • Both the default and flagged coding-loop paths return COMPLETED_WITH_DEBT when the reviewer never ran, rather than COMPLETED. With no file changes the issue still fails as FAILED_UNRECOVERABLE.
  • The QA synthesizer prompt now states explicitly that an unavailable agent is neither a test failure nor an approval.

Why: _run_default_path used to substitute {"approved": True} on any reviewer exception, so a timeout or provider error was indistinguishable from a clean review. In a real 35-issue build a QA timeout was read by the synthesizer as "no real test failures" and the issue was approved. Full evidence: #175.

Fixes #175

Validation

  • Ran the test suite directly (.venv/bin/python -m pytest tests/ -q): 2214 passed, 1 skipped on this branch (the equivalent make check was not run verbatim).
  • New tests in tests/test_coding_loop.py:
    • reviewer raises → COMPLETED_WITH_DEBT, review_unavailable in iteration_history, no clean approval;
    • reviewer raises with no file changes → FAILED_UNRECOVERABLE;
    • flagged path: synthesizer says approve but reviewer was unavailable → still COMPLETED_WITH_DEBT;
    • flagged path: QA unavailable + reviewer approved (synthesizer also unavailable) → COMPLETED.

Behavior Impact

  • Backward compatible behavior change

An issue whose reviewer failed is now reported as COMPLETED_WITH_DEBT instead of COMPLETED, so it is visible in the build's debt accounting. Unverified code is also no longer written to the shared-memory convention store. Builds that never hit a reviewer failure are unchanged.

Notes

  • review_unavailable / qa_unavailable are additive keys in the agent result dicts, so existing consumers keep working.
  • The synthesizer's LLM decision is still respected for fix/block; only an approve it emits without a reviewer verdict is downgraded to debt.

When the code reviewer raised (timeout, provider error, malformed
response) the coding loop synthesised {"approved": True} and counted
the issue as COMPLETED. The build then reported work as reviewed when no
review had happened, and the flagged QA+review path fed the failure text
to the synthesizer as if it were a real result (an observed QA timeout
was read as "no real test failures" and approved).

Treat an infrastructure failure as 'unavailable' rather than as a
verdict: mark the result with review_unavailable / qa_unavailable, and
accept the coder's output as COMPLETED_WITH_DEBT instead of COMPLETED.
Failing with no file changes remains FAILED_UNRECOVERABLE. The
synthesizer prompt now says explicitly that an unavailable agent is not
evidence of failure or approval.
@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T06:59:46.663366Z 6267515 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6267515e60

ℹ️ 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".

Comment thread swe_af/execution/coding_loop.py Resolved
AbirAbbas and others added 5 commits November 23, 2026 08:36
…run-reviewer fallback

Conflicts with main's reviewer-outage blocker carry-forward and iteration
history keys resolved as unions: a previously blocking review is still carried
forward, otherwise an unrun reviewer is marked review_unavailable.

Takeover fixes, each never worse than main:
- Flagged path, synthesizer down: accept with debt only when QA really passed.
  A real QA failure, or QA also unavailable, keeps main's fix fallback (the
  Codex P1 finding). Drop the loosening that approved cleanly on an unrun QA.
- approve_with_debt always records a review_unavailable debt item, as the
  COMPLETED_WITH_DEBT invariant in _debt_items_from_review requires.
- A no-change result with an unrun reviewer stays COMPLETED_WITH_DEBT instead
  of becoming FAILED_UNRECOVERABLE (main completed it).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y the debt decision on resume

The adversarial pass on the landing tree found the unrun-reviewer fix only
covered an RPC failure; the reviewer reasoner itself still returned
approved=True when its harness raised or produced nothing, which is how a
reviewer outage really shows up.

- run_code_reviewer reports an outage as approved=False, blocking=False,
  review_unavailable=True (added after model_dump so the agent's output schema
  is unchanged); run_qa reports qa_unavailable=True so the synthesizer prompt
  stops reading it as failing tests.
- run_qa_synthesizer's local fallback treats an unavailable reviewer with
  passing QA like the previous approve (the loop records it as debt) instead of
  falling to fix, which main completed and this branch would have failed.
- A reviewer outage never erases the previous iteration's blocking finding on
  the default path, whether the call raised or the reasoner reported it.
- A checkpointed approve_with_debt decision replays as COMPLETED_WITH_DEBT
  with its debt item when the iteration window was already exhausted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…clean completion

test_takeover_regressions pinned the old fail-open outcome (COMPLETED) for a
reviewer that never ran. The outcome is now COMPLETED_WITH_DEBT with a
review_unavailable debt item; the branch is still accepted and merged, only the
trust record changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…proval nor objection

With passing QA and a reviewer outage, the synthesizer used to see an
approved review and approve. Telling it "approval is unknown" invited a BLOCK
or FIX main would never have produced. Say instead that nothing was objected
to, to decide on QA and the code, and that an APPROVE is recorded as debt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AbirAbbas

Copy link
Copy Markdown
Collaborator

Took this over: merged main (conflicts in coding_loop.py with the escalation work, resolved so a previous blocking review still survives a reviewer outage) and pushed a few commits.

  • The Codex P1 is fixed: with the synthesizer down, a reviewer outage only accepts with debt when QA actually passed. A real QA failure, or QA also missing, goes back to fix as before.
  • run_code_reviewer itself still returned approved=True when its harness raised or produced nothing, which is how a reviewer really fails, so the new path never triggered for it. It and run_qa now flag their own outage (added after model_dump(), so the agent output schemas are unchanged), and the synthesizer fallback and prompt treat a missing review as neither approval nor objection.
  • approve_with_debt now records a review_unavailable debt item. A result with no file changes and no reviewer is debt rather than FAILED_UNRECOVERABLE, since main completed that.
  • A checkpointed approve_with_debt replays as debt on resume.
  • test_reviewer_outage_without_unresolved_blocker used to pin COMPLETED; it now expects COMPLETED_WITH_DEBT.

@AbirAbbas
AbirAbbas merged commit 0de5364 into Agent-Field:main Nov 23, 2026
5 checks passed
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.

Coding loop records a reviewer infrastructure failure as approved=True

3 participants