Pull Requests
With GitHub integration and protected main branch enabled, the agent creates and manages pull requests.
Automatic PR creation
When protected_main is enabled on a project and the agent completes work on a ticket:
- The agent pushes the worktree branch to GitHub
- A pull request is created with the ticket title and description
codality/agentcheck run is added to the PR- The ticket moves to In Review
Subsequent agent runs
If you re-run the agent on a ticket that already has a PR, the agent:
- Continues working in the existing worktree
- Pushes new commits to the same branch
- Updates the PR head SHA
The existing PR stays open. No duplicate PRs are created.
PR status in the UI
The ticket detail shows PR status inline:
- CI checks — Pass (✓), Fail (✗), or Pending (●) with a count of checks
- Review state — Approved, Changes Requested, or pending review
This status updates in real time via webhooks.
Check runs
Codality creates these check runs on PRs:
| Check | When | Result |
|---|---|---|
codality/agent |
Agent starts/completes work | Success if agent completed, failure if agent errored |
codality/review |
Code review submitted in Codality | Reflects review outcome |
codality/merge-readiness |
After agent or review | Summary of PR readiness |
These check runs are separate from your CI checks (GitHub Actions, etc.). Codality monitors your CI checks for failures and responds to them. See CI Feedback Loop.
Merging
When a PR is merged on GitHub:
- Codality receives the
pull_requestwebhook - The ticket moves to Done
- The worktree is cleaned up
- The local repository syncs with the remote
Closing without merge
When a PR is closed on GitHub without merging:
- The ticket moves to Cancelled
Discarding from Codality
If you discard a ticket's worktree from the Codality UI and a PR exists:
- The open PR is automatically closed on GitHub
- The worktree is deleted locally
Rebasing
When someone pushes to the default branch (via merged PR or direct push):
- Codality receives the
pushwebhook - The local repository syncs with the remote
- All open worktrees are rebased onto the updated default branch
This keeps agent branches up to date automatically.