Skip to content

Retry a refused merge and ask a person only the contested hunk - #989

Merged
coderhelm[bot] merged 2 commits into
mainfrom
fix/conflict-round-asks-only-the-contested-hunk
Dec 6, 2026
Merged

coderhelm[bot] merged 2 commits into
mainfrom
fix/conflict-round-asks-only-the-contested-hunk

Conversation

@nambok

@nambok nambok commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #987, which merged while this change was in review. When a conflict round's merge was refused, it ended with a comment asking a person to "resolve the conflict on this branch". The rule is that CoderHelm never hands a person work it can do itself.

A refused merge is now CoderHelm's own problem first: the round tries again against the base's newest head. A person is asked only when both sides changed the same lines with incompatible intent. That ask is one typed question that shows the two versions.

Changes

  • merge3::Refused now carries contested, the hunk's two versions. It is set only when the model replied on both tries and its reply was refused for the same hunk. Every other failure, such as a model that never answered, a mechanical merge that failed its checks, or a whole-file check failing, is CoderHelm's own problem and has no contested hunk. pr::refuse_merge passes it on.
  • resume::run_conflict_round:
    • Refused merge: after_refused parks the round for a fresh step against the base's newest head. The tries are bounded and tied to progress (Round::stepped on the base head, Round::may_continue). A base that stays put stops after two tries with no progress, and the step ceiling caps a base that keeps moving.
    • Out of tries: a contested hunk becomes a typed PersonOnly::ProductDecision (through person_only::admit) with one question: keep this branch's version (A), keep the base's (B), or combine them. The comment shows both versions. Anything else stops as CoderHelm's own problem (own_problems::record), and the round ends unfinished with the reason.
    • Any other failure of the merge is recorded the same way, as CoderHelm's own problem. The generic "Please resolve the conflict" comment is gone.
  • Incident case xy_merge_keeps_both_sides_and_parses (.rs and .md) now also pins the round's retry and its typed question.

Verification

  • cargo fmt --all --check, rustfmt --check --edition 2021 worker/src/passes/incidents/*.rs
  • cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings
  • cargo test -p common -p worker -p gateway: all pass. The new tests cover:
    • a_refused_merge_is_retried_against_a_fresh_base_while_that_makes_progress: the first refusal retries; a base that doesn't move stops after three tries as CoderHelm's own problem; a base that keeps moving stops at the step ceiling; a contested hunk is retried first too.
    • a_contested_hunk_out_of_tries_is_one_question_with_both_versions: a typed product decision with the keep A, keep B or combine question; both versions are in the comment; no generic ask and no hand-off phrase.
    • merge3: contested is set only when the model's replies were refused on the same hunk.
  • brand_spelling.py, domain_examples.py

A conflict round whose merge was refused no longer asks a person to
resolve the conflict. It runs again in a fresh step against the base's
newest head while the base moves between tries and under the round's
step ceiling. Out of tries, a person is asked only when both sides
changed the same lines with incompatible intent and the model's merge
was refused on both tries: a typed product decision showing the two
versions (keep A, keep B, or combine). Anything else stops as
CoderHelm's own problem.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 5, 2026
coderhelm[bot]

This comment was marked as outdated.

@coderhelm

coderhelm Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

💚 Post-merge health check passed: the deploy of 48c383a completed and stayed green for the full 15-minute watch window (no new failures vs. the pre-merge baseline).
Auto-merge

  • ✅ CoderHelm approved
  • ✅ CI green
    The rest is in the pull request description.

The tests asserted on the typed question and the PR comment with the
values in their failure messages, and AfterRefused derived Debug over a
PersonOnly. The messages no longer carry those values, and AfterRefused
prints only its variant and the reason code.

@coderhelm coderhelm 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.

✅ Approved with notes b32cb80 (merged)

.await
.unwrap_or_else(|e| {
warn!(run_id = msg.run_id, error = %e, "Could not park the conflict round");
false

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.

💬 Suggestion: If parking the retry fails, nothing wakes the round (hardening)

round::record has already saved the pending round when set_run_awaiting_ci(...).unwrap_or_else(|e| { warn!(...); false }) runs. If that call errors, it yields false, so no delayed resume is sent, yet the round returns RoundEnd::Parked. The run stays with a pending round and nothing to pick it up, until the stall sweep or another event happens to. Other round paths propagate the error with ?. This function returns RoundEnd rather than Result, so propagating isn't available here. On error, the safer fallback is to send the delayed resume anyway, or to stop as an own problem.

This blocks: On the retry's main path a failed set_run_awaiting_ci still returns Parked, so the pending round is never woken—a stall the PR doesn't exercise

@coderhelm
coderhelm Bot merged commit 48c383a into main Dec 6, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants