LLM-resolved rebase conflicts must not land on main directly — route to a rescue PR and re-test #207

Closed
opened 2026-10-15 02:59:22 +00:00 by ben · 3 comments
Owner

Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against main at 3e50274.

Symptom (verified)

landing_push_main_with_rescue (landing-lib.sh:472-480): on rebase conflict, landing_resolve_rebase_with_claude (:442-447) runs timeout 900 claude -p --dangerously-skip-permissions on the HOST checkout with host push credentials, then git push origin HEAD:main immediately. The host pre-push hook runs --prepush-host (eslint + gofmt only). No test suite, no human, no diff review. The in-sandbox worker gets the same instruction (prompt.md:174-180) AFTER its step-4 test run, so post-conflict code is never re-tested there either. The rescue call also has no limit/auth classification (landing-lib.sh:441), so a refusal becomes a rescue-branch page instead of a park. Neither landing_push_main_with_rescue nor the resolver has any offline test. Parallel-agent merge collisions (MindStudio: 7 of 9 PRs) are the normal case, not the edge.

Proposed change

  • After ANY conflict resolution (host or sandbox): run the pinned test command; on red, park the rescue branch and page — never push.
  • Route a claude-resolved result to a PR (sandcastle/rescue-<ts> → PR with the conflict hunks quoted in the body) rather than main; in push-mode repos the host may auto-merge it only after CI is green AND the diff vs the pre-conflict worker branch is limited to the conflicted files.
  • Replace --dangerously-skip-permissions with an explicit tool allowlist (--allowedTools for the file-edit and git-status tools only).
  • Wrap the resolver in the execute-lib classify/failover pattern.

Acceptance

  • tests/landing-lib-test.sh gains scenarios for the ladder: clean push; conflict → PR; conflict + red tests → park; limit refusal → park (shimmed claude/git).
_Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against `main` at 3e50274._ ## Symptom (verified) `landing_push_main_with_rescue` (`landing-lib.sh:472-480`): on rebase conflict, `landing_resolve_rebase_with_claude` (:442-447) runs `timeout 900 claude -p --dangerously-skip-permissions` on the HOST checkout with host push credentials, then `git push origin HEAD:main` immediately. The host pre-push hook runs `--prepush-host` (eslint + gofmt only). No test suite, no human, no diff review. The in-sandbox worker gets the same instruction (`prompt.md:174-180`) AFTER its step-4 test run, so post-conflict code is never re-tested there either. The rescue call also has no limit/auth classification (`landing-lib.sh:441`), so a refusal becomes a rescue-branch page instead of a park. Neither `landing_push_main_with_rescue` nor the resolver has any offline test. Parallel-agent merge collisions (MindStudio: 7 of 9 PRs) are the normal case, not the edge. ## Proposed change - After ANY conflict resolution (host or sandbox): run the pinned test command; on red, park the rescue branch and page — never push. - Route a claude-resolved result to a PR (`sandcastle/rescue-<ts>` → PR with the conflict hunks quoted in the body) rather than main; in push-mode repos the host may auto-merge it only after CI is green AND the diff vs the pre-conflict worker branch is limited to the conflicted files. - Replace `--dangerously-skip-permissions` with an explicit tool allowlist (`--allowedTools` for the file-edit and git-status tools only). - Wrap the resolver in the execute-lib classify/failover pattern. ## Acceptance - `tests/landing-lib-test.sh` gains scenarios for the ladder: clean push; conflict → PR; conflict + red tests → park; limit refusal → park (shimmed claude/git).

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

  • Ruling: ready-for-agent.
  • Why this is a two-way door: forbidding a direct-to-main push path, adding a post-resolution test gate, and narrowing --dangerously-skip-permissions to an explicit allowlist are all tightenings; revertible by a commit. The host already holds push credentials — nothing is provisioned.
  • What proves it: tests/landing-lib-test.sh with shimmed claude/git — scenarios for clean push, conflict→PR, conflict+red-tests→park, and limit-refusal→park.

Agent Brief

Category: bug

