Skip to content
safran

Type to search. Enter opens the first result.

    How pull requests are read

    Safran reads pull requests in two different ways, and the difference matters. This page explains both, shows how a pull request is found from a ticket key, a link or a branch, and then lists per host what the answer means: how votes and thread states are translated, where the diff comes from, which filters a host cannot apply, and which parts have never been run against a live service.

    Two views of a pull request

    Work historyLive pull requests
    WhatMerged pull requests, their ticket keys and the files they changedA pull request as it is now: open, merged or closed, with reviewers, votes, threads and diff
    Where it comes fromThe local store, filled by safran links refreshThe code host, at the moment you ask
    NeedsCapability pull-requestsCapability pull-requests-live; pr-threads and pr-diff for those parts
    Answers"What was done for this ticket before", "who changed this file""Is there a pull request for this ticket", "what did the reviewers say", "show me the change"
    Works offlineYesNo

    Azure Repos, GitHub and GitLab have all of these capabilities. A local code host has none: it has no pull requests, so history, discovery and the pull request skills get nothing from it.

    "Pull request" is the neutral word. A GitLab merge request is one.

    Find one

    $ safran pulls find PAY-1423 --profile safran.yaml
    pull request        state  title                                 author       tickets   updated
    → payments-api#482  open   PAY-1423 fix partial refund rounding  Ayşe Yılmaz  PAY-1423  27 h ago
    
    1 match for PAY-1423. → safran pulls show payments-api#482 --threads --profile safran.yaml

    (Captured against the fixture connectors of the test suite, not a live host.)

    There are three ways in, and the same three exist as the find_pull_request tool and as safran.pulls.find:

    • A link. The host that recognises the URL answers. Nothing is searched.
    • A ticket. A pull request belongs to a ticket when it carries the ticket's key: in a link the host itself records, in the title, in the source branch or in the description. Live pull requests are searched on every host; for merged work the local store is consulted as well. A key counts only for the project keys the profile lists under a tracker.
    • A branch. The exact source branch name. This is how "the pull request of the branch I am on" is found.

    The match marked → is the one to read without asking: the only match, or the only open one. Several matches without such a mark are a question for a person. Finding nothing is an answer, not an error.

    A pull request is referred to by its URL, by <repo>#<id>, or by <host id>:<repo>#<id> when two hosts have a repository of that name (azure:payments-api#482).

    What is read

    PartContainsLimits
    HeaderState (open, merged, closed), draft, author, branches, dates, labels, ticket keys, reviewers with votes, mergeability, countsReviewers are absent, not empty, when a listing does not carry them
    Changed filesPath, previous path of a rename, change type, added and removed lines where the host reports themget_pull_request lists at most 60 files, the dashboard 500; then truncated
    Review threadsFile, line range and side, status, the host's own resolution word, comments oldest first50 per page by default
    DiffUnified hunks per file, without a file header20 files per page by default; each file's patch is cut on a line boundary at 60,000 characters (24,000 in an MCP result) and marked truncated

    A state of closed always means closed without being merged. open includes drafts.

    Votes use one vocabulary on every host: approved, approved_with_suggestions, waiting (waiting for the author), rejected (blocks the merge) and none (asked, no decision yet, or only commented). Only a reviewer's latest decision counts.

    Thread status is one of active, resolved and outdated. Not every host has all three; see the table below.

    Pull request titles, descriptions, review comments and diff text are third-party text. Over MCP they arrive inside the untrusted-data wrapper like ticket text does.

    Per host

    Capabilities and translation

    Azure ReposGitHubGitLab
    Votes10 approved, 5 approved with suggestions, -5 waiting, -10 rejected, 0 none; required from the reviewer policyLatest APPROVED → approved, CHANGES_REQUESTED → rejected; a dismissed review → none. No "with suggestions" or "waiting" level, no requiredapproved → approved, requested_changes → rejected, anything else → none; an approval counts whoever gave it
    Reviewers in a listingYesOnly the people still asked; decisions are read when the reviewer filter is setNo decisions; fetch the pull request
    Mergeabilitysucceeded → clean, conflicts, rejectedByPolicy → blocked, otherwise unknownFrom mergeable_state: clean, conflicts, blocked (also behind and draft), unknown while GitHub computesFrom detailed_merge_status, on a single open merge request only
    Thread activeStatus active or pending, or no statusUnresolved review thread; every general comment and review summaryNot resolved
    Thread resolvedfixed, wontFix, closed, byDesign, kept as resolutionResolved review thread (needs a token, see below)The first resolvable note is resolved
    Thread outdatedNever: a thread follows its line across pushesA line comment that no longer has a place in the current diffNever: the API has no such flag
    System commentsMarked systemNone: the endpoints carry only what people and bots wroteMarked system ("added 2 commits", "approved this merge request")
    DiffComputed by Safran, see belowGitHub's own patch, three context lines, cannot be variedGitLab's own diff; context cannot be varied
    updated_since filterUNSUPPORTED: no last-activity date is recordedApplied on the rowsSent to the API
    Listing across repositoriesOne listing per projectOne request per repository and page, at most 25 repositories side by sideOne group-wide listing

    Things that follow from this table and are easy to miss:

    • GitHub without a token reads every review thread as active. Whether a thread is resolved is only in GitHub's GraphQL API, which takes no anonymous calls. Without a token the threads are rebuilt from the REST review comments, where resolved and unresolved look the same. The log says so once.
    • On GitHub a thread has no id of its own. It is named by its first comment, with the word the web UI uses in its links: discussion_r<id> for a review thread, issuecomment-<id> for a general comment, pullrequestreview-<id> for the summary of a submitted review.
    • On GitHub a pull request from a fork is not found by its branch, because the listing is asked for branches of the repository's own owner.
    • A filter a host cannot apply is never dropped silently. The host either filters the rows itself or is named in warnings with UNSUPPORTED; the other hosts still answer.
    • author and reviewer match exactly: an id, or a display name or e-mail address ignoring case. an does not select Jan.

    Azure's computed diff

    Azure Repos has no endpoint that answers a patch. Safran computes one: the changes of the pull request's latest iteration name, for every file, the content before and after by its blob id; both versions are downloaded and compared line by line.

    What that means for you:

    • Cost. Up to two downloads per file of the page, a few files at a time. A page is 20 files by default.
    • Large files are not diffed. A file version over 512 KiB comes back with an empty patch and truncated: true. So does a change entry that carries no blob ids: it is reported as withheld, never as unchanged.
    • The hunks are correct but not always git's. The diff is the shortest edit script. Git slides and splits hunks by its own heuristics, so the same change can be cut into different hunks than the web UI shows. Line numbers and content agree.
    • Binary files are detected the way git does it (a NUL byte among the first 8,000 bytes) and have an empty patch with binary: true.
    • Line endings count. A file that changed from CRLF to LF differs on every line, as it does for git.

    What has been verified live

    HostExercised against the live serviceNot exercised
    GitHubRecognising a pull request link, reading one pull request, and paging its reviews: one run, without a token, against public repositoriesChanged files, review comments, the GraphQL thread query, every write
    Azure ReposNothingEvery pull request endpoint
    GitLabNothingEvery merge request endpoint

    Everything in the right-hand column was written from the vendor's API documentation and is tested against fixtures shaped like the documented responses. The details the documentation left open are marked UNVERIFIED in the source. The ones that affect what you read:

    HostUnverified detail
    GitHubThe review states and mergeable_state values (the documentation types them as strings without listing them); that a line comment with neither line nor position is outdated; that a file without counted lines and without a patch is binary; the GraphQL thread query as a whole
    Azure ReposThe order of the pull request listing (rows older than created_since are skipped, not taken as the end); the shape of a change entry's blob ids; the link that opens one thread in the web UI
    GitLabThe reviewer states approved and requested_changes; how a binary file appears in a diff (a binary file sent with an empty diff comes back as an empty patch that is neither binary nor truncated)

    If one of these is wrong on your server, the symptom is a vote, a thread state or a patch that disagrees with the web UI. The error code and the --verbose output are what a bug report needs. The whole picture is in Status.

    Where to use it

    FromUseReference
    A terminalsafran pulls find, safran pulls list, safran pulls show with --changes, --threads, --diffCLI
    An agentfind_pull_request, list_pull_requests, get_pull_request, get_pull_request_threads, get_pull_request_diffMCP
    Your codesafran.pullsSDK
    Claude Code/safran:review-pr, /safran:pr-fix, /safran:verify-acceptance, /safran:standupSkills
    A browserThe Pull requests screen of safran dashboard

    Commenting on a pull request and replying in a thread are writes: off by default, previewed and confirmed one at a time. Approving, voting and resolving a thread are not offered at all; people do those on the host.

    Common mistakes

    • Expecting the index to contain the pull request's code. The index is the default branch at its last sync. For what a pull request adds, read the diff.
    • Reading closed as merged. A merged pull request is merged.
    • Reading absent reviewers as "nobody was asked". In a listing they may simply not be carried; fetch the pull request.
    • Filtering by updated_since across hosts that include Azure Repos. Azure is then named in warnings; use created_since.
    • Looking for merged work with live listings only. safran pulls find consults the store for merged work; safran links show and find_past_work read the store directly and also give the changed files.