Skip to content
Agentmart
Submit a tool

pr-conflict-fix

Resolve a conflicting GitHub PR inside a throwaway container built from an image you name.

Skill by yichiche

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/yichiche-pr-conflict-fix

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Resolve a conflicting GitHub PR inside a throwaway container built from an image you name. Launches the container, reproduces the merge, auto-resolves mechanical conflicts (asks on semantic ones), verifies the PR's own changes survived, runs pre-commit on the changed files, then pushes the merge back to the PR branch. Use when a PR shows "This branch has conflicts", or the user says '/pr-conflict-fix', 'fix the conflict on PR X', 'rebase/merge main into PR X'.

Use cases: devops

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Shell scripts

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/pr-conflict-fix

What's inside

Skill name
pr-conflict-fix
Description
Resolve a conflicting GitHub PR inside a throwaway container built from an image you name. Launches the container, reproduces the merge, auto-resolves mechanical conflicts (asks on semantic ones), verifies the PR's own changes survived, runs pre-commit on the changed files, then pushes the merge back to the PR branch. Use when a PR shows "This branch has conflicts", or the user says '/pr-conflict-fix', 'fix the conflict on PR X', 'rebase/merge main into PR X'.
License
MIT
Instructions
231 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Agent Skills spec issues

  • body: contains an absolute path from the author's machine

Files (2)

  • SKILL.md
  • boot.sh

SKILL.md (first lines)

# Fix a PR's merge conflict in a container

Resolve conflicts in the environment the PR is *meant* to run in, not in whatever
checkout happens to be on the host. The image is the point: it pins the Python
env, so `import sglang` and `pre-commit` actually mean something.

Read `_shared/repo-config.md` for the repo table, author identity, and the
`GH_TOKEN=""` rule.

## Invocation

```
/pr-conflict-fix <PR number or URL> --image <docker image> [--fast] [--no-gpu]
```

- **PR** — e.g. `31794` or the full `https://github.com/sgl-project/sglang/pull/31794`.
- **`--image`** — required, no default. e.g. `lmsysorg/sglang-rocm:v0.5.16-rocm700-mi35x-20260803`.
  If the user did not name one, **ask** — do not guess a tag.
- **`--fast`** — bootstrap only `gh` + the identity guard (~30s) instead of the full
  `container-dep.sh` (~minutes). Enough for pure conflict work.
- **`--no-gpu`** — skip `/dev/kfd` + `/dev/dri`. Conflict resolution never needs a GPU;
  the flags are kept by default only for parity with `~/run_docker.sh`.

Runs on the **host** (needs `docker`). If you are already inside a container and
`docker` is missing, say so and stop — do not silently fall back to resolving on the host.

## Step 1 — Preflight (host)

```bash
GH_TOKEN="" gh pr view <PR> --repo sgl-project/sglang \
  --json number,title,state,mergeable,mergeStateStatus,headRefName,baseRefName,headRepositoryOwner,url
```

Read off: **head repo owner** (the fork to push back to), **head branch**, **base branch**.

- `mergeable: MERGEABLE` already → report that and **stop**. Nothing to fix.
- `mergeable: UNKNOWN` → GitHub is still computing. Wait ~15s and re-query.
- `state != OPEN` → stop and say so.

## Step 2 — Launch the container

```bash
bash ~/agent-box/skills/ci/pr-conflict-fix/boot.sh up <image> --pr <PR> [--fast] [--no-gpu]
```

Prints the container name — hold onto it, call it `$C`. The container is `--rm` and
detached (`sleep infinity`), so it lives exactly as long as this skill run.

It mirrors `~/run_docker.sh`: `--privileged`, `--network=host`, `--ipc=host`,
`--shm-size 16G`, host home at `/home/yichiche`, plus `.claude` / `.codex`. That home
mount is what carries `gh` auth (`/home/yichiche/.gh`), the git identity, and the
global pre-push hook into the container.

Run everything after this through:

```bash
bash ~/agent-box/skills/ci/pr-conflict-fix/boot.sh sh "$C" '<command>'
```

which presets `GH_TOKEN=""`, `GH_CONFIG_DIR`, and `PATH`.

Sanity-check the bootstrap before continuing — `gh auth status` must show
`Logged in ... account yichiche`, and `git config --global user.email` must be
`yichiche@amd.com`. If either is wrong, fix it before touching the repo; a merge
commit with the wrong author is a rewrite later.

## Step 3 — Set up the repo inside the container

Work in the image's own checkout, `/sgl-workspace/sglang` (confirm with
`git -C /sgl-workspace/sglang rev-parse --show-toplevel`). It is pristine per image,
so the host clone is never touched.

```bash
cd /sgl-workspace/sglang
git fetch https://github.com/<headOwner>/sglang.git <headRefName>:prwork
git fetch origin <baseRefName>
git worktree add /tmp/prwork prwork
```

Use a **worktree**, not a checkout — the image's main tree may have local state you
do not want to disturb.

## Step 4 — Reproduce the conflict

```bash
cd /tmp/prwork && git merge origin/<baseRefName> --no-edit
git diff --name-only --diff-filter=U     # the conflicted set
```

Merge, don't rebase. The PR branch already carries merge commits from GitHub's
"Update branch" button; rebasing rewrites history that reviewers have seen and
re-authors other people's commits.

If the merge succeeds cleanly, GitHub was stale — jump to Step 8.

## Step 5 — Classify and resolve

For each conflicted file, read every hunk and sort it into one of two buckets.

**Mechanical — resolve yourself, no need to ask.** Both sides are additive and the
union is unambiguous:
- Import-line conflicts where one side's imports are a superset of the other's
  (take the superset; verify every symbol both sides used is still imported).
- Both sides appending distinct entries to a list, dict, enum, or `__all__`.
- One side edits a hunk the other only moved.
- Pure formatting/whitespace divergence.

**Semantic — stop and ask.** Both sides changed the *same* logic: overlapping edits
to one function body, a guard the PR adds where main restructured the surrounding
code, a signature changed on one side and called on the other, or upstream deleting
something the PR modifies. Present the two sides with `AskUserQuestion`, showing each
side's hunk in `preview`, and let the user pick.

**Never resolve by taking a whole side wholesale** (`--ours` / `--theirs`) unless you
have read every hunk in the file and confirmed one side genuinely subsumes the other.

Resolve by editing the file with Edit — delete the `<<<<<<<` / `=======` / `>>>>>>>`
lines as part of the edit, not in a separate pass. Then `git add` the file.

From yichiche/agent-box, MIT.

More from yichiche/agent-box

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Oct 5, 2026 (24 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from yichiche

Cite this page

pr-conflict-fix skill. Agent Mart. https://agentmart.dev/skills/yichiche-pr-conflict-fix (last updated 2026-10-24)