Skip to content

Support Codex and Claude as isolated response repair backends - #755

Merged
wwind123 merged 2 commits into
mainfrom
codex/add-cli-repair-providers
Sep 9, 2026
Merged

Support Codex and Claude as isolated response repair backends#755
wwind123 merged 2 commits into
mainfrom
codex/add-cli-repair-providers

Conversation

@wwind123

@wwind123 wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

Allow Codex and Claude CLI models to repair malformed agent responses, independently of coder and reviewer selection. The default remains Antigravity; this does not change the installed tool or any running queue.

Why

Formatting recovery currently supports Antigravity and the legacy Gemini CLI only. When those services are unavailable or a repair candidate loses substantive content, users cannot select their available Codex or Claude models for recovery. The same schema and content-preservation requirements must apply whichever model performs the repair.

Changes

  • Add --repair-backend codex and --repair-backend claude. Both require an explicit --repair-model; repeated model flags provide a same-backend fallback chain without querying or appending Antigravity models.
  • Add --repair-reasoning-effort, defaulting independently to medium for these backends, with provider-specific validation and recovery-command preservation.
  • Run each attempt in a fresh temporary directory with stdin input, no resumed session, and the existing bounded runner/repair containment role. Do not forward coder/reviewer arguments or dangerous permission flags.
  • Codex uses ephemeral execution, ignores user config/rules, uses a read-only sandbox, and disables shell, web search, and subagents. Claude uses safe mode, no tools or MCP, and no session persistence. Unsupported CLI flags fail closed rather than weakening restrictions.
  • Keep schema validation and content-preservation checks unchanged. Nonzero exits/timeouts from these backends are rejected. Record reported token usage when available, otherwise estimates, and repair-specific model/effort metadata.
  • Document configuration and add regression coverage for invocation isolation, model/effort independence, option propagation, lossy-output rejection, fallback, and failure outcomes.

Usage

Append to an issue or PR invocation:

--repair-backend codex \
--repair-model gpt-5.6-luna \
--repair-reasoning-effort medium

Claude alternative:

--repair-backend claude \
--repair-model claude-sonnet-5 \
--repair-reasoning-effort medium

--codex-cmd / --claude-cmd select the executable. Existing --repair-timeout-seconds remains the per-attempt timeout (default 120 seconds).

Verification

  • Full regression suite: 2,668 passed in 103.45 seconds.
  • After adding six CLI-to-config propagation cases, focused repair and role-model suites: 218 passed.
  • git diff --check: passed.
  • No live provider replay completed. Sending the saved project response to a repair provider requires explicit approval; unit tests use controlled CLI results. No GitHub review results were salvaged or posted, and no queue was restarted.

-- OpenAI Codex

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Review verdict: Blocking

Codex/Claude isolated repair backends are correctly wired: fresh temp cwd per attempt, stdin-routed prompt (no argv size limit and no prompt leakage into argv), no forwarding of coder/reviewer args or dangerous permission flags, per-attempt timeout, fail-closed on nonzero exit/timeout/empty output, provider-reported usage with estimate fallback, and validation plus the content-preservation guard still gating acceptance. Config validation, recovery-option passthrough, preflight CLI resolution (repair_backend was already in preflight_agent_commands), and docs in local_agent_loop.md/skill_mode.md all look consistent; GitHub checks are passing. Two small cleanups in touched code should land before merge.

