---
title: History, PRs and releases
description: Inspect merged PRs, review comments and regression candidates in ClickHouse Loom. History collection is opt-in, and candidate rankings do not prove causation.
seo:
  title: PR history and regression candidates
lastModified: '2026-12-06T12:26:42.000Z'
sidebar:
  label: PR history and regression candidates in ClickHouse Loom
---

ClickHouse Loom's PR-history operations need merged-PR history. The `code_pr_history`
worker is off by default (`LOOM_CODE_PR_HISTORY_ENABLED`).

Loom's PR plane answers "how did the code get here". It lives in the same code namespace
as the index, so a history answer joins a merged PR's files against today's symbols,
callers and tests in one read, with no GitHub call at question time. A team's issue and
incident records join in through a linked [tracker](/docs/features/tracker/overview).

## The PR plane

| Table                     | Holds                                                                                                              | Filled by                                                                                   |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
| `loom.code_pr_history`    | one row per merged PR of the namespace's branch: number, title, author, labels, files, linked issues, merge commit | the `code_pr_history` worker, back to `LOOM_CODE_PR_BACKFILL_MONTHS` (GitHub: with a token) |
| `loom.code_pr_reviews`    | inline review comments of merged PRs                                                                               | the same worker (`LOOM_CODE_PR_REVIEWS_ENABLED`, default on; needs a token)                 |
| `loom.code_gh_items`      | issues and PRs in any state, open PRs with the files their head touches                                            | the same worker (`LOOM_CODE_GH_ITEMS_ENABLED`, default on; skipped anonymously)             |
| `loom.code_backport_gaps` | the nightly set-wide backport report                                                                               | the `code_backport_gaps` worker                                                             |

