Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
85503e2
A compiler tier the tree calls for runs beside the producers an entry…
VanshajPoonia Dec 4, 2026
7182038
code.index_status names the rule behind each compiler tier
VanshajPoonia Dec 4, 2026
6daaf55
The compiler tier docs say how a tree and an entry pick the tiers
VanshajPoonia Dec 4, 2026
4be374f
A tier the entry excludes holds back no commit coverage
VanshajPoonia Dec 4, 2026
74a8def
The manual Python pass skips a Python tier the entry excludes
VanshajPoonia Dec 4, 2026
0166d76
A failed ownership read fails only its entry in a compiler tier pass
VanshajPoonia Dec 4, 2026
b354cdd
A failed ownership read fails only its entry in the crossref pass
VanshajPoonia Dec 4, 2026
68685c1
Merge remote-tracking branch 'upstream/main' into issues/2119-detecte…
VanshajPoonia Dec 4, 2026
0fada47
A tier the tree stops calling for holds back no commit coverage
VanshajPoonia Dec 4, 2026
335c55d
The manual Python pass runs only a Python tier the entry runs
VanshajPoonia Dec 4, 2026
1b70027
Each compiler tier worker's docstring names the entries it runs
VanshajPoonia Dec 4, 2026
1897c48
A commit is judged on the tiers its entry runs now, not the cached ones
VanshajPoonia Dec 4, 2026
21c133c
loom code scip-full says why it skips an entry without the clang tier
VanshajPoonia Dec 4, 2026
fe5551c
The operations guide says a returning tier resumes from its watermark
VanshajPoonia Dec 4, 2026
1e717c6
A status that cannot read the tree still waits on every tier the entr…
VanshajPoonia Dec 4, 2026
0c1b081
Merge remote-tracking branch 'upstream/main' into issues/2119-detecte…
VanshajPoonia Dec 4, 2026
a9db222
Status and coverage polls read a namespace's tree once per status TTL
VanshajPoonia Dec 4, 2026
33b59f0
A commit's answer names the primary tier from the tiers it was judged on
VanshajPoonia Dec 4, 2026
99bd645
The manual Python pass asks worker_owns once for its owner
VanshajPoonia Dec 4, 2026
a922902
The tier workers' first docstring paragraphs are wrapped evenly again
VanshajPoonia Dec 4, 2026
6dd8436
A commit's answer reads scip_commit_py from the same state as its tiers
VanshajPoonia Dec 4, 2026
d82188e
A tree read with no build file is kept and a failed one is retried
VanshajPoonia Dec 4, 2026
ae0cb33
Merge remote-tracking branch 'upstream/main' into issues/2119-detecte…
VanshajPoonia Dec 4, 2026
f9784e2
Merge remote-tracking branch 'upstream/main' into issues/2119-detecte…
VanshajPoonia Dec 5, 2026
47bc75e
A tree read is kept per indexed head, so a tier the new head calls fo…
VanshajPoonia Dec 5, 2026
2136bb0
Merge remote-tracking branch 'upstream/main' into issues/2119-detecte…
VanshajPoonia Dec 6, 2026
2844be2
A tree read that sees the head move is not kept for the head it was a…
VanshajPoonia Dec 6, 2026
bde6a28
A commit answer takes its tier selection and warnings from the tree i…
VanshajPoonia Dec 6, 2026
4a5fad9
The watch notifier test stubs the running tiers the pass now reads
VanshajPoonia Dec 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/features/code-index/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ profile identifies the ClickHouse-only SQL registration, error-code and stateles
conventions; those assumptions are not inferred merely because a project contains C++
or SQL.

`compiler_candidates` is inferred from build manifests. A candidate without a watermark
appears in `quality_warnings` with the workers to enable:
`compiler_candidates` is inferred from build manifests, and `compiler_tier_rules` names
the rule that runs each tier: `scip_producer`, `scip_extra_producers`, `tree`, or
`scip_excluded_producers` for a tier the entry drops. A candidate without a watermark
that the entry does not exclude appears in `quality_warnings` with the workers to enable:

