Repository navigation
code.symbol and code.grep lead with each definition's callers, test coverage and changing PRs - #2048
Merged
Merged
Conversation
…overage and changing PRs The answers a text search cannot give sat behind three other ops. Both ops now start with a `lead` block for up to three definitions: callers one hop across virtual dispatch (code.callers), test evidence and measured coverage (code.coverage_claim) and the PRs that changed the definition (code.symbol_history). Each leg is its op's handler called in-process as the consumer `symbol_lead` or `grep_lead`. The legs run concurrently under the effective budget of the op's new `lead` shape less the time already spent; a leg still running or failed reads `unread` and notes a degradation, and the answer is served on time. `lead: false` leaves the block out; Loom's own callers of the two ops opt out, and code.edit_context never builds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… pool The lead's statements run in a new best-effort lane of the ClickHouse client: between them they hold at most an eighth of `ch_pool_maxsize` (8 of the default 64) process-wide, and a statement that finds no slot free at once raises BusyError before it is sent instead of waiting, so the request's own reads keep the pool. A leg refused that way reads `unread: busy`. The block covers one definition (three legs a call, not nine). The callers and history legs read it by symbol id. Each leg passes the history policy gate its op has (`unread: policy` on a deny). The legs start inside a statement bound at the wall plus a margin and outside code.grep's caller-shaped block. code.grep subtracts the reserve from the caller's deadline and leads with the definition its pattern names. A leg another block of the answer reads (callers and tests beside `neighbours`, callers beside a uses brief) is left out. A `token_budget` the block does not fit beside the uses block withholds it whole. Legs that did not answer are named in `lead_unread` on the trace row and the span. The plugins' code shunt and prompt pack and the dashboard send `lead: false`; both plugin manifests move to 1.2.151. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ndred ms The best-effort lane now carries the wall's deadline, so a leg's statements stop near the wall on ClickHouse and in the client. Work a leg starts for others leaves the lane and that deadline: a grant-cache load other requests join, and tasks from TaskSet.spawn and create_deferred_task (`ch.shared_context`). A statement_timeout() around the block, such as a lease's bound, still reaches them. The history policy gate runs before the leg enters the lane and runs to its end when the wall cancels the leg, so a flush of the process's queued events is never cut. The `lead` budgets are the op's own plus a few hundred ms: code.symbol 600 ms, code.grep 1000 ms. They are priced, not measured, and the budget overrides raise them. When no leg can start, the block is left out and nothing is noted. code.symbol fits the block after the first definition's card and leaves it out when the answer does not serve its definition. code.grep picks the definition whose name the pattern holds as a whole identifier. The lead module handles one definition only, sizes its pool share once and retrieves a leg that raised after its call was cancelled. The assistant's first code lookup sends lead: false, and a test requires every caller inside Loom to pass `lead`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
One call's legs gathered 9 reads at once over an index that resolves the definition and holds nothing else, more than the 8-slot lane, so a single call read `busy`. A call's legs now share a width of half the lane; a statement past it waits for its own call's slot, never for the pool's, and two calls fit. A refused read inside a leg could be kept as every request's answer: the schema guard's ledger refresh, the override-edge and constructor-edge probes, and the tracker-link snapshot ran in the lane. They run outside it (`ch.shared_work`). The lane deadline is an instant: each statement is bounded by what is left of it. The block is fitted after the definitions, so it takes only what they leave of `token_budget`. A leg another block serves is dropped when that block serves it: code.grep skips it when its neighbours block has the definition, code.symbol drops it at assembly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…-block The plugins' version is one past main's and past the one another open PR holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 801e3b2. Configure here.
A leg was dropped when the neighbours block or the uses brief seemed to serve it, but neither does: the brief holds direct edges only and a hub brief none, so an override's callers through its base were lost, and a neighbours entry has neither dispatch callers nor a coverage verdict. The overlap is at most three caller rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…spans stay out of its op's stages The history leg read 10 PR rows and dropped those whose diff does not name the definition, while `prs` counts the whole window, so it could answer 37 PRs and no row. It now reads the op's most, 60. The legs reported into the op's stage wall, so coverage_claim's and symbol_history's resolve spans added to code.symbol's `resolve`. Each leg starts a wall of its own; the op's table holds the leg under its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…m has a width With no statement_timeout() scope, what was left of the lane's deadline replaced the class default instead of capping it, so a read class bound below the wall was raised to it. An unbounded class still takes what is left. `width` is required: the one caller sets it, and the tests now take the path it takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… own limits The pages said every process-wide fill leaves the lane, but the coverage positive control fills inside it, safely, since it keeps only reads that answered. They also said every leg statement stops near the wall, but the history leg's tracker reads go through the tracker source's own client and keep its limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ashboard ask for no lead block Each of one call's 27 lane statements is refused in turn, over an index whose probes answer yes, and every process-wide cache must then hold what a call with no refusal leaves, or nothing. It runs in about a second and fails when the schema guard or the override-edge probe fills inside the lane. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… caps a bound The block covers the first function, method, class or type definition outside test files and documents; code.grep's field names every case with no block. The lane page says every claim has a width, that the deadline caps a statement's bound rather than acting as a statement_timeout(), and that the tracker-link snapshot keeps no refused read: it refreshes outside the lane so a refusal neither logs a warning nor leaves its call on the previous snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ads busy end to end The deadline tests read `time.monotonic` from a ManualClock and assert exact bounds instead of racing the wall clock. The refusal sweep now also requires each run to read exactly one leg as busy, through the real handlers, whether the op swallowed the refusal or not. A handler that fails before joining its legs cancels the lead task with the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The leg asked code.coverage_claim for 3 rows, and the op reads three times its limit per evidence class and counts `tests` over what it read, so a definition with 15 linked test files read 9. It now asks at the op's default limit; a test over 15 mapped files compares the leg with the op through the real handler. The refusal sweep's coverage positive control answers yes, so a refused control read kept as `no` shows. The Python SDK's CodeClient.symbol() and grep() take `lead` and send `lead: false` only when it is false. The descriptions say grep's block falls back to the first qualifying definition, `token_budget` covers the block, the block is absent when no time is left to start a leg, and the docs give the lane's share at the default pool size with its floor below 16 slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…all's shape code.symbol_history counted the touching PRs of its 120-PR window but served at most 60 rows, so a definition whose only touching PR was the 61st to 120th newest read `prs: 1` with an empty `top`. The op's `limit` now reaches its window (PR_WINDOW, in the domain) and the history leg asks for all of it. The legs' wall started from the 600 ms `lead` budget even for a lookup priced at `ranked` (3000 ms) or `uses_brief` (1500 ms), so a ranked lookup whose ranking took most of 600 ms got no block. The handler now knows the shape before the legs start, bounds the wall by that shape's budget and prices the request by the same shape. The tracker source registry refresh runs outside the lane, as the tracker-link snapshot does. Trace rows name `lead: false`. The code shunt's denial, the loom-code skill and the overview point to a plain code.symbol call for callers instead of `uses_brief`. The feature page says lead legs write no agent_events row, so a history rule meant to count them names code.symbol or code.grep, and gives the wall by shape instead of an unmeasured latency. The fixed numbers the lead added say why they are not settings, the reviewed hashes of the shunt hook and prompt pack are renewed (each adds only `lead: false`), and the feature page's two new tables are lists so its translated pages' cells stay in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s at boot A lead leg's policy gate reads the op registry. In a test process that had not imported it, the first code.symbol with the block imported it inside the call, and the definition's lessons read timed out at its 0.5 s bound; the integration conftest now imports the registry once per session. The two wall_s patches in test_code_plane take any arguments, since the wall now takes the call's shape. The plugin text says a plain code.symbol lead counts the callers and lists the first three, with code.callers for all of them or more hops. The feature page keeps the budget per shape, how to raise it and what busy means, and links the ClickHouse page for the share and the work outside the lane, which now also names the policy gate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The lessons read after the code.grep handler was bounded by code_enrich_timeout_s and the caller's deadline_ms only, so a default grep whose legs ran to the wall could end about 0.4 s past its 1000 ms price. A grep priced by its block now reads its lessons in what is left of that budget, the reserve its legs leave; a grep without a block keeps the read's own bound. The block covers a Java record declaration. The grep replay harness replays a trace row's lead and imports the op registry before its run. The caller check's docstring says a dict held in a variable is not read, and a self-check pins the literal forms it reads. The architecture page's code.grep and code.symbol rows name the legs and the lane, and the lane paragraph gives the share for an unbounded pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
No leg starts on a wall under MIN_LEG_WALL_S (0.1 s, about the slowest leg's local p50 and a margin). Under it each leg read `deadline` while the call was priced by its `lead` budget; the call now serves no block, keeps its base price and its lessons keep code_enrich_timeout_s. code.grep's wall, and its cap at deadline_ms, reserve the lessons read's own bound (code_enrich_timeout_s) instead of 100 ms, so the read that runs after the handler keeps that bound however long the legs run. code.symbol keeps RESERVE_S. A leg builds its op's input inside its `try`: a name past the op's bound (300 characters for coverage and history) reads `unresolved` with no degradation note, as a direct call would refuse it. Any other validation error still reads `failed`. definition_leads takes `agent` and `user_id` in place of the op's input. The feature page says a tracker statement can keep running on the tracker's server after the wall, and two long lines are rewrapped. Tests: the floor (no block, base price, the lessons' own bound through the real _grep_lead), a 0.3 s lessons read served after legs that run to the wall, a name over 300 characters, and, through code.symbol with auth on, a restricted tracker namespace the caller may not read and a token pinned to one user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
code.symbol prices a lookup whose legs did not run (`lead: false`, which the plugins send, a wall under the floor, or a definition `min_fan_in` filters out) as the op does without the block: `ranked` by the change at hand, `uses_brief` only when the brief is served, the base budget otherwise. A `lead: false` lookup whose brief `token_budget` withheld was priced at `uses_brief`. When `min_fan_in` filters out the block's definition, the legs are cancelled once the filter has run, so the call no longer waits for a block `code_lead.fit` would withhold, nor is priced by it. The feature page and the `lead` budgets' catalog comment point only to a multiplier in `latency_budget_overrides`: `admin/budget.set` sets one fixed budget for every shape of an op. code_enrich_timeout_s's comment says code.grep holds it back from its `lead` budget, so a value near that serves no block; the settings reference, schema and example are regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The span keys keep both `lead_unread` and main's `at_dropped`; the Go and Rust wire models are regenerated over the merged ops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…de the lane The shielded policy gate can end after the wall cancelled its leg, when nothing awaits it: asyncio.shield drops its inner callback once the outer wait is done, so a raised deny was logged as never retrieved. `_policy` now returns False on a deny and `_leg` reads it as `policy`. The history leg's tracker binding gate read the namespace classification and the caller's grant inside the best-effort lane. A full lane refused them, the gate failed closed with a logged error, and a caller holding the grant got the history without the tracker. `_gated` now reads them in `ch.shared_work()`. The grep lessons tests run on a manual clock and assert exact seconds, and the min_fan_in test asserts the block was cancelled instead of timing the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
code.grep held back `code_enrich_timeout_s` from its lead wall on every call, though `lessons_for` skips the lessons read for `include_lessons: false`, with `code_result_lessons` off and for a narrowed token. A default grep with `include_lessons: false` that had spent 0.1 s gave its legs 0.4 s instead of 0.8 s, so a 0.5 s callers leg read `deadline` in a call priced at 1.0 s. `result_lessons.lessons_read` is now the one check for whether the read runs, and `lessons_for` uses it too. `_grep_lead` reserves the read's bound only when it is true, else `RESERVE_S`, and passes the reserve to `definition_leads` and `wall_s`; `lead.reserve_s` is removed. The client-hygiene test drops two asserts the refusal and the driver's calls already prove. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
`definition_leads` returned an entry whenever a leg started, so a call whose legs all read `busy`, `policy` or `unresolved` straight away was priced by its `lead` budget (600 or 1000 ms). A 400 ms code.symbol in a full lane was priced at 600 ms; the same call with `lead: false` is flagged past its 250 ms base budget. A best-effort claim now records that one of its statements held a lane slot (`BestEffortClaim.held`). `definition_leads` returns a `Block` of its entries and whether a leg ran: one held a slot or ran until the wall. code.symbol and code.grep price the `lead` shape only when it did, and still serve the block. code.symbol and code.grep no longer stamp an empty `lead_unread` span attribute when every leg answered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Both plugin manifests conflicted on the version: main is at 1.2.158, so this branch's move goes to 1.2.159. Every generator rerun changed nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Unpacking the lead `Block` where the handler awaits it keeps the `fit` call on one line, so the handler stays at 200 lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The local in `_with_retry` was `held`, the same name as the `BestEffortClaim.held` flag it carries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Conflicts: - binding._gated authorizes through authz.row_reach and notes an unverified or failed gate, as on main, with the check inside shared_work(). - result_lessons._bound_s returns what narrows the read (None for the fixed bound, as on main); a code.grep priced by its lead block also counts what is left of that budget. - The override-edge and constructor-edge probes cache main's noted failure, and their reads run inside shared_work(). - Plugin manifests at 1.2.176; session_content_senders pins the merged sources; the Go and Rust wire models are regenerated; the code-index table keeps main's code.search row and the lead rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The note is the handler's own step, so it goes through partial, and a failed leg passes its error, which degraded shows as for any other note: a Loom error's code and message, another error's kind. The transports now put the request's notes on every response, so the docstring and the feature page say the response's degraded names the leg. A scan fails on any note(..., health=False) left in server/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… in degraded A leg cut by the lead wall or by the call's deadline_ms is the call's own budget working, and a policy deny is the operator's rule working, so neither is a fallback. Each still reads `unread: deadline` or `unread: policy` in the entry, lead_unread and the span. A failed leg, and a busy one that the lead's fixed share of the pool left unread, are still listed. Two cases pin the code.grep lessons bound under the lead shape. The tracker binding gate holds only its row_reach read in shared_work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…-block Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> # Conflicts: # sdk/go/wire/models.gen.go # sdk/rust/src/wire_models.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part of: #2040
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
code.symbolandcode.grepstart their answer with aleadblock: for the definition found, its callers (through overrides), its test coverage and the PRs that changed it, read in the same call as best-effort work that stops at what the call's latency budget leaves (600 ms in all for a plaincode.symbol, 1000 ms forcode.grep);lead: falseleaves it out.code.symbol_historyserves up to 120 PRs (limit, was 60), every PR it reads. Update the Claude Code and Codex plugins to 1.2.176: older plugins do not sendlead: false, so their code shunt and prompt pack wait for the block and the prompt pack's 600-token lookup carries it. Plugins 1.2.176 need the next server release, which serveslead: against an older server their code shunt andloom-codeskill name aleadblock for callers that the server does not return.Why
Item 4 of the issue. Agents answered plain lookups with a local text search and called Loom a few times per session at most, because the ops they did call (
code.symbol,code.grep) returned what a text search returns: the definition and the lines. The answers a text search cannot give sat behind three other ops: callers across virtual dispatch (code.callers), measured test coverage (code.coverage_claim) and the function-level PR history (code.symbol_history).code.symbolandcode.grepalready hold the resolved definition those ops key on, so they now lead with those answers by default.Design:
server/code/app/lead.pycalls the three handlers in-process with the consumersymbol_leadorgrep_lead, the waycode.review_briefcalls its ops. The numbers are the ones each op gives, and the trace rows can be told apart. No query is duplicated.recordincluded) outside test files and documents, the kinds a caller, a test or a PR can reach (variables, fields, macros and document sections are skipped). One, not three: an exact name resolves one definition in the common case, the others an answer lists are a call away bypath:line, and each more definition would add three legs and their statements to every call.code.symbolit is the first definition the name resolves to. The legs start with the body reads, beforemin_fan_in,sort_by: fan_inandtoken_budgetpick what is served, so the block is left out when the answer does not serve its definition. Whenmin_fan_infilters that definition out, the legs are cancelled as soon as the filter has run, so the call neither waits for them nor is priced by them. Starting the legs after that pick would add the fan-in read to every call's latency.code.grepit is the first-page enclosing definition whose name the pattern holds as a whole identifier (read_allforreader.read_all(, notread), else the first.code.coverage_claimdoes.symbol,path,lineand three compact answers, each with a few counts and at most three rows with paths:callers{count, files, through_overrides, dispatch, top, truncated, epistemic},tested{verdict, tests, strongest_tier, measured, top},changed_by{prs, level, fixes, reverts, top}. Call sites reached through an override sort first and registrations last. PRs whose diff the tracker read and found not naming the definition are left out, and those that name it sort first.neighboursblock and the uses brief hold direct edges only (a hub brief none), with no callers through dispatch and no coverage verdict or measured state, so neither answers what a leg answers; the overlap is at most three caller rows.code.symbol_historyfor every PR of its window (PR_WINDOW, 120), drops those whose diff the tracker read and found not naming the definition, and keeps three.prscounts the touching PRs of the whole window, so a leg that read fewer rows could show an emptytopbeside a non-zeroprs: at 60 rows, a definition whose only touching PR is the 61st to 120th newest of its file read{"prs": 1, "top": []}. The op'slimitstopped at 60, below the 120 rows it reads and counts, so its bound moves to the window (one constant,server/code/domain/index/symbol_history.py). Those rows are already read; only the serialized answer grows.code.coverage_claimat its defaultlimit(20). The op reads three times itslimitper evidence class and countstestsover what it read, so a smaller one would captests(9 at alimitof 3) and could weakenstrongest_tierand the verdict. The leg'stestsis the op'stests_total.lead.<leg>span, so the op'sstage_msholds each leg once, under its name, and a leg op's ownresolveno longer adds to the parent's. The request's work bag (code_stage_ms, the event row's stage columns) counts every span's time, the legs' own spans included; its comment says so.leadfirst on the wire and leave it off when empty.Load: the block is best effort, and its share of the server's ClickHouse capacity is bounded, not removed.
server/core/ch.pygains a best-effort lane (best_effort(),BestEffortSlots,BestEffortClaim,BusyError). Every statement a lead leg sends through it counts against one process-wide share of the pool:ch_pool_maxsize // 8, at least one slot, so 8 of the default 64 slots (8 when the pool is unbounded). A statement past that share, or one that finds the pool with no slot free at once, raisesBusyErrorbefore it is sent, without thech_pool_wait_mswait a request's own read takes. The leg reads{"unread": "busy"}. An eighth leaves the requests' own reads seven eighths of the pool and still lets two calls' legs run at once; it needs no new setting.call_slots(), at least one, 4 at the default; the claim'swidth). The two-calls figure holds from a 16-slot pool up: below that the share is one slot and one call takes it whole. A statement past that waits for one of its own call's slots, up to the wall, and never for the pool. Sobusymeans other calls hold the share or the pool is full, not that the call outran its own share. Measured with the real leg handlers on a realCHClientover a fake driver whose index resolves the definition and holds nothing else (no callers, tests or PRs): one call's legs gather 9 statements at once and about 30 in all. Before the width, the 8-slot share refused one of them, and a single call alone readtested: busy. With it, one call holds 4 and two calls at once hold at most 8, and every leg answers. 9 is a lower bound: an index with callers, tests and PRs can gather more, and the width caps it either way.refusedflag and its leg readsbusytoo. Its answer is dropped rather than kept as partial: such an op answers as if the read found nothing (no callers, untested), so the numbers would be wrong, not short.max_execution_timeand client timeout is what is left of it, at least 1 ms and at most the statement's class bound, so ClickHouse stops a statement soon after the wall cancels its leg and a statement sent late is not given the whole bound again.server/core/ch.py, so they hold no slot of the share and keep that client's limits rather than the wall's. Loom stops waiting for one at 300 ms (a point read) or 900 ms (a text read), or when the wall cancels its leg, and on the tracker's server a statement can run to itsmax_execution_time(LOOM_TRACKER_LIVE_TIMEOUT_S, 1.5 s by default, or the read's 900 ms) after the wall.ch.shared_context()): a grant-cache load other requests join (grant_cache._shared_load), and tasks started byTaskSet.spawnandcreate_deferred_task(a leg's trace row, the policy decision row). Three fills awaited inline run outside the lane too (ch.shared_work()), since a refusal inside one would be kept as every request's answer until its next refresh: the schema guard's ledger refresh (schema_status, the pending tables) and the override-edge and constructor-edge probes (whose fail-closed answer is kept 30 s). The tracker-link override snapshot and the tracker source registry (refresh_db_sources, reached when a leg's tracker read finds its namespace's source not loaded yet) refresh outside the lane as well, for a smaller reason: a refused refresh keeps the previous snapshot and the time it was read, so the next request reads again, but each refusal would log a warning and leave that one call on the previous snapshot. A unit test refuses each of one call's 27 lane statements in turn, over an index whose probes and coverage positive control answer yes, through the real leg handlers. Each of the 27 runs reads exactly one leg asbusy, whether its op swallowed the refusal or not, and every process-wide cache holds what a call with no refusal leaves, or nothing; a fill a refusal stopped is read again by the next request. It runs in about a second, and fails when the schema guard or the override-edge probe fills inside the lane, or when the positive control keeps a refused read asno. That call does not reach the constructor-edge probe (its definition is no constructor); the refuse-everything test covers that one. The coverage positive control, the index revision and the auth caches keep only reads that answered and fill inside the lane. Astatement_timeout()around the block still reaches the spawned tasks: a lease'sholding()bounds every statement of the work under a claim, its deferred writes included, so no write outlives the claim. That is why the wall's bound lives on the lane rather than instatement_timeout().policy_gate.gate) the transports run for its op, with the request's identity; a deny reads{"unread": "policy"}. The gate runs before the leg enters the lane, so its statements are not counted in the share: the rule read, cached per namespace, and, when a rule applies to the op, theagent_eventsflush and the rule evaluation a direct call of that op runs. It runs to its end throughshielded()when the wall cancels the leg, because the flush sends the process's queuedagent_events(every request's) and a cancelled flush drops the batch. A deny is the gate's answer, not an exception (_policyreturns False): the gate may end after the wall cancelled its leg, when nothing awaits it, sinceasyncio.shielddrops its callback once the outer wait is done, and a raised deny there was logged as "Task exception was never retrieved". A deny that comes after the wall readsdeadline. The history leg's tracker binding gate (binding._gated: the namespace classification and the caller's grant on the tracker namespace, the grant read uncached) runs inside the leg's op and reads outside the lane too (ch.shared_work()): inside it, a full lane refused those reads, the gate failed closed with a logged error, and a caller holding the grant got the history without the tracker. The legs are not counted against per-op rate limits and write noagent_eventsrow of their own: the parent call is rate-limited and writes its event, and each leg's trace row carries its*_leadconsumer. So a rule leaf that reads past events (formerly,count_within,not_since) oncode.callers,code.coverage_claimorcode.symbol_historydoes not count lead legs; a rule meant to count them namescode.symbolorcode.grep. The feature page says so.code.grep's caller-shaped block: they run their ops' own reads, not ones the caller's pattern shapes.Latency: the legs run at once. In
code.symbolthey start with the body reads right after the name resolves; incode.grepthey start once the page's other reads are done. They share one wall: the effective budget of the shape the call is priced by (effective_budget_ms, so runtime and per-consumer overrides and the deployment multiplier apply), less the time the request has already spent, less a reserve for the rest of the answer: 100 ms incode.symbol(RESERVE_S). In acode.grepwhose lessons read runs after the handler, the reserve is that read's bound (code_enrich_timeout_s, 0.5 s), so the lessons keep the bound they have onmainhowever long the legs run. Acode.grepthat reads no lessons (include_lessons: false,code_result_lessonsoff, or a token narrowed below its namespaces) reservesRESERVE_S:result_lessons.lessons_readis the one check, whichlessons_formakes too, and_grep_leadpasses the reserve todefinition_leads.code.grepalso stops at the caller'sdeadline_ms, less the same reserve. No leg starts on a wall under 100 ms (MIN_LEG_WALL_S: the slowest leg's local p50 stage, 47 ms, and a margin). Under it each leg would readdeadlinewhile the call was priced by itsleadbudget, which would hide a call already past its base budget. The call serves no block instead, keeps its base price and its lessons keepcode_enrich_timeout_s. A grep priced by its block still reads its lessons in no more than what is left of that budget (request_time_left_s), so work in the handler after the legs cannot push the call past it. A grep without a block keeps the read's own bound, as onmain, since a budget bound there would drop the lessons of a plain grep already past its base budget. That bound is what the code enforces; the block adds no fixed latency on top of it.leadfor a plaincode.symbol(600 ms) and forcode.grep(1000 ms). Acode.symbollookup ranked bynear_pathsorpr_numberruns its legs under itsrankedbudget (3000 ms), and one that reads the uses brief underuses_brief(1500 ms): both rank or read before or beside the legs, so a wall from the 600 msleadbudget left a ranked lookup whose ranking took 550 ms no block while the request was priced at 3000 ms. The shape is known before the legs start (_call_shape), and the request is priced by the same shape, so the wall never outruns the price. One change in pricing follows, for a lookup whose legs ran: when its uses brief was read but then withheld bytoken_budget, or came back empty, it is priced atuses_briefrather thanlead, since the brief's read and the legs under that budget ran. A lookup whose legs did not run (lead: false, which the plugins send, a wall under the floor, or a definitionmin_fan_infilters out) is priced as onmain:rankedby the change at hand,uses_briefonly when the brief is served, the base budget otherwise.leadbudgets are declared from the ops' own:code.symbol600 ms (its 250 + 350),code.grep1000 ms (its 600 + 400). Each addition is about whatcode.callerstakes (400 ms declared), so that leg can answer in the common case;code.coverage_claim(1200 ms) andcode.symbol_history(1800 ms) answer when they are fast.code.grepgets 50 ms more thancode.symbolbecause its legs start only after the page's reads.{"unread": "deadline"}, and the rest of the answer is served on time. A deployment whose legs need longer raises the op's budgets with a multiplier inlatency_budget_overrides(LOOM_LATENCY_BUDGET_OVERRIDES;{"code.symbol": "2x"}scales every shape,leadincluded).POST /v1/admin/budget.setis not a way to do it: it sets one fixed budget for every shape of the op, so 1200 ms forcode.symbolwould lowerrankedfrom 3000 ms and raise the base from 250 ms. The catalog comment and the feature page say the same.MIN_LEG_WALL_S), the block is left out, no degradation is noted and the request keeps the budget it has without the block: the base budget, orrankedoruses_brieffor those lookups. A block whose legs all readbusy,policyorunresolvedbefore any of them held a lane slot is served, and the request keeps that same budget: the block counts as run (Block.ran) only when a leg's statement held a lane slot (BestEffortClaim.held, set by the client on a slot it took) or a leg ran until the wall, since only then did it add time. Priced by itsleadbudget, a 400 mscode.symbolwhose legs were all refused in a full lane would read as inside its 600 ms, where the same call withlead: falseis flagged past its 250 ms base budget. A request whose legs ran is priced at its shape's budget, even whentoken_budgetthen withholds the block.code_enrich_timeout_sis a live setting and is now also the reserve of acode.grepthat reads lessons. Set near the 1000 msleadbudget, it leaves such a call's legs no wall, so that call serves no block. Its field comment and the configuration reference say so. No degradation is noted then: a configured value is not a fallback.{"unread": "failed"}. A definition name longer than a leg op takes (300 characters forcode.coverage_claimandcode.symbol_history, which a direct call refuses too) reads{"unread": "unresolved"}with no degradation note: it is a known limit, not a failure. The leg builds its input inside itstry, and only a validation error that is allstring_too_longcounts as that; any other still readsfailed. Each kind of unread leg is named in the entry and in thelead_unreadtrace argument and span attribute. Afailedorbusyleg is also noted once on the request's degradations list (degradations.partial(...)), which the transports put on the response'sdegraded(code.symbol: lead_tested_unread (busy)): a failure, or a fixed server-side bound (the lead's share of the pool, or a full pool), left it unread. Adeadline,policy,ambiguousorunresolvedleg is named in the entry and the trace only: each is a limit working, not a fallback. A failed leg's note shows a Loom error's code and message, and provider health records nothing. A call withlead: falsewriteslead: falsein its trace row's arguments, forcode.symbolandcode.grep. A leg that raised after its call was cancelled is retrieved by a done callback, so it is not logged as lost.Tokens:
code.symbolbudgets the uses brief first, the definitions in what it leaves, and the block in what both leave; a block that does not fit is withheld whole, as the brief is. The block never takes a definition's place: every definition and bodylead: falseserves under a budget,lead: trueserves under the same budget.Alternatives considered: one new statement that joins edges, coverage and the PR ledger would answer faster but repeat three ops' logic and drift from them. Running the legs after the bodies would add their latency to every call. A semaphore per leg would bound legs, not statements; the lane bounds the statements a leg sends. Leaving out a leg another block seems to serve would save at most three caller rows and drop answers those blocks do not hold. A width per call smaller than half the share would leave room for more calls but make each call's legs slower when they gather the most. Clearing
statement_timeout()at every deferred spawn, instead of putting the wall's bound on the lane, would let a deferred write under a lease outlive its claim. Caching the block is left until a served p99 shows it is needed.Scope and risk
code.symbolor first-pagecode.grepcall now runs up to three more handler calls, each with its own ClickHouse reads, bounded as above.code.symbolorcode.grepfor their own purpose opt out withlead=False: memory code grounding, decision extraction, the presence and dependency-presence checks,code.edit_context's target lookup and itscode.symbolread, and the assistant's first code lookup, which opens its prompt. A unit test checks that every input built for either op insideserver/, whether by constructor,model_validate({...}), a by-name call with literal arguments ormodel_copy(update={...})of an input sent to another namespace, nameslead, since the unit-test stub would hide a forgotten opt-out. The plugins' code shunt and prompt pack and the dashboard sendlead: false: none of them shows the block, and the prompt pack's 600-token budget stays with the definitions.TaskSet.spawnandcreate_deferred_tasknow start their tasks outside any best-effort lane, and the schema guard, the override-edge and constructor-edge probes, the tracker-link snapshot and the tracker source registry run their fills outside it. Outside the lead, no lane is set, so their behaviour is unchanged.code.coverage_claimdoes. A row without a symbol id falls back to the name and can read{"unread": "ambiguous"}.code.review_brief,code.test_gateandcode.tests_for, which other items of the issue change.Compatibility, rollout and rollback
lead: bool = trueoncode.symbolandcode.grepinput (left out of the MCP tool schemas; the tool descriptions say the answer starts with aleadblock);lead: listoncode.symboloutput and oncode.grepoutput. The output modelcode.edit_contextshares withcode.symbolcarries the field, always empty; its comment says so. New budget shapes:code.symbollead600 ms,code.greplead1000 ms. Changed default: both ops' default answers include the block. The coding listing stays within its token ceiling.code.symbol_historylimitaccepts 1–120 (was 1–60), the PRs the op reads; the default stays 15.CodeClient.symbol()andCodeClient.grep()takelead: bool = Trueand sendlead: falseonly when it is false. The TypeScript SDK has no hand-written client for either op; its generated op types carrylead?. The SDK code tools'loom_code_lookup(Python and TypeScript) sends nolead, so its answer carries the block: that lookup serves an agent's tool loop, which the block is for.code.symboltext drops "uses_brief: truesummarizes callers" and the assistant's drops "uses_brief: trueadds the top call sites". The block'scallersnow answers what the hint pointed agents to, through overrides, and MCP always serves the block, sinceleadis left out of its tool schemas.uses_briefkeeps its field description in the schema for the longer list. The codingcode.greptext drops "at the same path and line" and "and notes" to stay within the listing ceiling: the coding listing is at its 9,100-token ceiling, so a restored hint would need other text cut.loom_code_symbol ... uses_brief: truefor callers; it now says a plainloom_code_symbolcall'sleadcounts the callers and lists the first three, and namesloom_code_callersfor all of them or more hops. Theloom-codeskill's "who calls X" row says the same, and the code overview's step 2 points to thelead. Both plugin copies, the served and standalone skill bundles are regenerated, at 1.2.176.lead, so against this server their code shunt (a blocking 2500 ms PreToolUse hook) and the prompt pack'scode.symbollookup (token_budget600) get the block and wait for its legs, up to theleadbudget. The prompt pack's lookup still serves the definitions it served, since the block only takes what they leave. Upgrade advice: update the Claude Code and Codex plugins to 1.2.176 or later. Both manifests move to 1.2.176, pastmain's 1.2.173. A plugin at this version talking to an older server sendslead: false, which that server serves and names inignored_args, but its code shunt's denial and itsloom-codeskill's "who calls X" row then name aleadblock that server does not return, where they nameduses_brief: true. So both plugins need the next server release, as the changelog entry says;MIN_SERVER_VERSIONstays at 1.4.0 here, and the release pull request raises it.leadbudgets can be raised with the budget overrides above.Tests
tests/unit/test_code_lead.py(markedcode_lead): definition selection (one, with its symbol id) and grep's whole-identifier pick; the pool share and the per-call width; the three compactions and their ordering. The legs through stubbed handlers:*_leadconsumer;lead0.6 s,ranked3 s,uses_brief1.5 s) through the realeffective_budget_ms, and{"code.symbol": "2x"}inlatency_budget_overridesdoubles each; the handler runs its legs under, and prices,rankedfornear_pathsand forpr_number,uses_brieffor the brief, also whentoken_budgetwithholds it;lead: falseonly when the call sent it, forcode.symbolandcode.grep;_grep_leadand the lessons wrapper, on a manual clock that moves only while every task waits (idle_time, withtime.monotonicandtime.perf_counterpatched), so each call's seconds are exact: a grep whose legs hang to the 0.3 s wall still serves a lessons read that answers in 0.3 s and ends at 0.6 s (fails with a 100 ms reserve, which leaves it 0.1 s); with 0.3 s of handler work after the legs and a lessons read that never answers, the call ends at its 0.8 s price (1.1 s without therequest_time_left_sbound); a grep that reads no lessons, withinclude_lessons: falseand with a token pinned to one user, holds backRESERVE_S: after 0.1 s of other reads a 0.5 s callers leg answers inside the 0.8 s wall and the call ends at 0.9 s (fails when the grep always reserves the lessons bound, which leaves the leg 0.4 s, and, for the pinned token, when the check leaves out narrowing);MIN_LEG_WALL_Sstarts no leg and serves no block, and through the real_grep_leadkeeps the base price and the lessons' own bound: a 0.3 s lessons read is served, and the call ends at 0.3 s, where the 200 msleadprice would cut it (fails without the floor);unresolvedin the coverage and history legs, with no degradation note, while the callers leg answers;recorddeclaration is a definition the block covers;lean_result,lean_code) first and whole for both ops, every key of every leg included (fails whenlean_codedrops it);code.coverage_claimhandler on a realCHClient, the coverage leg'stestsandstrongest_tierequal the op's at its defaultlimit(alimitof 3 reads 9);symbol()andgrep()sendlead: falseonly when asked;resolve;unread, and only the failed one is listed indegraded;Block.ranover a realCHClient: false when every leg is refused at once, true when one leg's statement held a lane slot and when one leg ran to the wall (fails when the client does not record the slot it took);_grep_leadand throughcode.symbol, a block whose legs are allbusy, allpolicy, allunresolvedor one of each is served with those reasons and keeps the base price,lead: false's, and a control whose callers leg runs to the wall is priced bylead(fails when every block counts as run, and when either op prices by the block's entries);lead_unreadis left off the span when every leg answered, for both ops, as it is off the trace row (fails with the empty attribute);BusyErrorand a swallowed refusal readbusy, and a policy deny readspolicy, with every leg passing the gate with the request's identity;gc.collect()after the gates end, a gate that denies after the 0.1 s wall logs nothing and its leg readsdeadline, and one that denies inside the wall readspolicy(fails when the deny is raised: "Task exception was never retrieved");max_execution_timeof what is left of wall plus margin (exactly 0.75 s for a 0.5 s wall, on a manual clock) and no caller-shaped setting even undercaller_shaped();cap_scaps the wall; the wall arithmetic, withRESERVE_Sunless the caller names its reserve;The lane with the real leg handlers on a real
CHClientover a counting fake driver: one call's legs hold at mostcall_slots()(4) at once and every leg answers; two calls at once both answer and hold at mostlead_slots()(8). Refusing each of one call's lane statements in turn reads exactly one leg asbusyand leaves no process-wide cache holding what a call with no refusal does not. With a lane that refuses every statement, a leg's call still runs the schema guard's ledger refresh, the override-edge and constructor-edge probes, the tracker-link snapshot and the tracker source registry refresh outside it: each answers from the driver,schema_statusholds no error and no pending table, the snapshot is stamped and the registry holds its source (fails with the registry read inside the lane).As the caller, through
code.symbolwith auth on and the real leg handlers over the fake driver:level: file, no PR marked as naming the definition); a token that also names the tracker namespace gets the tracker's read (level: function, the PR it names first);authorized_tracker_namespace): the tracker gate's classification and grant reads are sent outside the lane, nothing at WARNING or above is logged, and the caller who holds the grant gets the tracker namespace (fails with the gate's reads in the lane: the classification read is refused, logged as an error, and the gate denies);read_user_id): every leg sends a query its op's transport admits for that token (gates.read_scope) as that user, atcode.symbol's role, every leg answers, and no statement reads a memory table.Through the handlers:
code.symbolleads by default and notes theleadshape, and passes the call'sagentanduser_idto the legs (ascode.grepdoes);lead: falseandcode.edit_contextbuild no block; a handler that fails before it joins its legs (a fan-in read that raises) cancels the lead task with the others (_SymbolLegs.cancel()); beside aneighboursblock or a uses brief the block keeps all three legs; for everytoken_budgetfrom 40 past the whole answer in steps of 25, sorted by score and by fan-in (the block's definition second),lead: trueserves the definitions and bodieslead: falseserves, and the block once they leave room for it;min_fan_infiltering out the block's definition while another is served leaves the block out and cancels it rather than run its legs, which hang, to the 2 s wall (fails without the cancel: the block runs to its wall and the call is pricedlead), at the base price; a lookup whose legs did not run, withlead: falseand with a wall under the floor, is priced asmainprices it: the base budget,rankedfornear_pathsand forpr_number,uses_briefwhen the brief is served and the base budget whentoken_budgetwithholds it (fails at the previous head, which priced thatlead: falselookup atuses_brief);code.grepthroughhandle_code_grepleads with the definition its pattern names, notes theleadshape, caps the wall atdeadline_msless the reserve, and builds no block withlead: false, without bodies, on a continuation page or for a related answer. An AST check finds every in-process caller of either op and requires aleadargument: constructors,model_validate({...})and("code.symbol", {...})with a dict literal, and copies sent to another namespace. A self-check pins each form it reads; a dict held in a variable cannot be read without running the code, which the docstring says, and no caller inserver/outside the transports builds an input that way (the assistant's model tool calls go through the op transport, as an agent's do).tests/unit/test_ch_client_hygiene.py: a best-effort statement past its share is refused at once and never reaches the driver while a request's own read runs; a full pool refuses one without thech_pool_wait_mswait; a caller's statements past its width wait for its own slots; a statement cancelled while it waits for its width releases nothing, and one cancelled in flight gives its width back; a statement is bounded by what is left of its deadline, which caps a class bound below it and never raises it (on a manual clock, with exact values); a best-effort statement cancelled mid-flight gives its share and its pool slot back;TaskSet.spawnandcreate_deferred_taskinside a lane run outside it while a surroundingstatement_timeout()still applies.tests/unit/conftest.py: an autouse fixture keeps the block empty in unit tests not markedcode_lead, since its legs open their own repositories and would reach a ClickHouse listening on the host.tests/integration/test_code_plane.py: the grep and symbol tests assert the block for the fixture'sDB::Squasher::squashImpl(its callerDB::Squasher::flush, every leg answered); two of them pin the wall withlambda *_args: 30.0.tests/integration/conftest.py: a session fixture imports the op registry, as the server does at boot (server/transport/http.py). A leg's policy gate reads the registry, so in a test process that had not imported it the firstcode.symbolwith the block imported it inside the call (about 0.7 s on the event loop), and the definition's lessons read timed out at its 0.5 s bound:test_memory_code_links.py::test_a_rename_alone_moves_the_linkfailed alone, and whenever it made the run's first such call. CI's shard passed it because an earlier file had imported the registry. The server never pays that import inside a request.bench/code_grep_handler.pyreplays a trace row'sleadwith its other arguments and imports the op registry before its run, as the server does at boot.integrations/claude-code-plugin/tests/code-shunt-hook.test.mjs: the shunt'scode.symbollookup sendslead: false.frontend/src/api/code.test.ts: the dashboard'scodeSymbolsendslead: false. The prompt pack's is in the sharedcode-query-wire.jsonfixture.Updated:
tests/unit/test_shape_budgets.py,tests/unit/test_code_grep_scan.pyand the plugins'code-query-wire.jsonfixture.CI at c7c9204 failed two integration tests this change caused:
test_code_plane.pypatchedlead.wall_swith a two-argument lambda, which the shape argument broke (fixed here, above). CI at dff74b4 failed three unit tests, fixed at c7c9204:test_tunable_constants: the lead'sLEAD_ROWS,RESERVE_S,MIN_LEG_WALL_Sand_MARGIN_Sand the lane's_PAST_DEADLINE_Ssay why they are not settings (the block's documented shape; part of the wall eachleadbudget is declared for, which an operator raises instead; a floor under which a leg cannot answer; ClickHouse reads a 0 bound as no limit).PR_WINDOWmoves to the domain with its marker (the wire bound derives from it), and its old line leavestunable_constants.txt.test_session_content_senders: the code shunt hook and the prompt pack, in both plugins, each add only a fixedlead: falseto acode.symbolbody, so their exceptions' reasons hold; their four reviewed hashes are renewed.test_i18n: the translation check compares each present translation's table cells with the current English by position, stale pages included, so the feature page's two new tables shifted every later cell, and the stale translations'freshness.mdlink cells no longer lined up. The two tables are lists now, which keeps the page's cells as its translations have them. Any change that adds table cells above a protected cell of a translated page meets the same check.pyproject.tomlchange is a pytest marker); the Windows on Arm plugin job failed a timing check of the test-gate hook (1666 ms after its request), which this change does not touch; at dff74b4 the WSL job was cancelled at its 30-minute limit, and at c7c9204 it failed one timing test of the record hook (a detached flush job left in the sandbox), which this change does not touch either.Integration, run locally on a native ClickHouse 26.7 and a server from source in CI's main posture (auth off, fake providers, workers off, budget multiplier 10):
test_code_plane.py,test_mcp.py,test_mcp_code_identity.py,test_code_grep_needles_live_ch.py,test_code_grep_source_coordinates.py,test_code_reconciliation_parameters.py,test_code_result_lessons.py,test_code_search_token_budget.py,test_ch_reader_user.py,test_cross_principal_leakage.py,test_memory_code_links.py,test_restricted_namespace_leakage.pyandtest_search_statements_pass_analyzer.py, the files that callcode.symbolorcode.grep, at ddbb242: 391 passed, 1 failed, 43 skipped (no reader user, no code org, no end-user issuer, auth off). The failure was this change's, fixed intests/integration/conftest.py(above);test_memory_code_links.pythen passed whole (222 passed). At e57a6catest_code_result_lessons.py(4 passed) ran again on the same setup, at 60408d5, before the merge ofmainat 24950d9,test_code_plane.py(49 passed), and at d521cfa, after that merge,test_code_plane.pyagain (51 passed).Measured locally, on one index: this branch's
server/code/andtests/unit/test_code*(801 files, 22,546 symbols, 33,992 edges, 20,905 chunks). It holds no PR history and no imported coverage, sochanged_byreads no PRs andtestedreads name-mapped tests only (19 of 27 definitions had some). One laptop shared with other work, native ClickHouse 26.7, server from source at the default budgets (multiplier 1), auth off. 30 functions and methods with at least one caller, each called by qualified name (code.symbol) and as<name>((code.grep), once withleadand once without, alternating which goes first, after 3 warm-up calls per op. Times are client wall time; statements are thesystem.query_logrows carrying the call's request id. With 30 calls, the max stands in for p99.leadcode.symbolcode.symbolcode.grepcode.greplead_unread. Leg stage times, p50/max ms:code.symbolcallers 47/71, tested 40/64, changed_by 22/44;code.grep44/84, 37/51, 18/29. The onecode.symbolcall without a block isis_test_pathinserver/code/domain/index/test_gate.py, a file the test-path rule reads as a test, so no definition is picked.code_edges,code_symbolsandcode_symbol_names(callers),code_test_map,code_filesandcode_coverage_files(tested) andcode_pr_history(changed_by).latency_ms:code.grepwithleadp50 210 ms and p90 902 ms, against 70 and 524 ms without;code.symbol139 and 291 ms, against 44 and 181 ms. 4 of its 33code.grepcalls with the block readdeadlineat the 1000 ms wall (callers and tested in all 4, changed_by in 2), while those calls' own body reads took 200 to 285 ms.deadline: callers in all 6, tested in 5, changed_by in 3.code.coverage_claimandcode.symbol_historynever readdeadlinewithoutcode.callersreading it too; each time the whole call was slow. In a further 120 warmcode.symbolcalls, one spent about 490 ms before the handler started (690 ms at the client, 199 ms in the handler), so no leg could start and the block was left out.code.grep. Its wall is now 400 ms shorter when it reads lessons, as a default call does: at the default budgets, about 500 ms less what the request spent before its legs started. Every leg of the warm run answered within 84 ms. The 4 cold calls above, whose body reads took 200 to 285 ms, would now have had at most about 300 ms.The
rankedanduses_briefshapes, on the same index rebuilt from the same files (801 files, 22,546 symbols, 33,904 edges, 20,905 chunks) at the default budgets, after 120 warm-up calls: the same 30 definitions,rankedby short name withnear_pathsnaming the definition's file (24 names resolved one definition, 6 resolved two to six),uses_briefby qualified name withuses_brief: true; each once withleadand once without, alternating which goes first. The trace rows show each call priced by its shape.leaddeadlinelegrankedrankeduses_briefuses_briefNo leg read
deadlineor any otherunread. Theuses_briefcall without a block isis_test_pathagain.The block's tokens, by the repo's estimator (
estimate_json_tokens) on the served JSON: a defaultcode.symbolby qualified name and a first-pagecode.grepfor<name>(, the same 30 definitions. MCP leavesleadout of the tool schemas, so an MCP client always pays these tokens on both ops.code.symbolcode.grepThe whole answers were 597 tokens p50 (1,582 max) for
code.symboland 2,476 p50 (11,615 max) forcode.grep; both ops pick the same definition here, so their blocks are the same.claude plugin eval integrations/claude-code-plugin, for the skill change: its guard refused all 4 cases before any ran ("a git directory of the plugin registers more linked worktrees than can be screened"), at $0. It was not worked around.Ran:
tests/unit/test_code_lead.pythree times under-n auto -p randomlyat d41f6a4 (74 passed each; five times at d521cfa, 60 passed each), and each test d521cfa, dfe0fda and 01af491 add or rewrite against the code without its fix (each fails: the raised deny, the gate's reads in the lane, a 100 ms grep reserve, the kept block, a grep that always reserves the lessons bound, a lessons check that leaves out narrowing, every block counted as run, a client that records no slot, either op pricing by the entries, the empty span attribute). After the merges ofmainat 24950d9 (the span keys keeplead_unreadandat_dropped; the Go and Rust wire models are regenerated) and at eb98b9b (the plugin manifests, at 1.2.159), with every generator rerun changing nothing else, at 774a47d, the head beforemainwas merged at c8ba404 (Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047):make format-check,make lint(ruff, function-length gate at its baseline, every codegen--check),make mypy-gate(0 errors) andpytest -n 8over the code-lead, client-hygiene, schema-guard, dispatch, constructor-edge, tracker-binding,code.symbol,code.grep, callers, coverage, edit-context, presence, background, MCP listing, shape-budget, op-budget, token-budget, package-contract, plugin-contract, doc, copy, agent-instruction, auth-cache, tunable-constant, session-content-sender, i18n, tracker-source, history, lean-shape and skill tests (2761 passed), the settings reference, file, defaults and live-setting tests, with the copy and doc-link tests (346 passed), the SDK surface, consumer-identity, code-tools,code.symboluses, CLI snapshot, plugin and skill-bundle tests (271 passed), and, at ddbb242, Biome on the changed plugin files and the plugin's code-shunt and code-shunt hook node tests (81 passed); no commit of this PR changed a plugin file after it. The prompt-pack node tests andvitestonsrc/api/code.test.ts(2 passed) ran at an earlier head; no commit of this PR changed a prompt-pack or frontend file after it. Earlier heads also ran the grounding, decision-extract, settings, op census, assistant, policy-gate, shielded, lease and SDK codegen tests (2840 passed) andnpm --prefix frontend run build; since then the frontend changed only in a test file. The frontend's other unit tests on this host (Node 25) fail 14 time-zone and locale tests that do not touchsrc/api/code.ts; CI runs them on its Node.At
8377866,mainis merged (Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047):binding._gatedauthorizes throughrow_reachand keeps its notes, with the check insideshared_work(), and the override-edge and constructor-edge probes keep Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047's cached failure note while their reads run outside the lane. Thecode.greplessons bound follows Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047's rule (a cut by the fixed bound is noted, a cut by the call's own budget is not) and counts what is left of theleadbudget as the call's own. A lead leg that did not answer is noted withdegradations.partial;test_degraded_unnoted.py::test_a_fallback_kept_out_of_provider_health_is_noted_with_partialandtest_code_lead.py::test_a_failed_leg_is_noted_as_degraded_names_an_errorfail without it. Both plugin manifests are at 1.2.176. Every generator--checkis current and the analyzer corpus is unchanged;ruff format --check,make lintandmake typecheckpass;pytest -n autoover the 284 test files that import what this PR touches passes 8492, and its 25 failures fail the same on a cleanc8ba4042ea(test_native_command_retirement,test_namespace_audit,test_cell_retirement,test_mentor; a local clickhouse-local withoutenable_quantized_codec); the plugin's node tests pass but for two file-context hook tests that pass when run alone.git merge-tree --write-tree origin/main HEADis clean againsta229f49.At
9f0f2d9, a lead leg is listed indegradedonly when it readfailedorbusy, following the rule of Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047: a leg cut by theleadwall or by the call'sdeadline_ms(deadline), or denied by a policy rule (policy), is that limit working, not a fallback, and is named in the entry,lead_unreadand the span only. Before Responses served from a fallback say so in degraded, and ops.incidents lists current incidents #2047 merged, the lead's notes reached no response; now every response carries them.test_code_lead.py::test_a_leg_past_the_wall_reads_deadline_and_only_a_failed_one_is_listed,::test_a_leg_the_history_policy_denies_reads_policy_and_is_not_listedand::test_a_grep_leg_cut_by_the_callers_deadline_reads_deadline_and_is_not_listed(acode.grepwithdeadline_ms: 700, whose cap cuts the legs at 0.2 s) fail at8377866on the extra(deadline)or(policy)entries. Two new cases oftest_code_result_lessons.py::test_a_file_whose_lessons_are_missing_is_noted_unless_the_deadline_cut_itpin thecode.greplessons bound under theleadshape: a file read cut by what is left of theleadbudget lists nothing, and one cut by the fixed bound listscode_lessons: file_lessons_dropped (TimeoutError). They pass at8377866, and fail when_bound_sdrops itsleadbranch or lets theleadbudget replace a smaller fixed bound.binding._gatedholds only itsrow_reachread insideshared_work(); its notes and result are unchanged. The previous round note's claim thattest_a_failed_leg_is_noted_as_degraded_names_an_errorfails withoutpartialwas wrong: that test pins the error text (the error passed to the note, whichcaller_textrenders) and passes withnote(..., error, health=False);test_degraded_unnoted.py::test_a_fallback_kept_out_of_provider_health_is_noted_with_partialpins thepartialspelling.ruff,make typecheck, the function-length gate and every codegen--checkpass;pytest -p randomlyover the code-lead, result-lessons, scan, tracker-binding, client-hygiene, public-copy, doc-link and package-contract tests passes 558.At
4c6ea3a,mainis merged again (Loom holds the checks for MCP worker source setup #2126, entity_communities: a namespace that fails no longer skips the rest of the pass #2131, test_degraded_unnoted lists the enrollment challenge spend, so main's unit job passes #2132, Collection administrators can list and approve source worker profiles #2133): the Go and Rust wire models conflicted and are regenerated from the merged registry; every generator--check(the SDKs, the Rust fixtures,docs_reference,op_reach_census, the settings files, the plugin copies and skill bundles) is current, both plugin manifests stay at 1.2.176, and no other open PR uses that version. Between9f0f2d9and this merge the_DEGRADEDcomment, the module docstring and the feature page state the rule without listing the unlisted kinds, and_DEGRADEDholdsbusyalone, since a failed leg is noted with its error before the set is read. The SDK surface, session-content-sender, package-contract, code-lead, scan, doc-link and public-copy tests pass (429).AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked: the leg handlers' inputs and outputs against their models, that every internal caller of
code.symbolandcode.grepopts out, the slot and width accounting on every exit of a statement, which work leaves the lane and which bounds it keeps, which process-wide caches a refusal could fill, the wall arithmetic and cancellation, and the MCP listing budget.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code