The worker uses `LOOM_CODE_GITHUB_TOKEN` or the entry's `github_token`, else GitHub's
anonymous rate limit. A release-branch namespace holds the PRs merged into that branch,
so "what changed on 2.4" reads the 2.4 namespace. A Forgejo entry's first sync starts
at the oldest day of `LOOM_CODE_PR_BACKFILL_MONTHS` (12) and reads forward. A GitHub
entry's sync reads the newest PRs since its cursor, so after the syncs each pass walks a
GitHub entry with a token back through that window, a day at a time from where the last
walk stopped. The walk reads at most `LOOM_CODE_PR_BACKFILL_PRS_PER_HOUR` (800) PRs an
hour across all entries, each counted as it is read, which leaves most of a token's 5,000
requests an hour to the syncs, and sends a token's search requests (one per 100 PRs of a
day) at most one every 2.5 seconds, under GitHub's 30 a minute. It does not read a day's
PRs the ledger already holds, so the days the sync filled cost their searches only, and
when the hour's share, the pass budget or a GitHub error stops the walk inside a day, it
keeps the PRs it read and the next pass reads the rest. A rate limit stops the walk on
that token until the next pass, a day GitHub fails is read again an hour later, and a
namespace being erased is not walked. A GitHub entry without a token is not walked:
`loom code backfill-prs` runs the same walk on the anonymous limits, resuming at its
cursor on each run until the window is done
([code index operations](/docs/operations/code-index-operations#first-index)).

### History stays inside the indexed head

The worker fills `loom.code_pr_history` from the forge up to now, and the mirror follows
its branch, whatever commit the index is at. A namespace that indexes an older commit (a
release branch, a pinned deployment, a bisect checkout) holds changes its code does not
have, such as a later fix and the test it added.

A namespace therefore answers about a change only when its indexed head contains it. A
change outside the head answers as one Loom has no record of: the same empty answer, with
nothing that says the change exists. Two checks decide, one per source.

- **The ledger.** The ingest pass, and `loom code backfill` for the commit it indexed,
  find the newest ledger change among the head's first-parent commits and publish its
  merge time as the `history_until` state row; a change merged after that time is not
  read. The bound is the forge's recorded merge time, not the head's committer time: a
  forge records a merge a second or more after the merge commit is made, and tens of
  minutes after it under a merge queue. The head's committer time is used only when the
  ledger names none of the head's last 200 first-parent commits.
- **The mirror.** A commit a caller names, or one the mirror's history names for a PR,
  counts when it is the indexed head or an ancestor of it. The mirror answers with
  `git merge-base --is-ancestor`, remembered per commit and head.

The issue and PR mirror (`code_gh_items`) follows the forge as the ledger does. A PR it
records as merged after `history_until` is not read by its number: `code.history`
(`numbers`), `code.verify_citations` (a `#N` citation) and the number lookups of memory
grounding answer as for a number nobody recorded. An issue is not a change and an
unmerged PR is outside every head, so both are read whole. One read takes the whole
mirror: the `as_of` gate of memory grounding
(`LOOM_MEMORY_ASK_PR_TEMPORAL_GATE`) asks when a number was opened, which is the
forge's fact at any head, so a memory citing a PR opened after the anchor is dropped
whether or not the index holds its merge.

| Reads                                                                                                                                                                                                                                                                                                     | Bound                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| the history leg and history section of `code.search`, `code.history`, `code.symbol_history`, `code.impact`, `code.context_pack`, co-change, churn, the test map's co-change rows, review comments on a path                                                                                               | the indexed head                                                                                                                             |
| a merged PR by number or merge commit: `code.review_brief`, `code.history` (`numbers`), `code.conventions` (`pr_number`), `code.backport_gap`, `code.first_build`, `code.context_pack` and `code.context_packs` (`pr_number`), `code.verify_citations` (`pr_number`), `code.bisect_candidates` (`fix_pr`) | the indexed head                                                                                                                             |
| a commit: `code.verify_citations`, `code.test_gate`, `code.tests_for` and the `lead` block of `code.symbol` and `code.grep` (`at_commit`), `code.bisect_candidates` (`bad_sha`), `code.first_build` (`sha`)                                                                                               | the indexed head                                                                                                                             |
| a window: `code.blame_range`, the scan of `code.bisect_candidates`, `code.backport_gaps`                                                                                                                                                                                                                  | the indexed head, for the window's ends and for the changes inside it                                                                        |
| `code.index_status` with `commit`, `code.coverage.watch`                                                                                                                                                                                                                                                  | `ready` turns true when the index reaches the commit; until then the commit reads as one the mirror does not hold                            |
| `code.pr_check`                                                                                                                                                                                                                                                                                           | none: a later duplicate is a duplicate                                                                                                       |
| an unmerged change in the mirror: `open: true` on `code.review_brief`, the post-image of `pr_number` on `code.symbol`, `code.callers`, `code.callees` and `code.impact`, `head_sha` on `code.conventions`                                                                                                 | read against the indexed head while the change is unmerged or merged inside it; one merged after it reads as a head the mirror lacks (below) |
| a change the caller sends: `pr_files` and `pr_diff` on those reads, `files` and `diff` on `code.conventions` and `code.test_gate`                                                                                                                                                                         | none: it is the caller's own, read as sent against the indexed head                                                                          |

The mirror keeps a PR's `refs/pull/N/head` after the merge, so a read of an unmerged
change by `pr_number` first asks whether the PR was merged after the indexed head. It
was when its head is on the namespace's branch outside the indexed head, or when the
ledger or the issue and PR mirror records its merge after `history_until` (a squash or a
rebase leaves the head off the branch). Such a PR answers as one whose head the mirror
lacks (`head_not_in_mirror`), on `code.review_brief` with `open: true` and on the
post-image of `code.symbol`, `code.callers`, `code.callees` and `code.impact`.
`code.conventions` places a `head_sha` the same way, with the `pr_number` sent beside
it: a commit on the branch outside the indexed head, or the head of a PR recorded as
merged after it, is read as a commit the mirror lacks. A post-image the caller sends
(`pr_files`, `pr_diff`) is the caller's own and is read as sent; its brief takes a title
and an author from the issue and PR mirror only for a PR that mirror does not record as
merged after `history_until`.

A read of the state or the records that fails places nothing, so the head is not read,
and the server logs the failure as a warning. A read by `pr_number` then answers
`head_not_in_mirror`. `code.conventions` answers with its diff-dependent rules `unknown`
and the note `head_sha not placed`, and does not read the ledger's merge commit in the
head's stead.

Each such read places its head again, ahead of any cached post-image. One git process
reads the PR head and the branch tip, and the mirror answers an ancestry question once
per pair of commits, so a head, a branch tip and an indexed head that stand still cost
that one process. The indexed head and the merge records are read every time, since
either changes while the mirror stands still.

`code.blame_range` and `code.first_build` also answer across the branches of one
repository. For them a commit counts when the indexed head of the addressed namespace
contains it, or the indexed head of another namespace of the same repository that the
caller may read: a release-branch commit asked of the trunk, which that branch's own
namespace would answer too. `code.first_build` does not ask the tracker for the builds
of a change the ledger or the mirror holds outside those heads. The default start of a
`code.blame_range` window, the oldest release cut, counts only inside the addressed
namespace's own head.

A namespace at its branch tip reads the whole ledger and every commit of its branch:
each is inside the head. The `history_until` row is resolved again on every ingest pass,
so a change the ledger learns after the index reached its commit is inside the bound one
pass later. The `code_graph_stats` pass resolves it too, before it mines the test map's
co-change rows, and retires the rows the ledger inside the head no longer yields. A pass
reads 20,000 co-change pairs at most, the most co-changed first; a ledger that yields
that many is read in part, so the pass adds the pairs it read and retires nothing. A
namespace neither a pass nor a backfill has published for reads the whole ledger, and
one with nothing indexed has no head to stay inside. `pr_leg_before` on `code.search`
pins the history leg to an earlier instant on top of the bound.

## Forgejo hosts

An entry in `LOOM_CODE_REPOS_JSON` with `"forge": "forgejo"` and an HTTPS or SSH
`git_remote` reads its merged PRs from that host's REST API (`https://<host>[:port]/api/v1`)
into `loom.code_pr_history`; the Repositories page does not set `forge`. The entry's
`github_token` is then the host's access token (scope `read:repository`; a public
repository reads without one), never `LOOM_CODE_GITHUB_TOKEN`, which is not sent to a
Forgejo host. The entry's `repo` is `host/owner/name`; its PR links are built from
`git_remote`, port included. `backfill-prs` sorts by close time (`sort=recentclose`), which needs
Forgejo 12 or later. Review comments, the issue mirror and open-PR heads stay GitHub-only. The API has no target-branch filter and
no merged-date search, so the branch is matched on each PR's `base.ref` and
`backfill-prs` walks closed PRs newest close first back to
`LOOM_CODE_PR_BACKFILL_MONTHS`, resuming after the close time it stopped at.

## Which op answers which question

| Question                                                                  | Op                                                                                       |
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| Brief me on this PR, or on the change I am about to make                  | `code.context_pack` (`pr_number` or `task`; `sections` keeps only the blocks you act on) |
| Which merged PRs touched this symbol or path, and what did reviewers say? | `code.history`, `code.symbol_history`                                                    |
| Which merged PRs last touched these lines, between release A and B?       | `code.blame_range`                                                                       |
| What did reviewers check on this merged PR? What do they usually check?   | `code.review_brief`, `code.conventions`                                                  |
| Before I open a PR: does one like it already exist?                       | `code.pr_check`                                                                          |
| Which merged PRs could have introduced this bug?                          | `code.bisect_candidates`                                                                 |
| Which release branches still carry the bug a fix removed?                 | `code.backport_gap` (one fix), `code.backport_gaps` (every labelled fix)                 |
| Which CI build first carried this commit?                                 | `code.first_build`                                                                       |

Arguments are in the [operations reference](/docs/reference/operations#code).

### History of a symbol, a path or a line range

`code.history` lists the merged PRs that most recently touched a symbol (`name` or
`symbol_id`), a `path`, or given PR `numbers`: number, title, author, labels, and up to
`reviews_per_pr` (default 3, `0` = none) human review comments on that file. For a symbol
or a path, `limit` (default 5, at most 50) and `offset` (at most 10,000) page back through
the PRs of its files (every file that defines a name), newest first; a `numbers` lookup
answers in one page of up to `limit` PRs and refuses `offset`.
`code.symbol_history` narrows this to one function's regression history: the PRs that
touched its span, their linked issues and reverts, and the review comments inside it.

`code.blame_range` takes a `path`, a line range (at most 400 lines) and a window as
release versions (`from_version`, `to_version`) or commit shas. It combines the PR
ledger's file lists in the window (a floor) with `git blame -w -M -L` on the mirror,
each blamed commit mapped to its PR. On a release-branch namespace it also reads the
trunk namespace's ledger, only when the caller may read the trunk; otherwise the
trunk's rows are left out and `legs.ledger.skipped` names it. A release version
resolves to its branch namespace's indexed head when the caller may read that
namespace, else through the mirror's branch or `-new` tag. A window end read from the
mirror (a sha, a tag, a branch) resolves only
[inside an indexed head](#history-stays-inside-the-indexed-head), the first of a
version's refs that is; one outside answers `window_unresolved`, as a ref the mirror
does not have.

- `stage: "introduced"` (default) demotes backports, reverts and whitespace- or
  rename-only touches, and promotes a PR that names the enclosing function, drew a
  review comment inside it, or whose linked issue names the words in `mentions`.
- `stage: "last_touched"` keeps the blame order.

The answer is exact for "last touched", never for "introduced the bug"; its `note` says
so.

### Review briefs and conventions

`code.review_brief` reads the brief the ingest built when the PR merged: the class of
every changed file, the touched functions with their callers and fan-in, the tests that
cover them, and what reviewers said. The `history` section reads each touched function's
record by its file and name (`path:symbol`), so a name many files define, such as a C++
`REGISTER_FUNCTION`, reads the record of the PR's own definition. A path or name the
`path:symbol` form does not parse, such as a path without an extension or with `[`, or a
name such as `(anonymous namespace)::f`, reads the bare name, as does a form past the
op's 300-character name bound; a record of another file's definition is `unknown`.

The answer comes first: `verdict` and `verdict_causes`, read off every section the brief
holds, whatever the tier serves, and off `rationale` when this read serves it. A verdict
other than `gaps` or `unsettled` says that every check it rests on ran in full. The
values are tried in this order:

- `gaps`: something to act on; `verdict_causes` names each: `uncovered_symbol` (the
  coverage claim of a touched definition or setting says `uncovered`),
  `symbol_with_regressions` (a fix PR or revert names a touched definition),
  `randomized_setting` (CI randomizes a touched setting), `rationale_check`.
- `unsettled`, when what the brief is of was not read in full:
  - `paths:no_paths`, `paths:diff_unread`, `paths:diff_cut` (a source path with hunks
    past the 200,000 characters of the diff impact reads), `paths:not_read:<n>` (source
    paths past the 50 files impact reads);
  - `symbols:<verdict>` when the impact read could not answer (`unknown`, `not_covered`,
    `no_match`; `symbols:code.impact:<error>` when it raised), and `symbols:<op>:<error>`
    for another read the section rests on that raised (`file_rows_for_paths`,
    `functions_for_paths`, `caller_counts`, `git_diff`, `git_ls_tree`,
    `git_head:unread`, and `detect_lang` for a file read by its text whose language
    rule's parse could not run);
  - `symbols:unmapped_changes` for a changed source line in no function and placed on no
    definition that the brief does not exempt (below), and `symbols:new_side_unread` for
    a changed source file whose new side impact did not read to place the lines the diff
    adds (below), with `symbols:code.impact:new_side_failed` when that read failed and a
    later read may succeed;
  - `symbols:drifted:<n>` for changed source files that differ between the diff's old
    side and the commit the index rows are at;
  - `symbols:ungraphed:<n>` for changed files the index holds no file row of, of a path
    the ingest reads for its symbols and does not refuse;
  - `symbols:index_error:<n>` for changed source files, or files in no language, whose
    file row records an index error (a file over the size cap, a failed chunking or
    parse), whose symbol rows are an older commit's or none;
  - `symbols:not_read:<n>` for touched definitions past the first 30;
  - `overlay:<reason>` for an open PR whose overlay was off (`no_repo_entry`,
    `head_not_in_mirror`, `no_merge_base`, `no_git_mirror`, `error`) and
    `overlay:partial` for one that did not read every changed file (its parse time was
    spent, or a parse could not run here), whose parse of a file raised or ran past its
    limits, or that parsed another head than the one the brief's diff is read at (a push
    between the two reads, `head moved` in `overlay_note`);
  - `brief:v<n>` for a brief stored at an older payload version.
- `no_source_change`: every changed path is a test, a document, configuration, a file
  the ingest reads no symbols of (an image, a file its denylist refuses) or outside the
  index; a file a lane parser reads for its symbols (C++, Python, shell, TypeScript, Go,
  CMake, a Kubernetes manifest and the rest) is source.
- `unsettled`, when a check did not run in full, did not decide or rests on a co-change
  alone: a read that raised (`tests:coverage_claim:TimeoutError`, named in the section's
  `failed` too), a cap or a request an op refuses (`tests:not_claimed:<n>`,
  `history:not_read:<n>`, `settings:not_read:<n>`), a row that did not decide
  (`history:unknown:<n>`, `settings:unknown:<n>`), a bound tracker `code.symbol_history`
  could not read (`history:tracker_unavailable:<n>`), a read `code.setting_facts` failed
  open (`settings:control_unread:<n>`, `settings:declaration_unread:<n>`,
  `settings:history_unread:<n>`, `settings:randomizer_unread:<n>`), `rationale:unknown`,
  `rationale:not_requested`, a section verdict such as `tests:partly_covered`, or
  `tests:cooccurrence_only:<n>` for claims whose strongest evidence is a test file that
  changed in a PR with the source (`pr_cooccurrence`): the claim says `covered_by`, but a
  co-change does not show that the test runs the changed code.
- `nothing_to_check`: each source line the PR changes is in no function and one the
  brief exempts (below): a blank line or a C++ `//`, prose or doxygen comment line
  (`symbols:no_seeds_in_hunks`); a PR with no claim for any other reason (a change only
  in a language the call graph is not built for: `symbols:no_indexed_paths`) is
  `unsettled`.
- `covered_no_gaps`: every claim says `covered_by`, the regression record is clean or
  file-level, every setting is known and the rationale `clear` or `none`; each claim
  rests on a coverage run or a test that names or includes its subject.
- `""`: no brief was found (`source` is `missing`).

The brief caps its fan-out: coverage claims for the first six touched definitions and
four settings, regression records for the first six touched definitions (a name in two
files is two), facts for the first eight settings, and the first 30 touched definitions.
Each cap that leaves a subject out is a cause of its section, so the verdict stays
`unsettled`; so is a subject an op refuses to read, such as a compiler-tier name past a
field's 300 characters, since every build refuses it the same way. The paths section
stores its first 200 changed paths as rows; its `rows_total`, verdict and causes count
every changed path. The `rationale` section is never stored, so a read that does not
serve it (the trivial tier, or `sections` without it) answers `gaps`, `unsettled` with
`rationale:not_requested`, or `no_source_change`: `covered_no_gaps` needs `rationale` in
`sections` (or `sections` empty) on the standard or full tier. A brief one of whose
reads raised is served and not stored, and the next read builds it again (the test home
is advice: a read of it that raised or was refused decides no verdict, though one that
raised still keeps the brief unstored); so is an open PR's brief built without its diff,
or from an overlay that was off (`overlay:error` when git could not read its diff), left
a changed file unreached when its parse time was spent or its parse could not run here,
or parsed another head. A parse of a file that raised or ran past its limits does the
same on every build of that file, at an open PR's head and at a merged PR's parent
alike, so that brief is stored, `unsettled`: `code.impact` names `new_side_unread` for
the file, and an open PR's `overlay_note` counts it. A stored brief is served as it was
built: one of an older payload version (`v` in the payload) records no cap or failed
read, so its verdict is `gaps` or `unsettled`.

`code.impact` maps a diff on its old side onto the index rows, which are at the indexed
head (at the merge commit when the ingest builds a merged PR's brief, before it moves
the head). A merged PR's brief sends it the diff reversed, whose old side is the merge
commit, so its lines fall on the functions the PR changed or added there; an open PR's
brief sends the diff as written, whose old side is its base. A changed source file that
differs between that old side and the commit the rows are at is `drifted`: its line
numbers land on other code, so the brief reads the file as unread and translates no
line. One `git diff --name-only` on the mirror finds them, and a failed read keeps the
brief unstored. A diff the caller sends (`pr_diff`) may name a base the mirror does not
hold, so its drift is read off the blobs it names: a file is drifted when the old blob
its `index` line names is not the file at the path its lines are placed on (its new
path; its old one for a file the diff deletes) at the commit the rows are at (one `git
ls-tree`). A file that arrives at its path (one the diff adds, or a rename's or a copy's
new path) is drifted only when that commit holds another file there; with none, no row
holds its lines. A file git names with no `index` line and no hunk (a rename, a copy or
a mode change that changes no line) has no line to place, nor does a post-image sent
with no diff. A file with hunks and no `index` line, as in a diff not made by git, is
drifted, as is a file two sections of the diff change (a series of patches). A function
the PR changes in a test file is not listed: it is no coverage obligation.

A source file is one a lane parser reads for its symbols, by the language its file row
records; the ingest reads that language off the text, so a Kubernetes manifest, a Helm
template and an extensionless script are source. A file the diff adds or deletes whole
and the rows do not hold (one an open PR adds, one a merged PR deletes) is read by its
text in the diff, off the request's event loop: an extensionless file in a script
directory is shell when bash parses it, and when that parse could not run here the file
is unread and the read failed, so the brief is not stored. The ingest records such a
file as shell with its parse failed, not as a file in no language. A changed file the
index holds no row of is read by its path and the repository's denylist: the ingest
refused it, or reads no symbols of it, unless a lane parser reads a file of that path.

Impact places each changed line on its own side of the diff. A line the diff removes is
in the innermost function of the index rows at the old side that spans it. A line it
adds is in a function only where the diff's new side holds one that spans it: an open
PR's head, from its overlay's parse, where a function the PR adds holds its own lines;
or the parent of a merged PR, whose reversed diff adds the lines the PR removed, parsed
from the mirror as the ingest parses it, one file at a time on the overlay's parse pool
and none started after `LOOM_CODE_PR_OVERLAY_PARSE_WINDOW_S`. A function of the new side
is matched to the index's parser-tier rows of the file by the name the same parser gives
it, so a function the compiler tier names otherwise (a C++ function in an anonymous
namespace) is found under either name. A name the file holds as often on both sides
pairs in line order. A name held a different number of times (an overload added or
deleted), or one the index does not hold in the file (code a merged PR deleted), pairs
none of its functions, and their lines are in no function. A Python definition starts at
its `def` or `class`, and the decorators the diff adds or removes directly above it are
its lines too. A changed source file whose new side impact did not read is
`new_side_unread`: the overlay did not parse it, the file is absent at the parent or
past the ingest's size cap, or its parse raised or ran past its limits, as every build
of it leaves it. A read that failed and a later read may make (a git call that raised, a
mirror not ready, a parse that did not run in the window or could not run here: no
answer within its wall bound, a process killed twice or ended by a signal sent from
outside, one that did not start or failed outside its parse, tree-sitter or a grammar
loaded from outside the interpreter's site-packages) is `new_side_failed` too, a
failed read, so the brief is served and not stored. Every line the diff adds there is in
no function, and so is each line of a hunk sent with its header alone that replaces
lines. In a language the call graph is not built for (TypeScript, Go, CMake), every
changed line is a line in no function, and so is every line of a source file an open PR
deletes, which is `unmapped_changes` unless it is blank, a comment included.

A changed source line in no function, outside every function or in a class body, is
`unmapped_changes` unless it is placed on a definition (below) or it is blank (spaces,
tabs, vertical tabs, form feeds and carriage returns) or one of these C++ comment lines,
none ending with `\` or `??/` (which continues it onto the next line) or holding a
carriage return (where a compiler starts a new line): a line comment, or a line inside a
block comment that reads `* ` (one space) and a doxygen command, or `* ` and two words
or more of prose. In a prose line, punctuation after the first word, or a word (as the
lexer splits it at `-` or `'`) spelled as a macro (two characters or more, all capitals,
or holding `_`) or as an operator, a qualifier or a declarator keyword, makes it a
continued expression or declarator. In either kind, an end with `;` or `,` does too, and
so does a `\u`, `\U`, `\u{` or `\N{` escape where a doxygen command would be. A line
holding `/*` or `*/` is a change, a whole `/* */` comment included: inside a block
comment the diff leaves as it was, a `*/` ends that comment and turns the code below it
on or off, and the hunk need not show where the comment opened. A Python `#` line is a
change, since it may sit inside a module's string, and so is a blank Python line on the
first two lines or a blank shell line on the first, where it moves the lines an
interpreter line and an encoding cookie are read on. In C++, Python and shell, a blank
line or a comment below a line that ends with `\` (or `??/`, which the rule reads as one
in each of them) ends that line's macro or statement, so it is a change, and so is a
comment that starts a run the hunk shows no line above (a diff with no context), or
follows only blank lines of such a run, except at the top of the file, since it may sit
below such a line. A blank line there is exempt, so the comment below it is what keeps
such a change visible. A brace, a namespace line, an access specifier and an `#include`
are code: each can move unchanged code into another scope or change which overload it
calls. A comment in another language is a change, since the compiler reads some (a Go
build constraint, a cgo preamble, a TypeScript reference). A registration above a
changed signature is in no function at the side that holds it. The rule reads the
changed lines and the line above each run alone, so a blank line inside a multi-line
string or a heredoc, a comment-like line inside a C++ raw string or a macro argument, or
a declarator line whose macro is not spelled in capitals or with `_` (`* buf unused`,
`* NonNull ptr`), reads as blank or as a comment.

A changed line outside every function is placed on a definition, and adds no
`unmapped_changes`, where the language says which definition it belongs to. That
definition is then a touched symbol: it seeds the radius, and the tests section claims
its coverage, so the brief settles only when that claim says `covered_by`, and an
uncovered one answers `gaps`.

- A line of a class body is placed on the class, on the side that holds it: a line the
  diff removes on the index's class, a line it adds that no function of the new side
  holds on the class that holds the run's lines and the line on each side of it in the
  index; in Python a run below a class that ends at the line above it is placed on no
  class, since no line closes a Python class and the run may continue the one above it.
  In C++ that is a member line, a declaration whole on one line: a member, a static
  constant, a method prototype or a constructor, ending with `;`, with every bracket it
  opens closed on the line and none closed it did not open. Any other line stays a
  change: a brace, a class head or its base clause, an access specifier, a `using`
  declaration, a `friend` declaration without a body (a friend defined in the class body
  is a function of its own, below), a namespace or preprocessor line, a line of a
  prototype or a template head spread over lines (the head they continue may be
  `virtual`), a macro call, a statement (`return x;`), a line holding `virtual`,
  `override` or `final` (they change which function a call through a base reaches, an
  override no claim on the class covers), a line that holds one of those words after a
  member, `/*`, `*/`, a raw string's opener or a quote no literal closes, and a line
  below one that does not end a declaration or a scope's head (a `virtual` or a
  `template <...>` alone on the line above). The words are read as the line spells them:
  an override declared without `override` reads as a member, and a claim on the class
  then decides it. In Python an attribute (`retries = 3`, `name: str`) of a class body
  outside its methods is placed when it leaves no bracket open and the line above it is
  code that leaves none open either, and a string line (a docstring) when it sits right
  below the class's head, whole on its line. Any other line stays a change: a `class` or
  `def` head, a decorator, a compound statement's head, a `return` line, a line with an
  odd count of `"""` or `'''` (it opens or closes a string around lines the diff
  leaves), a decorator's argument, which belongs to the method below it, a string line
  below any other line (an argument's or a value's, below a dict key's `:` too), and a
  line below a blank or comment line, where the brackets open above are not known.
- A C++ prototype is placed also on the function it declares, when it is a member line
  by the rules above and the diff's files outside tests hold definitions of one
  qualified name for it: in a class body the function whose qualified name is the
  class's and the prototype's; at file scope a free function of its name in the same
  file or a file of the same stem in its directory (`widget.h` and `widget.cpp`), or a
  registration function by the index's registration rule (`registerWidgets`), which is
  often declared beside the call that runs it. Of those it is placed on the definitions
  whose parameter types are the prototype's, names and defaults aside, or those of a
  prototype of its name that its run replaces: the index holds the old side's
  definitions, so a changed signature (`resize(int w, int h);` replacing
  `resize(int w);`) declares the `resize(int)` the index holds. A prototype whose types
  match no definition there declares another overload, whose claim says nothing of it,
  and stays a change; so does one whose parameter the two sides spell differently
  (`unsigned` and `unsigned int`). A compiler-tier row names its overload by a hash, so
  its types are read off the parser tier's row of the same definition. A free function
  is one at global scope or in a scope the index shows to be a namespace: a scope that
  holds a class or struct row and neither is one nor sits in one (a class whose own row
  sits outside the diff's files, with a nested class's row in them, reads as one). A
  function in a scope the diff's files show nothing about may be a method of a class
  declared elsewhere, so a file-scope prototype is not placed on it, and one the
  compiler tier names in an anonymous namespace is not placed either. A prototype whose
  function the diff's files do not define stays a change, in a class body too: its
  defaults and parameters reach the function's callers, which a claim on the class does
  not decide. So does a prototype in a class body when a function of its name sits in a
  scope nested in the class, which it may declare instead, and a class-body line that
  names something before a `(` but is not read as a prototype (a default argument
  written with braces). A trailing `//` comment is not read, unless it holds a `#`,
  `/*`, `*/` or an odd count of `"`, which keep the line a change. The namespace a
  file-scope prototype sits in is not read either: a free function of its name in
  another namespace of the same-stem file is its candidate as well. Definitions under
  two qualified names leave it a change, and so does a file-scope line whose parentheses
  start with a literal (`static const std::regex re("a+");`), a constant built by a
  constructor. A registration statement inside a registration function's body is that
  function's line already.
- The rules read the changed line, the line above it and the index's rows, and they are
  as good as those rows. A line of a method the parser did not read as one (a head
  spelled with a macro it cannot expand) sits in the class body by the rows, so a
  declaration in its body (`size_t n = rows.size();`) reads as a member line and is
  placed on the class that holds the method: a claim on the class then decides it. The
  parser holds a row of each named class or struct, a nested one and one defined in a
  variable declaration or a `typedef` included, and of each method under `#if`, `#elif`
  and `#else`; a friend defined in a class body is a function of the namespace around
  the class, so its body lines are its own (two friends of one namespace with the same
  parameter text, a `swap(Self & a, Self & b)` in two classes, share one row as two
  overloads of one signature would, and the body of the one whose row is lost reads as
  its class's); a union is a struct row, and an unnamed class, struct or union
  (`struct { int a; } pair;`) has none, so its body reads as the scope around it, a
  statement in an inline method of it too. A C++ `struct` is no definition the brief
  claims, and `code.impact` reads its rows for placement alone: a line of the body of a
  struct the index holds a row of stays a change. Since only the changed line and the
  one above it are read, a line inside a string or a macro call that spans lines with no
  `\` (a raw string's body, a call's arguments) reads as what its own text declares when
  the line above ends a declaration, and is placed as one: the hunk's lines are not read
  for the string or the call around it. For the same reason a `virtual` alone on a line,
  with a comment or a blank line between it and the prototype it starts, is not seen,
  and the prototype is placed as one of the class; and in Python a method the parser
  gives no row (one defined in a class body's `for`, `while` or `match` block) sits in
  the class body by the rows, so a line of its body shaped as an attribute is placed on
  the class. The rules are as good as the rows of the running parser: while the ingest
  re-extracts after a parser change, `code.impact` places no line (the namespace's
  recorded `symbol` stage stamp is not the running one, or the state cannot be read).
  With `code_extractor_rechunk_enabled` off the stamp never moves, so a namespace
  indexed by an older parser places no line until it is re-extracted.
- No line is placed that a macro or a statement continues (the line above it ends with
  `\` or `??/`), that starts a run the hunk shows no line above (a diff with no context),
  or that sits in a function the new side pairs with no row, or on a side nobody read.

A constant or a static at file scope stays a change: the index links no C++ variable to
its readers, and a Python `reads` edge records an attribute read (`config.LIMIT`, a
typed receiver's field) but not a bare name read in its module or after `from config
import LIMIT`, so the readers it holds are not all of them and no claim on them could
decide the line. So do an `#include`, a `using` line, a namespace line and a brace.
Shell scripts have no class and no prototype, and the other languages' lines in no
function stay changes as before. A data member or a static constant of a class is placed
on the class like its other members: the brief claims the definition a change sits in,
as for a function whose body changes, not the code that reads it, and a constant at file
scope sits in no definition.

The symbols section lists the wiring the PR adds as counts in `collapsed`, not as rows.
The fold is how the section shows them: their coverage claims and regression records
are read all the same. The kinds follow the index's
own name rules: `registration` (C++'s registry convention: `REGISTER_FUNCTION`,
`registerStorageMergeTree`), `factory` (`create`), `constructor` (`A::A`, `__init__`)
and `one_line` (a definition the parser holds as one line, such as a trivial override).
A touched function is collapsed only when its whole parser extent is lines the diff adds
in a block that deletes none, so wiring the PR changes keeps its row, and its call sites
were counted for it alone (one definition of its name in the file). A function only the
compiler tier holds (a file the parser does not read, a function a macro expands to)
has no parser extent, so it keeps its row. Call sites are counted in both tiers,
under each tier's id of the definition, and a site both record counts once. Then a
registration function of at most eight lines is collapsed when it has at most one call
site and that one is a registration (a registry method such as `registerFunction` is
called by every registration; a `registerStorageFoo` whose creator lambda checks the
engine's arguments keeps its row). A one-line definition, a
factory or a constructor is collapsed only as a member of a class the PR adds in the same
file (one the PR inserts into an existing class changes that class, so it keeps its
row): a one-line definition when no call site is outside a registration; a factory or a
constructor of at most eight lines when no call site is outside a registration or, with
at most eight sites, outside the methods of its own class (the
`std::make_shared<FunctionX>` in `FunctionX::create`). An open PR's diff is
its head's, which the index rows are not at, so its brief collapses nothing. The
section's `note` gives both counts.

Each `tests` row of a symbol or setting carries the coverage claim's `verdict`, its
`strongest_tier` (`code.coverage_claim`'s evidence tiers), up to two `tests` of that tier
by repository path, and `tests_at_tier`, how many tests of that tier the claim listed (it
lists at most five). The weaker tiers' tests are left out: a short name's grep can reach
thousands of files.

At the `standard` and `full` tiers the brief also has a `rationale` section: the design
decisions and constraints (rows typed `decision`, or tagged `decision` or `constraint`,
active or conflicted as the pre-edit block shows them) in the repository's trunk code
namespace whose `files` or code links touch the PR's files. It is read on every call, from
the trunk namespace only when the caller may read it, and never stored with the brief, so
a decision recorded or changed after the merge shows up on the next read. It reads the
first `LOOM_CODE_REVIEW_BRIEF_RATIONALE_PATHS` (10) changed files, source files first, of
those the brief stores, and keeps at most `LOOM_CODE_REVIEW_BRIEF_RATIONALE_ROWS` (8)
rows, those with something to check first. It serves whole rows, `check` rows first and
then constraints. `LOOM_CODE_REVIEW_BRIEF_RATIONALE_TOKENS` defaults to `0` (unlimited);
a positive setting or request token budget trims whole rows to fit. Each row
carries the pre-edit block's line for it with its value cut at the line length (source,
`(pinned)` and the code-change note kept), `pinned`, `code_state` and a `verdict`. The
line shows a code state that is not `fresh`; `code_state` holds the state of every row.
When a served row has a code state, `fresh` too, the section's `note` says what it was
compared with: the repository as Loom indexed it, not the caller's checkout. Each
changed file read is one `memory.for_file` read: four ClickHouse reads (files match, code
links, their memories, the linked rows; a file with many links slices the last), each
keeping up to 50 rows with up to `LOOM_MEMORY_FOR_FILE_WHOLE_TOKENS` × 48 bytes of value.

The check looks for two kinds of name: the code-shaped names in a row's `Rejected:`
clause, up to a `Realized:` one (backticked, qualified like `A::b`, or calls like `f()`),
and the snake_case names anywhere in a constraint's value, backticked or not, bare or
qualified (`Setting::distinct_spill_ratio`). It is a whole-word match on the lines the
diff adds, read up to 200,000 characters of a posted diff or 200,000 bytes of the
mirror's, so `check` means "read this row against the diff", not a violation found.

| Row verdict | Meaning                                                                                                                                                                                                                |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `check`     | the diff adds one of the row's checked names (`names`)                                                                                                                                                                 |
| `clear`     | the row has checked names and the diff adds none of them                                                                                                                                                               |
| `unknown`   | no name found, but the diff could not be read here (git failed, even part way), was cut, or has a hunk that miscounts its lines, or the row's value was cut (`diff_unread`, `diff_cut`, `diff_malformed`, `value_cut`) |
| `""`        | the row names nothing to check                                                                                                                                                                                         |

The section's verdict is `check` when any row says so, then `unknown`, then `clear`, and
`none` when no row has anything to check. It says `clear` or `none` only when every
changed path and every matching row was checked; otherwise it says `unknown`, and the
causes say what was left: no repository is configured for the namespace (`no_repo`), the
brief stores no changed path (`no_paths`), the caller may not read the trunk namespace
(`trunk_not_readable`), a stored changed-path list that may be cut (`paths_maybe_cut`: the
brief stores the first 50 changed files plus the files of the diff's hunks, up to 200, so
a list of 50 or more may hold fewer than the PR changed), changed paths of that list not
read (`paths_not_read`), a path whose read reached its 50 rows (`paths_at_row_ceiling`), a
path whose code-links read failed (`links_not_read`), or rows the row cap left out that
had something to check (`rows_not_read`).

`code.conventions` states the repository's recurring maintainer checks as facts over one
PR's diff (`pr_number`, `head_sha`, `files` or `diff`), never as opinions; `rules` narrows
which checks run. The diff it reads is capped at `LOOM_CODE_CONVENTIONS_DIFF_MAX_BYTES`.

## Pre-PR duplicate check: `code.pr_check`

An agent about to open a pull request passes the draft and gets one of three verdicts:
`duplicate_of` (an open PR is already doing this, or a merged one already did),
`related`, or `none`.

```python
from loom import Agent

async with Agent(org="acme", namespace="code-widgets", agent="pr-bot") as bot:
    check = await bot.call(
        "code.pr_check",
        title="Retry the upload when the token expires",
        paths=["src/upload/client.py"],
        symbols=["UploadClient.send"],
        issues=[1432],
    )
    if check["verdict"] == "duplicate_of":
        for item in check["items"]:
            print(item["pr_number"], item["state"], item["evidence"])
```

The same call over HTTP is `POST /v1/code.pr_check`, and over MCP the tool is
`loom_code_pr_check` (in the `coding` and `tracker` toolsets). A title, changed paths or
an issue number is required.

Candidates come from Loom's own ledgers through four legs, with no GitHub call:

| Leg             | Reads                                                                                                                    |
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
| open PRs        | every open PR in `code_gh_items`: its title and the files its `refs/pull/N/head` touches (no body)                       |
| closed unmerged | PRs closed without merging in the last `LOOM_CODE_PR_CHECK_CLOSED_DAYS` (180): "someone tried this"; capped at `related` |
| merged, by path | merged PRs that touched the draft's `paths`                                                                              |
| merged, by text | merged PRs whose text scores against the draft's title and symbols, and merged PRs closing the same `issues`             |

Each candidate is scored by one fixed rule: the share of the draft's title and symbol
tokens it carries (weighted by rarity), a small body term for merged PRs, path overlap
in both directions, and whether it closes an issue the draft names. There is no labelled
set to fit the weights on, since duplicate PRs are closed, not merged. The answer says
`epistemic: "heuristic"`, and a title alone never reaches `duplicate_of`.

| Setting                                  | Default | Effect                                                                  |
| ---------------------------------------- | ------- | ----------------------------------------------------------------------- |
| `LOOM_CODE_PR_CHECK_DUPLICATE_THRESHOLD` | 0.55    | score at which a candidate is `duplicate_of`                            |
| `LOOM_CODE_PR_CHECK_RELATED_THRESHOLD`   | 0.2     | score at which it is `related`                                          |
| `LOOM_CODE_PR_CHECK_MERGED_DAYS`         | 365     | merged PRs older than this do not vote as duplicates                    |
| `LOOM_CODE_PR_CHECK_MASS_FILES`          | 200     | a candidate touching more files is a mass change; its files do not vote |

`tracker.duplicate_check` is the issue-side sibling: on a `none` or `related` verdict it
carries `code.pr_check`'s PRs that may already address the draft as `related_prs`
([tracker overview](/docs/features/tracker/overview#duplicate-check)).

## Bisect candidates: `code.bisect_candidates`

Given a reported bug, which merged PRs should an engineer investigate first?
`code.bisect_candidates` prioritizes candidates; it is not an automated `git bisect`.
It does not build the repository, run tests, reproduce the report, discover good and bad
versions, or prove that a candidate caused the bug. A candidate's score is an
investigation ranking, not a probability of causation.

The regression boundary comes from evidence recorded before the call:

| Window input                  | Where it comes from                                                                                                               | What Loom does with it                                                                                                                              |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bad_version`, `good_version` | A user, CI job, support workflow or testing agent has observed the bug on the bad release and observed the good release as clean. | Scans the releases between those observations. Loom does not retest either release.                                                                 |
| `issue_number`                | The linked tracker issue already has `reproduces_on` and `clean_on` triage observations, populated by the tracker workflow.       | Reads those observations when explicit versions were not supplied. The existence of an issue or triage value is not proof that the report is valid. |
| `after`, `before`             | The caller knows only an approximate merge-time interval, such as the last known-good date and first-seen date.                   | Narrows the PR-history scan to that interval; the dates are bounds, not reproduction results.                                                       |
| `bad_sha`                     | The caller knows a commit at or before the first observed failure.                                                                | Resolves the commit time on the repository mirror and uses it as `before` when `before` is absent. It does not run the commit.                      |

The caller then supplies whatever report evidence it has: crashing frames (`symbols`),
source `paths`, `patterns`, free `text`, an `issue_number` and, when known, a `fix_pr`.
When no precise release range is available, repository-history fallback uses the recent
history retained for this scan (`LOOM_CODE_BISECT_HISTORY_DAYS`, default 90), which is a
broader and less precise investigation window.

1. Frames resolve to files through the code index.
2. The candidate scan reads the merged, non-derivative PRs whose first release lies in
   the window and that touched those files, ranked by the frames their diff names. With
   a linked tracker it scans the tracker's PR diffs; the previously recorded triage
   columns of `issue_number` (`reproduces_on`, `clean_on`) can supply the window. With no tracker,
   or a tracker holding no changed files, it reads the repository's own PR history
   (`LOOM_CODE_BISECT_HISTORY_DAYS`, default 90), and the answer says
   `candidates_from: "code_history"`.
3. With no frame (a wrong-result report) and an `issue_number`, the scan is bounded by
   the issue's rarest identifiers in the window's diffs, the component's directories and
   the fix's files; `wideners` chooses which, `widened_by` says which applied.
4. Report-time fusion fuses the diff scan with vector, lexical, path, subtree and
   recency ranks; a PR the report names as introducing the bug leads. When the fused top
   is weak (margin over #2 under 0.1 and not a report-named suspect), a wider window
   (12 releases, or `LOOM_CODE_BISECT_WIDE_DAYS`) joins and one LLM call reranks the top
   20 (`LOOM_CODE_BISECT_LLM_RERANK_MODEL`; a timeout keeps the fused order), or
   `rerank: true` asks for it.
5. A report naming no fix and no issue borrows the fix of the issue the duplicate check
   matches, inside `LOOM_CODE_BISECT_DUPCHECK_TIMEOUT_S`.

Each candidate carries marks (backport, revert, reverted, re-land, whitespace- or
rename-only, `touches_symbol` from the diff's hunk headers); `marks: false` returns the
bare ranked list. Which paths count as source code is the tracker's
`bisect.code_prefixes` ([record contract](/docs/features/tracker/record-contract#source-entry-options)).
The rerank needs a real LLM provider; the other stages run on the stock stack once PR
history is loaded. The bisect settings are listed in the
[configuration reference](/docs/reference/configuration#code).

The example below ranks the merged PRs that landed between a good release and a bad one
and touched the files of a crashing function. `bad_version` is the first release where the
bug was seen and `good_version` the newest release seen clean; Loom tests neither.

The version window needs a tracker namespace linked to the repository whose PR records carry `minor_version` (the [record contract](/docs/features/tracker/record-contract)). With merged-PR history alone
(`LOOM_CODE_PR_HISTORY_ENABLED` or `loom code backfill-prs`; see [first index](/docs/operations/code-index-operations#first-index)), the versions
do not bound the scan: the op reads the last `LOOM_CODE_BISECT_HISTORY_DAYS` (90 by default) instead.

```python
from loom import Agent

async with Agent(org="acme", namespace="code-widgets", agent="triage-bot") as bot:
    result = await bot.call(
        "code.bisect_candidates",
        bad_version="26.3",
        good_version="26.2",
        symbols=["UploadClient.send"],
    )
    for candidate in result["candidates"]:
        print(candidate["pr_number"], candidate["score"])
```

The candidates come back ranked. The `score` says which PRs to investigate first; it does
not show that a PR caused the bug. An engineer or a CI job still has to reproduce the
bug and test the candidates.

The final verification remains external to this operation: an engineer, CI workflow or
testing agent must reproduce the issue and test the ranked candidates.

## Backport gaps

`code.backport_gap` names a merged fix (`pr_number`) or the issue it closes
(`issue_number`, resolved through the tracker's `fixes` edges or a recovered link) and
answers per release-branch namespace of the same repository, newest first, or the
`branches` you name (namespaces or versions such as `26.4`). Three legs meet: the backport
record (the tracker's `is_backport_pr`, `upstream_pr_number` and `base_branch`, beside the
branch ledger's merged backports), the fix's first release (a branch cut at or after it
carries the fix), and whether the functions the fix's hunks touch exist on each branch.

| Verdict        | Means                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `gap`          | no backport, the branch predates the fix, and the touched functions (or files) are present; `cherry_pick` names the PR and merge sha |
| `pending`      | a backport PR exists and is open                                                                                                     |
| `covered`      | a backport merged, the branch was cut at or after the fix's first release, or the issue's `fix_versions` names the branch            |
| `not_affected` | every touched function (or file) is absent on the branch                                                                             |
| `unknown`      | the record was unavailable while the code is present, the presence check ran out of time, or the branch has no version to match on   |

A symbol-level `gap` is a lower bound: the code exists on the branch, which does not
prove the bug does.

- `exact: true` checks the patch per hunk. Removed lines still present and added lines
  absent make `gap` exact; added lines present, removed lines gone and no backport
  recorded make `not_affected` exact.
- `history: true` (implies `exact`) also reads the branch's tree and history in the
  mirror for rows the lines leave undecided.
- `presence.patch` shows the mode and the overlaps as evidence.

`code.backport_gaps` is the set-wide report: every fix of the last 90 days that
maintainers labelled for backport, per release branch, gaps first. The
`code_backport_gaps` worker writes it nightly into `loom.code_backport_gaps` by running
`code.backport_gap(exact, history)` per fix (`LOOM_CODE_BACKPORT_GAPS_ENABLED`, default
on, effective only with `LOOM_CODE_PR_HISTORY_ENABLED`); the op reads that table.
`wanted_only: false` includes unlabelled fixes. Every branch namespace is authorized
before it is read, failing closed.

## First build

`code.first_build` takes a commit `sha` or a merged PR's `pr_number` and answers which CI
build first carried it. It needs the linked tracker's `version_history` table: a run
naming the sha is exact; otherwise the bases of the runs after the merge are checked on
the mirror (`git merge-base --is-ancestor`, at most ten) for the earliest descendant, and
the answer is a lower bound.

## PR and tracker planes

A maintainer links trackers to a repository with `code.repo.set_source`, primary first
([tracker overview](/docs/features/tracker/overview)). Then:

- `code.bisect_candidates` scans the tracker's PR diffs and checks suspects against
  known fixes;
- `code.backport_gap` reads the backport record, and `code.first_build` the tracker's
  CI runs;
- `code.history` and the history parts of `code.search` and `code.ask` carry the
  tracker record beside the PR when a binding resolves and the caller may read it;
- `code.context_pack` can include tracker items (`sections=["qa"]`).

Without a tracker the ops answer from the PR plane where they can, and name the
tracker-only parts as missing.

## Limits and failure modes

- **No history, no answer.** With `LOOM_CODE_PR_HISTORY_ENABLED` off and no
  `backfill-prs`, the history tables are empty and the ops answer with nothing to rank.
- **History stops at the indexed head.** A change merged after the newest one the
  indexed commit contains is left out of ranking and linking, and reads as unknown by
  its number or its merge commit ([the bound](#history-stays-inside-the-indexed-head)).
  These follow the forge or the branch and are not bounded: an issue and an unmerged
  PR in the issue and PR mirror (kind, title, state and dates, with no files), the
  tracker's records other than the builds `code.first_build` reads, and the lag and
  `clone_head` of `code.index_status`, which say how far the branch is ahead of the
  index. An open PR that branched from a commit after the indexed head is read against
  the index like any other, so a definition its base has and the index lacks reads as
  one the PR adds. A PR merged by squash or rebase after the head that neither the
  ledger nor the issue and PR mirror holds reads as an open one while its
  `refs/pull/N/head` is on the mirror. A review brief stored while the head held its merge is
  served by a host without the mirror when the ledger has no row for its PR. A test-map
  row mined from a later change stays until the next `code_graph_stats` pass
  (`LOOM_CODE_GRAPH_STATS_INTERVAL_SECONDS`, a week) retires it, and is not retired in
  a namespace whose history inside the head yields 20,000 co-change pairs or more.
- **Anonymous GitHub access** covers public repositories at the public rate limit; review
  comments, the issue mirror and the history-window walk need a token.
- **Open PRs are not indexed code.** `code.pr_check` sees an open PR's title and files,
  not its body or its symbols.
- **Heuristic verdicts.** `code.pr_check` is uncalibrated by design; `code.blame_range`
  is exact only for "last touched"; `code.bisect_candidates` ranks suspects and never
  names a culprit as fact.
- **Tracker outages degrade, never fail.** A tracker read that times out or trips its
  breaker sets `tracker_unavailable`; the PR-plane legs still answer.

## Related

- [Tracker overview](/docs/features/tracker/overview) and [record contract](/docs/features/tracker/record-contract)
- [Adding repositories](/docs/features/code-index/repositories)
- [Code index operations by question](/docs/features/code-index/operations)
- [Code index architecture](/docs/architecture/code-index-architecture)
- [Operations reference](/docs/reference/operations#code)