Same-PR follow-ups

  • src/coding_review_agent_loop/repair.py:1131 — RepairAttemptResult.backend is still annotated Literal["antigravity", "gemini"] while this PR populates it with "codex" and "claude"; widen the Literal so the declared type matches the values now stored and rendered in orchestrator diagnostics.
  • The repair effort default "medium" is hardcoded twice (agents/format_repair.py:29 config.repair_reasoning_effort or "medium" and repair.py:1428 for the usage record's configured_effort), so the invoked effort and the recorded effort can drift; reuse the existing DEFAULT_REASONING_EFFORT constant from config.py in both places (or resolve once and pass it through).

-- Anthropic Claude: claude-opus-5 (medium)

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Review verdict: Blocking

The isolated Codex/Claude repair paths, validation behavior, documentation, and coverage are otherwise coherent, and GitHub checks are passing. One localized type-contract cleanup remains before approval.

Same-PR follow-ups

  • src/coding_review_agent_loop/repair.py:1131 still declares RepairAttemptResult.backend as only Literal["antigravity", "gemini"], even though this PR now constructs those records with "codex" and "claude". Extend the literal to cover all four supported repair backends so the declared contract matches the new runtime behavior and static consumers can represent these results correctly.

-- OpenAI Codex: gpt-5.6-sol (medium)

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

PR review round 1 reconciliation: settled reviewers: Claude, Codex. Finalization continues after reconciliation.

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Coder follow-up

Implemented and pushed the requested localized repair typing and default-effort cleanup to PR #755 in commit cf1c8b8.

Addressed items

  • item-1: Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: src/coding_review_agent_loop/repair.py:1131 — RepairAttemptResult.backend is still annotated `L...
    • Resolution: Extended RepairAttemptResult.backend to represent antigravity, gemini, codex, and claude.
  • item-2: Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: The repair effort default "medium" is hardcoded twice (agents/format_repair.py:29 `config.repai...
    • Resolution: Replaced both hardcoded repair effort fallbacks with config.DEFAULT_REASONING_EFFORT and made the focused regression test derive its expectation from that constant; tests/test_cli_repair.py exercises invocation and usage-record effort propagation for both CLI repair backends.
  • item-3: Same-PR follow-up from OpenAI Codex: gpt-5.6-sol (medium), round 1: src/coding_review_agent_loop/repair.py:1131 still declares RepairAttemptResult.backend as onl...
    • Resolution: Extended RepairAttemptResult.backend to cover all four supported repair backends, matching the runtime records introduced by this PR.

Remaining items

  • None.

Tests run

  • python3 -m pytest tests/test_cli_repair.py -q (agent-loop instrumented; whole-command timeout 120s)

-- OpenAI Codex: gpt-5.6-sol (medium)

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Review verdict: Approved

Round 2 verified against head cf1c8b8. Both round-1 same-PR items are fixed: RepairAttemptResult.backend now declares all four repair backends, and the repair effort default is sourced from config.DEFAULT_REASONING_EFFORT in agents/format_repair.py, repair.py's usage record, and the test's expectation, so the invoked and recorded effort cannot drift. The new module-level from ..config import DEFAULT_REASONING_EFFORT in agents/format_repair.py introduces no import cycle (config imports only agents.base and agents.registry, neither of which reaches format_repair). The rest of the feature is unchanged and still sound: isolated temp cwd per attempt, stdin-routed prompt, no forwarding of coder/reviewer args or dangerous permission flags, per-attempt timeout, fail-closed on nonzero exit/timeout/empty output, provider-reported usage with estimate fallback, and validation plus the content-preservation guard gating acceptance; docs in local_agent_loop.md and skill_mode.md cover the new flags. Note that the GitHub test check is still pending (in_progress) at review time, so CI has not confirmed the suite for this head commit.

Prior unresolved item dispositions

  • [item-1] Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: src/coding_review_agent_loop/repair.py:1131 — RepairAttemptResult.backend is still annotated `L... -> resolved
  • [item-2] Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: The repair effort default "medium" is hardcoded twice (agents/format_repair.py:29 `config.repai... -> resolved
  • [item-3] Same-PR follow-up from OpenAI Codex: gpt-5.6-sol (medium), round 1: src/coding_review_agent_loop/repair.py:1131 still declares RepairAttemptResult.backend as onl... -> resolved

-- Anthropic Claude: claude-opus-5 (medium)

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Review verdict: Approved

The round-1 typing and reasoning-effort default issues are resolved, and the isolated Codex/Claude repair paths, configuration plumbing, documentation, and focused tests are coherent on static review. No new merge blockers were found. The authoritative GitHub test check remains in progress; local tests were not run because this review assignment prohibits test execution.

Prior unresolved item dispositions

  • [item-1] Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: src/coding_review_agent_loop/repair.py:1131 — RepairAttemptResult.backend is still annotated `L... -> resolved
  • [item-2] Same-PR follow-up from Anthropic Claude: claude-opus-5 (medium), round 1: The repair effort default "medium" is hardcoded twice (agents/format_repair.py:29 `config.repai... -> resolved
  • [item-3] Same-PR follow-up from OpenAI Codex: gpt-5.6-sol (medium), round 1: src/coding_review_agent_loop/repair.py:1131 still declares RepairAttemptResult.backend as onl... -> resolved

-- OpenAI Codex: gpt-5.6-sol (medium)

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

PR review round 2 reconciliation: settled reviewers: Claude, Codex. Finalization continues after reconciliation.

@wwind123

wwind123 commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Reviewers approved PR #755; watching GitHub checks in the foreground. No coder or reviewer agents will run while checks remain pending.

-- coding-review-agent-loop

@wwind123
wwind123 merged commit 5b751df into main Sep 9, 2026
1 check 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.

1 participant