Skip to content

Harden repair execution for rebase conflicts - #308

Closed
Jhacarreiro wants to merge 1 commit into
openclaw:mainfrom
Jhacarreiro:fix/rebase-conflict-repair-mode
Closed

Jhacarreiro wants to merge 1 commit into
openclaw:mainfrom
Jhacarreiro:fix/rebase-conflict-repair-mode

Conversation

@Jhacarreiro

Copy link
Copy Markdown
Contributor

Summary

  • pass current unmerged rebase paths into the Codex repair prompt
  • make the prompt explicitly enter conflict-first mode before functional repair
  • keep retrying edit attempts when a Codex pass exits successfully but leaves unmerged paths
  • block with exact unresolved conflict paths after edit attempts are exhausted

Rationale

Repair execution currently treats any working tree change as enough to leave the edit loop. In a conflicted rebase, unresolved unmerged paths are also working tree changes, so the executor can proceed to completeRebaseIfResolved() and fail only after the edit loop has ended. This makes the repair worker less likely to retry with focused conflict evidence.

This keeps conflict handling inside the bounded edit loop and makes unresolved conflict paths explicit in progress/reporting.

Verification

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm run build:repair
  • node --test dist/repair/fix-prompt-builder.test.js
  • node --test dist/repair/fix-prompt-builder.test.js test/repair/execute-fix-validation.test.ts test/repair/fix-edit-policy.test.ts test/repair/mechanical-rebase-conflicts.test.ts

@clawsweeper

clawsweeper Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 16, 2026, 2:52 PM ET / 18:52 UTC.

Summary
The branch changes repair execution and prompt text so conflicted rebase paths are shown to Codex, unresolved paths retry inside the edit loop, and exhausted conflicts are reported as needs_human.

Reproducibility: yes. from source inspection, but not from a live run: current main can treat unresolved rebase conflicts as working-tree changes before completeRebaseIfResolved() reports the unresolved paths.

Review metrics: 2 noteworthy metrics.

  • Patch surface: 4 files changed, +75/-6. The diff is focused, but it touches repair execution control flow and tests.
  • Current failing check: 1 check failing: pnpm check. The latest CI run fails formatting, so the current head is not merge-ready even before proof review.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Remove the extra blank line or run the formatter so pnpm check passes.
  • [P1] Add redacted terminal output or worker logs from a real conflicted repair run showing retry or blocked-path behavior.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No after-fix real behavior proof is present; the contributor should add redacted terminal output or worker logs from a real conflicted repair run, update the PR body to trigger re-review, and ask a maintainer for @clawsweeper re-review if it does not rerun automatically.

Risk before merge

  • [P1] The PR changes repair-worker control flow for conflicted rebases, and tests/source review do not prove a live worker run retries or blocks with the expected unresolved paths.
  • [P1] pnpm check currently fails in format:check on test/repair/execute-fix-artifact-source.test.ts after the latest force-push.

Maintainer options:

  1. Require proof and green check (recommended)
    Ask for the formatting fix plus redacted terminal output or worker logs from a real conflicted repair run showing retry or exact blocked-path behavior.
  2. Accept source and test evidence only
    Maintainers could merge after the format fix without live proof, but they would own the risk that the repair-worker path behaves differently in a real conflicted checkout.

Next step before merge

  • [P1] Contributor or maintainer handling is needed because the PR needs real conflicted-run proof and a green check; automation cannot supply the contributor's live repair-worker proof.

Security
Cleared: No concrete security or supply-chain concern was found; the diff changes repair TypeScript control flow, prompt text, and tests without dependency, workflow, permission, or secret-handling changes.

Review findings

  • [P2] Remove the extra blank line before the new test — test/repair/execute-fix-artifact-source.test.ts:152
Review details

Best possible solution:

Land the narrow conflict-loop hardening after the formatting failure is fixed and the contributor adds redacted live repair-worker proof for the conflicted rebase retry or blocked-path behavior.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection, but not from a live run: current main can treat unresolved rebase conflicts as working-tree changes before completeRebaseIfResolved() reports the unresolved paths.

Is this the best way to solve the issue?

Yes in direction: keeping unresolved conflicts inside the bounded edit loop is the narrow repair path, but this PR still needs the format fix and live behavior proof before merge.

Full review comments:

  • [P2] Remove the extra blank line before the new test — test/repair/execute-fix-artifact-source.test.ts:152
    The latest pnpm check job fails in format:check because oxfmt reports this file. The diff adds an extra blank line before the new test; run the formatter or remove the extra blank so required checks can pass.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c88270b81889.

Label changes

Label justifications:

  • P2: The PR addresses a bounded repair-lane reliability issue around conflicted rebase handling.
  • merge-risk: 🚨 automation: The diff changes repair-worker retry and block behavior for conflicted rebases, which CI does not fully prove in a live worker run.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No after-fix real behavior proof is present; the contributor should add redacted terminal output or worker logs from a real conflicted repair run, update the PR body to trigger re-review, and ask a maintainer for @clawsweeper re-review if it does not rerun automatically.
Evidence reviewed

What I checked:

Likely related people:

  • Peter Steinberger: Blame and path history tie the current repair edit loop, rebase completion helpers, and prompt-builder behavior to his repair automation work. (role: feature owner and recent area contributor; confidence: high; commits: dc824915bb6c, 55b06242dc49, a86c5b2483c2; files: src/repair/execute-fix-artifact.ts, src/repair/fix-prompt-builder.ts, src/repair/git-repo-utils.ts)
  • Jhacarreiro: Current-main history shows prior merged repair-only PR intake work touching src/repair/execute-fix-artifact.ts, so this author has relevant merged history beyond this PR. (role: recent area contributor; confidence: medium; commits: ad4576f7ee7e; files: src/repair/execute-fix-artifact.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jun 16, 2026
@Jhacarreiro
Jhacarreiro force-pushed the fix/rebase-conflict-repair-mode branch 2 times, most recently from b22b040 to 3064d1b Compare June 16, 2026 19:51
@Jhacarreiro

Copy link
Copy Markdown
Contributor Author

Closing this branch for now instead of trying to prove it with local operational runs.

If the rebase-conflict hardening is still needed, it should come back as a small, model-agnostic PR focused only on deterministic conflict lifecycle behavior, with clean checks and upstream-clean proof. Any adapter or non-Codex-specific behavior must not be part of ClawSweeper.

@Jhacarreiro

Copy link
Copy Markdown
Contributor Author

Closed in favor of smaller model-agnostic PRs only; adapter/non-Codex behavior must stay outside ClawSweeper.

@steipete

Copy link
Copy Markdown
Contributor

Landed the reviewed rewrite in #332 via commit 39239e7.

The original fork branch rejected maintainer pushes despite GitHub reporting maintainer edits enabled, so I recreated the final tree as one maintainer commit and preserved João's co-author credit. Thank you for identifying the rebase-conflict retry gap. For future contributions, please verify that “Allow edits by maintainers” also grants the repository bot/token branch write access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants