Skip to content
CodeBook

Pull requests

Draft pull requests linked to the card that produced them, what agents are told about conflicts, who merges, and how a merge moves the card.

When an engineering station opens a pull request, it is a draft, and it is linked to the card that caused it. That link is what keeps the workflow honest about what is actually in flight.

On the card

A card with a pull request shows it: the branch, the request itself, and its state — open, merged, closed — along with review and check status where the provider reports them.

This is the difference between a workflow that says In QA and one where In QA is backed by a specific diff somebody can open.

Find the merged pull request on the story. Its revert action previews the inverse change and opens a new pull request for review. Story changes and reverts

To comment on lines, submit a review, follow a stack of pull requests or walk a guided review tour, choose Review changes in the card's Development section. See Reviewing pull requests in CodeBook.

Review a GitHub draft

  1. Open the PR from its card. The CodeBook review section identifies the opening head SHA, the CI checks known at publication and the decision needed from the reviewer. An empty or incomplete list tells you which evidence was missing at that point.
  2. Compare the current head with the opening SHA. Open Checks on GitHub for the current run after later pushes. If the repository uses approved incident rules, paste the head into Factory settings → Proof runs → Incident checks → Check a pull request commit to see the business behavior CI observed.
  3. Submit your review. To report active review time, finish the review body with a line such as Review minutes: 8. Use whole minutes for this review. A normal issue comment, a bot review or time elapsed since the PR opened does not contribute. A later submitted review may report its own additional minutes.

Open Factory → Dashboard → Productivity and read Reviewer effort per merged PR alongside the coverage count. The opening snapshot and reported review minutes are GitHub features. Dashboard metrics · CI incident checks

Webhooks

Repository webhooks keep that state current. A review left on the pull request, a check that fails, a merge — these arrive and update the card rather than waiting for somebody to notice.

An agent's pull request carries at most 30 files.

Where QA fits

QA verifies the story, and the card carries the pull request, so the QA agent's report is about a specific change rather than about the feature in general. When QA fails the card, the failure returns to Development with the pull request still attached — the engineer's next run is a revision, not a restart.

Conflicts and falling behind

When the base branch moves, a pull request that was fine can stop merging. Nobody has to tell the agents. Before every run on a card, and before every reply in its thread, CodeBook asks the repository host whether each open pull request linked to the card still merges, and the answer is one of the facts the agent is given: Pull request #73 conflicts with main. The engineer is told to bring it up to date before anything else; a reviewer is told not to pass it.

This works the same on GitHub, GitLab and Gitea / Forgejo. On GitHub the engineer merges the base branch into the pull request's branch and resolves each conflict in place; on the other hosts it opens a fresh pull request from the current base.

Cleaning up stale pull requests

An agent with write access can close a pull request without merging and remove its branch — for a stale or duplicate draft whose change is already on the default branch. It gives a reason, which is written on the pull request with the agent's name and the card it was working.

CodeBook decides what may be closed, not the agent:

  • only a pull request the factory itself opened (its branch starts with codebook/). One a person opened is refused; a person closes that at the host.
  • never one that a run on another card is still working on.

Review the branch and open changes before authorizing cleanup. Recovery options depend on the repository host. Agents can also list every pull request of the repository — which are open, which conflict, which card each belongs to — from a card run as well as from a conversation.

A card opens one pull request. Running the card again updates that pull request; a second one is refused while the first is open.

Merging

Agents never merge. One choice per factory, under Factory settings → Policies & budgets, decides what happens once a card has passed every station and rests in Done:

  • CodeBook merges — the default. The merger evaluates the finished card’s current PR head, applicable approval, repository checks and configured policies before merging.
  • A person merges. Nothing is merged for you; the pull request waits at your repository host.

The rules behind CodeBook merges are fixed:

  • Your repository's own checks are respected. Where the repository runs CI, the checks must have passed. Where it runs none, the absence of CI does not block a merge. If the host’s check API fails, CodeBook waits for a successful read; an unavailable response is never treated as no checks. Your stations' review remains a gate, and any configured required runner commands must pass as described below. Test evidence comes from your testing service or command runner.
  • Approved incident rules require a complete passing CI report for the current head. A change to the approved probe, conflicting observations or a newly pushed commit holds the merge. A paused order or one past its deadline also holds automated publication.
  • A conflict or a failing check goes back to the developer. The card returns to the station that built it, with the reason, gets fixed, and comes round again. After three returns a person is asked instead.
  • One merge at a time per repository. Each pull request is checked against the main branch again right before it is merged, so the second of two finished changes is judged against a main branch that already holds the first.
  • Only work this factory's agents opened, into the repository's default branch. Anything else is left for a person.
  • From now on. It applies to cards that finish after the factory chose it, never to what was already sitting in Done.

Under Commands that must pass before CodeBook merges, enter the command names configured on your command runner. A failure sends the card back with the command output. If the runner cannot execute a required command, the card records the reason and waits.

When the workflow includes a person’s review station, that person approves the card there. Where QA is configured, QA must pass the head being merged. CodeBook checks the current head again at the host. GitHub, GitLab and Gitea support this merge flow.

Risk-based merging

The earlier CodeBook merge-risk score used the System Map. Approval rules, protected paths and risk policy now belong to MadeBook. Factory settings → Policies & budgets → Who merges finished work controls whether CodeBook or a person performs the merge.

In a linked workspace with MadeBook approves merges enabled, CodeBook waits for MadeBook’s verdict on the exact pull request head before merging. Review the applicable policy through the MadeBook card in factory settings. Connected products

A merge moves the card

When the pull request is merged, the card can move on. The rule is conservative on purpose — a merge advances the card its pull request belongs to, and nothing else — so the workflow reflects what actually landed without anybody dragging a card to say so.

Where it moves to is set in the repository panel. Attaching a repository fills the target in with the workflow's ending station (its last station if none is marked) and never overwrites a target somebody chose. The card only moves forward, and not if someone already moved it there. Clear Merging a pull request moves its card to keep cards where they are.