| Candidate | Preflight in the worker environment | Worker |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ LOOM_CODE_REPOS_JSON=[{"org":"dev","namespace":"code-myrepo","repo":"acme/myrepo

- Loom picks the compiler-tier indexers from the repository's build files (`go.mod`,
`package.json`, `pyproject.toml`, a root `CMakeLists.txt`, …); `scip_producer` names
one instead ([Compiler tier](../operations/code-index-operations.md#compiler-tier)).
the primary one and `scip_excluded_producers` drops one
([Compiler tier](../operations/code-index-operations.md#compiler-tier)).
C/C++ also needs a configured build tree, so without one a C/C++ repository gets only
the parser tier.
- For a private repository, add a GitHub token (`LOOM_CODE_GITHUB_TOKEN` in `.env`, or
Expand Down
39 changes: 29 additions & 10 deletions docs/operations/code-index-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ LOOM_CODE_REPOS_JSON='[
| `embed_reuse_from` | a namespace whose embeddings are reused when the chunk text is identical (a release branch of the same repository) |
| `public` | the repository is public on its host: anyone in the org can join its index as a reader at once |
| `classification` | `restricted` for a private repository: a maintainer approves each reader, and it is never org-readable |
| `scip_producer`, `scip_checkout_dir` | the compiler-tier indexer (`clang`, `typescript`, `python`, `go`; unset, the tree's build files pick) and its working tree |
| `scip_producer`, `scip_checkout_dir` | the primary compiler tier (`clang`, `typescript`, `python`, `go`; unset, the tree's build files pick) and its working tree |
| `scip_extra_producers` | further compiler-tier producers over the same tree (a Python repository with a TypeScript frontend), each in its own checkout |
| `scip_excluded_producers` | compiler-tier producers never run although the tree has their build file (a `pyproject.toml` that only serves test tooling) |
| `git_extra_branches` | globs of other remote branches the shared mirror should carry |
| `github_token` | per-entry override of `LOOM_CODE_GITHUB_TOKEN` |
| `forge` | `forgejo` for a Forgejo host: its pull requests are read from the host's API |
Expand Down Expand Up @@ -482,15 +483,33 @@ index does.
| Python | `python` | `LOOM_CODE_SCIP_PY_DELTA_ENABLED` | scip-python (in the image) |
| Go | `go` | `LOOM_CODE_SCIP_GO_DELTA_ENABLED` | Go and scip-go (in the image) |

An entry that names no `scip_producer` gets every tier whose build file its tree
carries: `go.mod` (at any depth) for Go; `tsconfig.json`, `jsconfig.json` or
`package.json` at the root for TypeScript; a root `CMakeLists.txt` for C/C++;
`pyproject.toml`, `setup.py` or `requirements.txt` at the root for Python.
`code.index_status` lists them as `compiler_candidates`. Name the producer where a build
file is incidental, such as a C++ repository whose `pyproject.toml` only serves its test
tooling; `scip_extra_producers` adds tiers beside a named one. Each tier works in its own
tree: the named producer (C/C++ when the entry names none) in `scip_checkout_dir`, every
other one in `<scip_checkout_dir>.<producer>`.
An entry runs the tiers it names and every tier whose build file its tree carries:
`go.mod` (at any depth) for Go; `tsconfig.json`, `jsconfig.json` or `package.json` at
the root for TypeScript; a root `CMakeLists.txt` for C/C++; `pyproject.toml`,
`setup.py` or `requirements.txt` at the root for Python. `scip_producer` names the
primary tier and its checkout, and `scip_extra_producers` adds a tier the tree has no
build file for, such as TypeScript with no root `package.json`. Where a build file is
incidental, such as a C++ repository whose `pyproject.toml` only serves its test
tooling, list that tier in `scip_excluded_producers`. A tier the entry names runs even
when it is also excluded. An entry added through `code.repo.add` takes `scip_producer`
only, so it runs every tier its tree has a build file for.

`code.index_status` lists the tiers the tree calls for as `compiler_candidates` and
names the rule behind each tier in `compiler_tier_rules`: `scip_producer`,
`scip_extra_producers`, `tree` (the build file is in the tree and the entry does not
exclude it) or `scip_excluded_producers` (the tier does not run). A tier that stops
running, because the entry excludes it or the tree loses its last build file for it,
keeps its watermark. `compiler_tiers` shows no card for it, and neither
`commit_coverage` nor a coverage watch waits for it. `run_python_delta.sh` runs a
Python tier only when the entry runs it.

When a tree gains a build file, the tier starts on the next pass. A tier that never ran
indexes its modules in full, as a first run does. That costs build time and memory,
about 4 GB for each Go module job (`LOOM_CODE_SCIP_GO_JOBS`). A tier that ran before
resumes from its old watermark, or indexes in full when that commit has left the
history, and a commit waits on it until it catches up. Each tier works in its own tree:
the named producer (C/C++ when the entry names none) in `scip_checkout_dir`, every other
one in `<scip_checkout_dir>.<producer>`.

All the workers are enabled by default, and the Docker image carries every indexer:
scip-python, scip-typescript, scip-go, and for C/C++ clang 21, lld, CMake, ninja and
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/operations/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -962,12 +962,13 @@ Health of the code index: indexed head commit, compiler-tier commit, row counts,
| `provider` | `str` | |
| `profile` | `str` | |
| `compiler_candidates` | `list[str]` | Compiler tiers inferred from the indexed tree, even before a compiler worker has produced its first watermark. |
| `compiler_tier_rules` | `dict[str, str]` | Why each tier runs, by producer: `scip_producer`, `scip_extra_producers`, `tree` (a build file in the tree) or `scip_excluded_producers` (the entry drops it, so it is off). |
| `quality_warnings` | `list[str]` | Actionable readiness gaps. |
| `git_head` | `str` | The fast tier's watermark: the last commit whose files are ingested; '' before the first pass. |
| `scip_commit` | `str` | `scip_commit` / `scip_lag` are the ENTRY'S compiler tier — the one `scip_producer` names — not the C++ key by name; a TypeScript repository reports its scip-typescript watermark here. |
| `scip_commit_py` | `str` | The scip-python watermark by name, whatever the entry's primary tier; '' when unset. |
| `scip_producer` | `str` | The primary compiler tier's producer (clang \| typescript \| go \| python); '' when no tier has a watermark. |
| `compiler_tiers` | `list[CodeCompilerTier]` | Every compiler tier with a watermark or configured for the entry, the primary first. |
| `compiler_tiers` | `list[CodeCompilerTier]` | The entry's configured tier and every other tier it runs over its current tree that has a watermark, the primary first. |
| `tier_health` | `list[CodeTierHealth]` | The last recorded outcome of each tier that has one (fetch, ingest, the compiler tiers and the weekly C++ full run): a failing tier names its error kind, since when, and the fix. |
| `pr_cursor` | `str` | The PR-history poller's cursor: the newest `updated_at` (ISO-8601) of the merged PRs it fetched; '' before its first pass. |
| `commit_coverage` | `CodeCommitCoverage \| None` | Set when the request named a `commit`. |
Expand Down
14 changes: 10 additions & 4 deletions scripts/scip_harness/run_python_delta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ async def m():
cfg = next((r for r in configured_repos() if r.org == org and r.namespace == ns), None)
bare = os.path.abspath(cfg.git_dir or settings.code_git_dir) if cfg else ""
producer = cfg.scip_producer if cfg else ""
if cfg and settings.code_scip_py_delta_enabled and await worker_owns(repo, cfg, "python"):
owns = cfg is not None and await worker_owns(repo, cfg, "python")
if owns and settings.code_scip_py_delta_enabled:
owner = "worker"
elif producer in ("go", "typescript"):
owner = producer # its in-process worker moves this checkout
elif cfg and not producer and not await worker_owns(repo, cfg, "python"):
owner = "none" # the tree calls for no Python tier
elif cfg and not owns:
# the entry excludes the tier, or neither it nor its tree calls for one
owner = "excluded" if "python" in cfg.scip_excluded_producers else "none"
else:
owner = "manual"
print(org, ns, wm or "-", head or "-", bare or "-", owner)
Expand All @@ -99,7 +101,11 @@ PYEOF
exit 0
fi
if [[ "$OWNER" == "none" ]]; then
echo ">> $NS: the tree has no Python build file — no python tier"
echo ">> $NS: the tree has no Python build file and the entry names no python tier"
exit 0
fi
if [[ "$OWNER" == "excluded" ]]; then
echo ">> $NS: scip_excluded_producers drops the python tier, skipping"
exit 0
fi
if [[ "$OWNER" != "manual" ]]; then
Expand Down
1 change: 1 addition & 0 deletions sdk/go/wire/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/python/loom/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7572,6 +7572,7 @@ class CodeIndexStatusOutput(TypedDict, total=False):
provider: NotRequired[str]
profile: NotRequired[str]
compiler_candidates: NotRequired[list[str]]
compiler_tier_rules: NotRequired[dict[str, str]]
quality_warnings: NotRequired[list[str]]
git_head: NotRequired[str]
scip_commit: NotRequired[str]
Expand Down
6 changes: 6 additions & 0 deletions sdk/rust/src/wire_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11634,6 +11634,8 @@ pub struct CodeIndexStatusOutput {
pub profile: String,
#[serde(default = "default_code_index_status_output_compiler_candidates")]
pub compiler_candidates: Vec<String>,
#[serde(default = "default_code_index_status_output_compiler_tier_rules")]
pub compiler_tier_rules: std::collections::HashMap<String, String>,
#[serde(default = "default_code_index_status_output_quality_warnings")]
pub quality_warnings: Vec<String>,
#[serde(default = "default_code_index_status_output_git_head")]
Expand Down Expand Up @@ -68687,6 +68689,10 @@ fn default_code_index_status_output_profile() -> String {
fn default_code_index_status_output_compiler_candidates() -> Vec<String> {
serde_json::from_str("[]").expect("schema default")
}
fn default_code_index_status_output_compiler_tier_rules(
) -> std::collections::HashMap<String, String> {
serde_json::from_str("{}").expect("schema default")
}
fn default_code_index_status_output_quality_warnings() -> Vec<String> {
serde_json::from_str("[]").expect("schema default")
}
Expand Down
5 changes: 5 additions & 0 deletions sdk/rust/tests/registry_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11798,6 +11798,11 @@ fn code_index_status() {
serde_json::from_str::<serde_json::Value>("[]").unwrap(),
"code.index_status:compiler_candidates"
);
assert_eq!(
encoded["compiler_tier_rules"],
serde_json::from_str::<serde_json::Value>("{}").unwrap(),
"code.index_status:compiler_tier_rules"
);
assert_eq!(
encoded["quality_warnings"],
serde_json::from_str::<serde_json::Value>("[]").unwrap(),
Expand Down
1 change: 1 addition & 0 deletions sdk/typescript/src/generated/ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ export interface CodeIndexStatusOutput {
provider?: string;
profile?: string;
compiler_candidates?: string[];
compiler_tier_rules?: Record<string, string>;
quality_warnings?: string[];
git_head?: string;
scip_commit?: string;
Expand Down
13 changes: 7 additions & 6 deletions server/cli/code_scip.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ async def _scip_full(args: argparse.Namespace) -> int:
cfg = _repo_cfg(args) # before declaring the org: an unconfigured entry records nothing
await connect_code_plane(get_client(), args)
org, ns = _identity(args)
# scip-full runs scip-clang; an entry another compiler tier owns (Go,
# Python, TypeScript) is that worker's to re-index, and its checkout is
# the worker's to fetch. Same ownership test the delta pass applies.
# scip-full runs scip-clang, only for an entry that runs the clang tier: the
# same ownership test the delta pass applies.
from server.code.app.index.producer_inference import worker_owns
from server.code.store.index import CodeRepo

if not await worker_owns(CodeRepo(), cfg, "clang"):
producer = cfg.scip_producer or "inferred"
print(f"skip {ns}: its compiler tier is {producer}, not clang; that tier's worker owns it")
_note(skipped="not_clang", producer=producer)
print(
f"skip {ns}: the entry does not run the clang tier "
"(not named, excluded, or no root CMakeLists.txt in its tree)"
)
_note(skipped="not_clang", producer=cfg.scip_producer or "inferred")
return 0
# The whole entry runs under its lock, so a delta skips this entry while
# the checkout moves and the watermark is written; other entries' deltas
Expand Down
6 changes: 5 additions & 1 deletion server/code/api/models_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ class CodeIndexStatusOutput(BaseModel):
# Compiler tiers inferred from the indexed tree, even before a compiler
# worker has produced its first watermark.
compiler_candidates: list[str] = Field(default_factory=list)
# Why each tier runs, by producer: `scip_producer`, `scip_extra_producers`, `tree` (a
# build file in the tree) or `scip_excluded_producers` (the entry drops it, so it is off).
compiler_tier_rules: dict[str, str] = Field(default_factory=dict)
# Actionable readiness gaps. Empty means the indexed fast/vector tiers are healthy;
# compiler candidates remain optional precision upgrades.
quality_warnings: list[str] = Field(default_factory=list)
Expand All @@ -161,7 +164,8 @@ class CodeIndexStatusOutput(BaseModel):
# The primary compiler tier's producer (clang | typescript | go | python); '' when no tier has
# a watermark.
scip_producer: str = ""
# Every compiler tier with a watermark or configured for the entry, the primary first.
# The entry's configured tier and every other tier it runs over its current tree that
# has a watermark, the primary first.
compiler_tiers: list[CodeCompilerTier] = Field(default_factory=list)
# The last recorded outcome of each tier that has one (fetch, ingest, the compiler
# tiers and the weekly C++ full run): a failing tier names its error kind, since
Expand Down
3 changes: 2 additions & 1 deletion server/code/app/coverage_watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ async def handle_code_coverage_watch(input: CodeCoverageWatchInput) -> CodeCover
if watch is None:
watch = svc.new_watch(org, ns, sha, input.inbox, _caller_subject())
await repo.insert_watch_version(watch)
coverage = await svc.coverage_for(cfg, sha, await CodeRepo().all_state(org, ns))
state = await CodeRepo().all_state(org, ns)
coverage = await svc.coverage_for(cfg, sha, state, await svc.running_tiers(cfg, state))
emitted = False
if coverage.get("ready") and watch.delivered_at is None:
emitted, watch = await svc.deliver(watch, coverage)
Expand Down
25 changes: 23 additions & 2 deletions server/code/app/index/compiler_tier.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ async def run_entry(repo: CodeRepo, cfg: RepoConfig) -> None:
with record_pass(worker) as rec:
repo = CodeRepo()
for cfg in configured_repos():
if not await worker_owns(repo, cfg, producer):
await tier_health.forget(repo, cfg.org, cfg.namespace, not_run)
if not await _owned(repo, cfg, producer, not_run, worker, result):
continue
erased = await erasing.being_erased(cfg.org, cfg.namespace)
if (
Expand Down Expand Up @@ -163,6 +162,28 @@ async def run_entry(repo: CodeRepo, cfg: RepoConfig) -> None:
return result


async def _owned(
repo: CodeRepo,
cfg: RepoConfig,
producer: str,
not_run: tuple[str, ...],
worker: str,
result: TierResult,
) -> bool:
"""Whether the tier runs the entry. One it does not own drops the `not_run` health
records. A failed read of its tree is the entry's error and leaves them as they are."""
try:
owns = await worker_owns(repo, cfg, producer)
except Exception as e: # one entry's tree read must not stop the pass
logger.exception("%s: %s ownership read failed", worker, cfg.namespace)
result.errors.append(f"{cfg.namespace}: tree read failed: {type(e).__name__}")
pass_context.note_failure(e, cfg.namespace)
return False
if not owns:
await tier_health.forget(repo, cfg.org, cfg.namespace, not_run)
return owns


async def _gc_checkout(cfg: RepoConfig, producer: str) -> None:
import asyncio

Expand Down
16 changes: 4 additions & 12 deletions server/code/app/index/mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
restrict_if_restricted,
)
from server.code.app.index.mirror_locks import fetch_lock_path, partial_mirror, try_lock
from server.code.app.index.producer_inference import PRODUCERS
from server.code.app.index.producer_inference import PRODUCERS, runnable_producers
from server.code.domain.index import repos
from server.code.store import index as code_store
from server.core import readiness
Expand Down Expand Up @@ -482,17 +482,9 @@ async def _named_paths() -> tuple[set[str], set[str]] | None:
logger.info("mirror sweep skipped: registry unreadable (%s)", e)
return None
mirrors = {c.git_dir for c in cfgs} | {repo_registry.git_dir_for(str(r["repo"])) for r in rows}
# An entry naming no producer runs whichever tiers its tree calls for, so every
# tier's tree is named; one naming its producer runs that tier and its extras.
checkouts = {
repos.checkout_for(c, p)
for c in cfgs
for p in (
(c.scip_producer, *c.scip_extra_producers)
if c.scip_producer
else (*PRODUCERS, *c.scip_extra_producers)
)
}
# An entry runs the tiers it names and whichever others its tree calls for, so each
# tier's tree is named but a tier the entry excludes.
checkouts = {repos.checkout_for(c, p) for c in cfgs for p in runnable_producers(c)}
for r in rows:
base = repo_registry.checkout_dir_for(str(r["namespace"]))
checkouts |= {base, *(repos.sibling_checkout(base, p) for p in PRODUCERS)}
Expand Down
Loading
Loading