Docs · Pull requests
Conflicts and rebase
When a PR sits open and main moves forward, merge conflicts arrive. Zero detects them, proposes an agent-assisted resolution, and lets you preview the diff before pushing.
Detect conflicts
After a rebase attempt, Zero scans the worktree for unmerged files. Each conflicting file is returned with a conflict count and a diff snippet so you can assess scope before invoking the agent.
POST /api/cases/:id/pr/rebase
The rebase route performs git rebase origin/main inside the case worktree. If conflicts are found, the response includes the conflict file list — the session does not proceed until conflicts are resolved or aborted.
Preview
Before running the agent, inspect the raw conflict state. The preview endpoint returns the full diff for each conflicting file including both sides of the conflict markers.
GET /api/cases/:id/conflicts/preview
Resolve with agent
The agent reads both sides of each conflict, the original problem definition, and the session history to propose a resolution. Resolution is written back into the worktree — no changes are staged or pushed yet.
POST /api/cases/:id/conflicts/resolve-with-agent
After the agent runs, re-fetch the preview to verify the proposed resolution before applying. The agent does not guarantee correctness — review is required.
Apply resolution
Applying stages the resolved files and completes the rebase. The worktree is now in a post-rebase state with conflicts resolved.
POST /api/cases/:id/conflicts/apply
This step is operator-triggered. Zero does not apply resolutions automatically.
Push rebased
After applying, push the rebased branch to the remote. This replaces the PR branch with the rebased commit history.
POST /api/cases/:id/conflicts/push-rebased
The push is a force-with-lease — it only succeeds if no one else has pushed to the branch since the rebase started.
Abort
If the resolution looks wrong or you want to start over, abort the rebase. This resets the worktree to the pre-rebase state.
POST /api/cases/:id/conflicts/abort
Conflict history
Every rebase attempt is recorded per Work item. The history includes timestamp, file count, resolution method, and outcome — useful for auditing recurring conflict patterns.
GET /api/cases/:id/conflicts/history GET /api/cases/:id/conflicts/metrics
Metrics aggregate conflict frequency and resolution time across all rebase attempts for the Work item. See also: Regression memory, PR review loop.