Skip to content

Clarify rebase conflict repair prompts - #321

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

Jhacarreiro wants to merge 1 commit into
openclaw:mainfrom
Jhacarreiro:fix/conflict-first-rebase-prompt

Conversation

@Jhacarreiro

Copy link
Copy Markdown
Contributor

Summary

Make repair prompts more explicit when a deterministic pre-edit rebase reports conflicts.

Instead of a single generic sentence, the prompt now enters a conflict-first mode that tells the editor to resolve the active rebase conflicts before broadening the repair patch.

Changes

  • Render conflict-first instructions for conflicted rebase results.
  • Include known unmerged paths when the rebase result provides them.
  • Extend the fix-prompt regression test to cover the new conflict-first guidance.

Validation

  • corepack pnpm run build:repair
  • node --test dist/repair/fix-prompt-builder.test.js

@clawsweeper

clawsweeper Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 18, 2026, 5:04 PM ET / 21:04 UTC.

Summary
The PR changes the repair fix prompt renderer and regression test to replace the generic conflicted-rebase sentence with conflict-first guidance and an optional unmerged-path list.

Reproducibility: yes. for the review finding: source inspection shows production rebaseOntoBase conflict results do not include unmerged_paths, while the PR's test injects that field manually.

Review metrics: 1 noteworthy metric.

  • Changed surface: 2 files, +20/-2. The PR is narrowly scoped to one repair prompt helper and one regression test, so the remaining blocker is focused.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦪 silver shellfish
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:

  • Plumb actual unmerged paths from the conflicted rebase path into buildFixPrompt and update the regression test to cover that production-shaped input.
  • [P1] Add redacted real behavior proof, such as terminal output from rendering a conflicted-rebase prompt after the fix.

Proof guidance:

  • [P1] Needs real behavior proof before merge: This external PR needs redacted real behavior proof, such as copied terminal output or logs showing the generated prompt after the change; updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The advertised unmerged-path guidance will not appear in real conflicted rebase prompts until the actual unmergedPaths(targetDir) data is plumbed into the prompt input.
  • [P1] The external PR needs real behavior proof before merge; the body currently lists commands but no after-fix output or artifact.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the conflict-first prompt direction, but plumb actual unmerged paths from the rebase path into the prompt and add redacted real output proof before merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Manual review is needed because the contributor must fix the prompt data plumbing and provide real behavior proof before merge; this is not suitable for a repair marker while proof is missing.

Security
Cleared: The diff only changes repair prompt text and a regression test, with no dependency, workflow, secret, permission, or supply-chain change.

Review findings

  • [P2] Plumb the actual unmerged paths into the prompt — src/repair/fix-prompt-builder.ts:287-289
Review details

Best possible solution:

Keep the conflict-first prompt direction, but plumb actual unmerged paths from the rebase path into the prompt and add redacted real output proof before merge.

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

Yes for the review finding: source inspection shows production rebaseOntoBase conflict results do not include unmerged_paths, while the PR's test injects that field manually.

Is this the best way to solve the issue?

No, not yet; the conflict-first wording is narrow, but the path-list part should be solved by passing or storing actual unmerged paths rather than relying on a field no production caller sets.

Full review comments:

  • [P2] Plumb the actual unmerged paths into the prompt — src/repair/fix-prompt-builder.ts:287-289
    This reads unmerged_paths from rebaseResult, but the production RebaseOntoBaseResult never sets that property and editValidatePrepareMerge passes the raw result into buildFixPrompt. In real conflicted rebases the new Unmerged conflict paths line will be omitted even though unmergedPaths(targetDir) is available, so please populate that field or pass the actual paths into the prompt and cover the production path.
    Confidence: 0.88

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 a6ee02e323c1.

Label changes

Label changes:

  • add P2: This is a normal-priority repair automation improvement with a concrete but limited prompt-plumbing defect.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: This external PR needs redacted real behavior proof, such as copied terminal output or logs showing the generated prompt after the change; updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a normal-priority repair automation improvement with a concrete but limited prompt-plumbing defect.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: This external PR needs redacted real behavior proof, such as copied terminal output or logs showing the generated prompt after the change; updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • PR diff adds optional path rendering: The proposed renderer reads rebaseResult.unmerged_paths and prints Unmerged conflict paths only when that optional array is present. (src/repair/fix-prompt-builder.ts:287, 4550e50ee3d5)
  • Production rebase result type lacks the field: Current main's RebaseOntoBaseResult type includes status, refs, heads, and detail, but no unmerged_paths property. (src/repair/git-repo-utils.ts:28, a6ee02e323c1)
  • Conflict result does not attach known paths: The conflicted rebase return path detects unmergedPaths(targetDir) but returns only the standard result fields, so the prompt builder will not receive the new array from this producer. (src/repair/git-repo-utils.ts:153, a6ee02e323c1)
  • Caller passes raw rebase result: editValidatePrepareMerge passes rebaseResult directly into buildFixPrompt; it separately computes unmerged paths for policy decisions but does not add them to the prompt input. (src/repair/execute-fix-artifact.ts:1974, a6ee02e323c1)
  • PR proof is missing: The PR body lists validation commands but includes no copied terminal output, log, screenshot, recording, or linked artifact showing the generated after-fix prompt in a real run. (4550e50ee3d5)
  • Repository policy read: AGENTS.md was read fully and applied as review guidance for a narrow, read-only repair-lane PR review. (AGENTS.md:1, a6ee02e323c1)

Likely related people:

  • Peter Steinberger: Git blame and path history show the repair prompt, rebase utility, and recent prompt/changelog guard work in this area were introduced or updated by this author. (role: introduced behavior and recent area contributor; confidence: high; commits: dc824915bb6c, f84e575ec6e1, e0d595ca3b5e; files: src/repair/fix-prompt-builder.ts, src/repair/fix-prompt-builder.test.ts, src/repair/git-repo-utils.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. labels Jun 18, 2026
@Jhacarreiro

Copy link
Copy Markdown
Contributor Author

Validation evidence

Local validation run against this branch:

corepack pnpm run build:repair
node --test dist/repair/fix-prompt-builder.test.js

Result:

build:repair: passed
fix-prompt-builder.test.js: 12/12 tests passed

Behavior covered by the updated regression test:

fix prompt includes rebase and previous no-diff recovery details

The test now verifies that conflicted rebase prompts include:

Conflict-first mode:
resolve only the active rebase conflicts before doing any feature repair
git status --short
git rebase --continue
Unmerged conflict paths: CHANGELOG.md, src/messages.ts

This is a prompt-only hardening change. It does not alter the repair executor state machine.

@Jhacarreiro

Copy link
Copy Markdown
Contributor Author

Closing as superseded by current main.

I checked the current main implementation after rebasing this branch, and the conflict-first prompt behavior is already present there:

- resolve only the active rebase conflicts before doing any feature repair;
- inspect `git status --short` and the conflicted files listed below;
- remove all conflict markers and stage the resolved files;
- run `git rebase --continue` until the checkout is no longer rebasing;
- Unmerged conflict paths: ...

The rebase conflict on this PR is therefore a duplicate test/context conflict, not a missing behavior. Keeping this PR open would only duplicate current-main behavior.

@Jhacarreiro

Copy link
Copy Markdown
Contributor Author

Closed as superseded by current main; the conflict-first prompt behavior is already implemented there.

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

Labels

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.

1 participant