Summary: On a rebase conflict the host hands the checkout to a headless claude -p --dangerously-skip-permissions, then pushes the result straight to main with no test re-run, no diff review, and no limit/auth classification. Route conflict-resolved results through a re-test gate and a rescue PR instead of direct main.

Current behavior: landing_resolve_rebase_with_claude resolves in place and landing_push_main_with_rescue pushes HEAD:main the instant it returns. The only mechanical check is the host pre-push hook (lint/gofmt). A resolver refusal becomes a rescue-branch page rather than a park. No offline test covers the path.

Desired behavior: After ANY conflict resolution (host or sandbox), run the repo's pinned test command; on red, park the rescue branch and page — never push. Route a claude-resolved result to a PR (sandcastle/rescue-<ts>) with the conflict hunks quoted in the body; in push-mode repos the host may auto-merge only after CI is green AND the diff versus the pre-conflict worker branch is confined to the conflicted files. Replace --dangerously-skip-permissions with an explicit tool allowlist (file-edit + git-status only). Wrap the resolver in the classify/failover pattern so a limit refusal parks rather than pages.

Key interfaces: A resolve→verify→land ladder with four terminal outcomes — clean push; conflict→PR; conflict+red-tests→park+page; limit/auth refusal→park. The resolver invocation carries a bounded tool allowlist and rides the classify/failover/park contract used by the other Claude callers. Auto-merge of a rescue PR is gated on green CI plus a conflicted-files-only diff bound.

Acceptance criteria:

  • tests/landing-lib-test.sh gains scenarios: clean push; conflict → PR; conflict + red tests → park (no push); limit refusal → park (shimmed claude/git).
  • No code path pushes a conflict-resolved HEAD to main without a passing pinned-test run.
  • The resolver no longer passes --dangerously-skip-permissions; it carries an explicit allowlist.
  • Offline suite green.

Out of scope: Redesigning the clean (no-conflict) push ladder; the pr-mode landing authority model beyond the auto-merge gate described here.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** - **Ruling:** `ready-for-agent`. - **Why this is a two-way door:** forbidding a direct-to-main push path, adding a post-resolution test gate, and narrowing `--dangerously-skip-permissions` to an explicit allowlist are all *tightenings*; revertible by a commit. The host already holds push credentials — nothing is provisioned. - **What proves it:** `tests/landing-lib-test.sh` with shimmed `claude`/`git` — scenarios for clean push, conflict→PR, conflict+red-tests→park, and limit-refusal→park. ## Agent Brief **Category:** bug **Summary:** On a rebase conflict the host hands the checkout to a headless `claude -p --dangerously-skip-permissions`, then pushes the result straight to main with no test re-run, no diff review, and no limit/auth classification. Route conflict-resolved results through a re-test gate and a rescue PR instead of direct main. **Current behavior:** `landing_resolve_rebase_with_claude` resolves in place and `landing_push_main_with_rescue` pushes `HEAD:main` the instant it returns. The only mechanical check is the host pre-push hook (lint/gofmt). A resolver refusal becomes a rescue-branch page rather than a park. No offline test covers the path. **Desired behavior:** After ANY conflict resolution (host or sandbox), run the repo's pinned test command; on red, park the rescue branch and page — never push. Route a claude-resolved result to a PR (`sandcastle/rescue-<ts>`) with the conflict hunks quoted in the body; in push-mode repos the host may auto-merge only after CI is green AND the diff versus the pre-conflict worker branch is confined to the conflicted files. Replace `--dangerously-skip-permissions` with an explicit tool allowlist (file-edit + git-status only). Wrap the resolver in the classify/failover pattern so a limit refusal parks rather than pages. **Key interfaces:** A resolve→verify→land ladder with four terminal outcomes — clean push; conflict→PR; conflict+red-tests→park+page; limit/auth refusal→park. The resolver invocation carries a bounded tool allowlist and rides the classify/failover/park contract used by the other Claude callers. Auto-merge of a rescue PR is gated on green CI plus a conflicted-files-only diff bound. **Acceptance criteria:** - [ ] `tests/landing-lib-test.sh` gains scenarios: clean push; conflict → PR; conflict + red tests → park (no push); limit refusal → park (shimmed claude/git). - [ ] No code path pushes a conflict-resolved HEAD to main without a passing pinned-test run. - [ ] The resolver no longer passes `--dangerously-skip-permissions`; it carries an explicit allowlist. - [ ] Offline suite green. **Out of scope:** Redesigning the clean (no-conflict) push ladder; the pr-mode landing authority model beyond the auto-merge gate described here.

swarm-claim host=matou-dev-server-01 run=21817
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=21817 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #207 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 207,
  "status": "success",
  "commits": [
    "8bdcca51af45a1271aa63e898a437a120d35b0a5"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "landing-lib.sh",
    "tests/landing-lib-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/landing-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done (full offline suite)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "tests/landing-lib-test.sh gains scenarios: clean push; conflict → PR; conflict + red tests → park (no push); limit refusal → park (shimmed claude/git)": "tests/landing-lib-test.sh #207 block: clean-push, conflict→PR, conflict+red→park, limit-refusal→park (plus fail-closed + resolver-failed) with git/claude/notify shims; 99/0",
    "No code path pushes a conflict-resolved HEAD to main without a passing pinned-test run": "landing-lib.sh landing_push_main_with_rescue routes the rebase-CONFLICT branch to landing_land_resolved_conflict, which parks on sandcastle/rescue-<ts> and gates on landing_run_pinned_tests (LANDING_TEST_CMD; UNSET fails CLOSED) before opening a PR — it never git-pushes HEAD:main; a CLEAN rebase (no LLM) is the only push-to-main path. Tests assert exactly one HEAD:main push (the initial failed attempt) in every conflict scenario",
    "The resolver no longer passes --dangerously-skip-permissions; it carries an explicit allowlist": "landing_resolve_rebase_with_claude uses --permission-mode acceptEdits --allowedTools \"$LANDING_RESOLVE_ALLOWED_TOOLS\" (no git push); tests assert --allowedTools present and dangerously-skip-permissions absent from the captured argv",
    "Offline suite green": "full offline suite loop exits clean post-rebase; landing-lib 99/0"
  },
  "summary": "A rebase-CONFLICT resolution is now re-tested on the pinned suite and routed to a rescue PR (or parked), never pushed to main, under a bounded resolver allowlist classified like every other claude caller.",
  "blockers": []
}
**close-report** for #207 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 207, "status": "success", "commits": [ "8bdcca51af45a1271aa63e898a437a120d35b0a5" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "landing-lib.sh", "tests/landing-lib-test.sh" ], "tests": [ { "command": "bash tests/landing-lib-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done (full offline suite)", "exit_code": 0 } ], "criteria": { "tests/landing-lib-test.sh gains scenarios: clean push; conflict → PR; conflict + red tests → park (no push); limit refusal → park (shimmed claude/git)": "tests/landing-lib-test.sh #207 block: clean-push, conflict→PR, conflict+red→park, limit-refusal→park (plus fail-closed + resolver-failed) with git/claude/notify shims; 99/0", "No code path pushes a conflict-resolved HEAD to main without a passing pinned-test run": "landing-lib.sh landing_push_main_with_rescue routes the rebase-CONFLICT branch to landing_land_resolved_conflict, which parks on sandcastle/rescue-<ts> and gates on landing_run_pinned_tests (LANDING_TEST_CMD; UNSET fails CLOSED) before opening a PR — it never git-pushes HEAD:main; a CLEAN rebase (no LLM) is the only push-to-main path. Tests assert exactly one HEAD:main push (the initial failed attempt) in every conflict scenario", "The resolver no longer passes --dangerously-skip-permissions; it carries an explicit allowlist": "landing_resolve_rebase_with_claude uses --permission-mode acceptEdits --allowedTools \"$LANDING_RESOLVE_ALLOWED_TOOLS\" (no git push); tests assert --allowedTools present and dangerously-skip-permissions absent from the captured argv", "Offline suite green": "full offline suite loop exits clean post-rebase; landing-lib 99/0" }, "summary": "A rebase-CONFLICT resolution is now re-tested on the pinned suite and routed to a rescue PR (or parked), never pushed to main, under a bounded resolver allowlist classified like every other claude caller.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#207
No description provided.