Repository navigation
Review follow-ups: server and docs say and do what the recently merged changes promise - #1728
Merged
Merged
Conversation
…pass Review nit on the rename revision (server/memory/app/code_renames.py): "`_REFUSED` treats every 409 as a final refusal, and the key write lock raises `PreconditionFailedError` (409) when the key is busy. A revision that only lost a lock race returns False, the policy step clears the mark, and the memory is never revised though nothing about it forbids it." The lock's refusal is its own class, `KeyBusy`, with the same wire code and status. `revise` raises it, so the policy step leaves every mark of the memory due, stamped behind the rest, as for any failed revision. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the plugin modes (server/transport/mcp_schemas.py):
"The server and the hooks read a padded mode differently.
`plugin_profile` lower-cases without trimming, so `?mode=memory ` lists
both planes; `pluginMode` trims, so the hooks run memory only. [...] An
install whose option has a stray space captures nothing while its
listing shows every tool. Fix: `.strip()` in `plugin_profile`."
Failing cases: `plugin_profile("plugin", "MEMORY ")` returned `plugin`,
the listing of both planes, which the test asserted.
Pattern: the server lower-cased the mode, the hooks trim and lower-case.
Hypothesis: strip before the lookup; a padded `memory` or `code` then
names its one-plane profile and every other value still changes nothing.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ize` Review nit on the plugin modes (server/transport/mcp_primer.py): "Code mode's startup instructions still end with the caller's authored profile. The plugin branch of `_initialize_instructions` appends `_profile_section` for every plugin profile, `plugin-code` included, and `initialize` records a profile read. [...] Fix: skip the profile when `plugin_plane(schema_profile) == 'code'`, or say in docs/reference/mcp.md and the Modes sections that the profile is still sent." Failing cases: `initialize` on `?schema_profile=plugin&mode=code` for a caller with an authored profile returned the code sentence followed by the whole profile, and wrote an `mcp.initialize` profile-read row. Pattern: the plugin branch rendered the profile for every plugin profile. Hypothesis: code mode reads no memory, so its sentence is the whole text; no profile is rendered and no profile read is recorded. The both-planes and memory-mode texts are unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the plugin modes (server/transport/mcp_schemas.py): "`plugin-memory` and `plugin-code` are now accepted directly as `?schema_profile=` values: `resolve_schema_profile`, `_plugin_connection` and `listing_plane` all take them from the URL, with no `?mode=`. docs/reference/mcp.md documents only `?mode=`, so the same listing has a second, undocumented spelling. Fix: carry the plane as its own selector, or have `_listing_params` reduce a URL-given `plugin-*` value to the default." `plugin_profile` reads a URL-given one-plane name as no profile, so the connection gets the server's default profile, as for any value the server does not take from a URL. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the code-search confidence (server/code/app/search/calibrate.py): "A `low_calibrated_confidence` abstain keeps the shared `finalize_abstain` text 'calibrated retrieval confidence is too low for a grounded answer' while `retrieval_confidence` on the same reply can read 1.0. [...] only the wording now contradicts the field. Fix: have the code plane's reason say 'abstain score', as the settings comment already does." `finalize_abstain` takes the name of the score its verdict was taken on; the memory plane keeps its text. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the code-search confidence (server/code/api/models_search.py): "The `retrieval_confidence` field comment runs eight lines, and the generated reference keeps only its first two sentences. The 0.5 cases (no vector row, no scale) and the 0.0 on an empty abstain are therefore missing from the op reference and the tool description. The wire-ops rule asks for one sentence per field; move the detail to the architecture page, which already has it." The comment keeps the sentence the reference renders. The architecture page gains the cases it did not have: 0.0 on an abstain with no result, the fixed values of the symbol and history routes, and a second vector model read on the served embedder's scale. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the code-search confidence (server/code/domain/index/search_confidence.py): "`NO_COSINE_CONFIDENCE` is also returned by `similarity_term` when a cosine exists but the scale has no range, so the name describes one of its two uses. [...] A neutral name such as `UNREAD_CONFIDENCE` would fit both uses." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…is next rewritten Review nit on the rename revision (docs/concepts/memory.md): "The docs say the pass decides once and a memory it left is not revised later. `_write_moves` marks every rewritten link that reads `moved` as due, and `_recheck` emits a move whenever the link differs from the stored one, which by my reading includes a shift of its lines. So a memory left while pinned, then unpinned, is revised when its file is next touched [...]. Fix: mark due only when the link's path or name changed in this move, or correct the sentence." The sentence is corrected, here and in the rolling-upgrade rule that said a link `moved` before the upgrade is never marked. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…itten Review nit on the rename revision (server/memory/app/code_link_policy.py): "Under the Postgres authority a revision that committed but whose publication failed raises `PublicationPending` (503). `revise` re-raises it, so the pass counts an error, does not count the memory in `renamed`, and stamps links of the replaced text as still due, although the text was written. The next pass tombstones those links, so only the outcome numbers are wrong." `revise` returns True for it: the pass counts the memory as renamed and leaves its links to the link pass, with no error. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s width
Review nits on docs/concepts/memory.md:
"The rewritten paragraph leaves one line unwrapped (`apart) name where
the code is now. A link that is ...`), far past the page's wrap width."
"The edit leaves a line of about 103 characters ('high-sensitivity
memory; a link whose code also changed is listed under
`code_links_stale`. Neither the') in a paragraph wrapped near 90. [...]
Rewrap the paragraph to its end."
Each is rewrapped to its end, with the paragraph an earlier commit of
this branch lengthened. No word changes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the rename revision (server/memory/app/update.py): "`_refuse_unsettled` runs after the embedding call and the conflict check, so each refused revision spends one embedding for the memory's writer. With the conflict resolver on, any near peer sets `review` and refuses the revision, which in a code namespace of related rules may be most of them. Worth a line in the docs on how often the pass is expected to write." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/code/app/index/gitrepo.py): "`shown = literals[0][:40]` puts the first 40 characters of a source line into the `ArgumentsTooLong`, `GrepTimedOut` and `GitError` messages, while `memory_links._grep` takes care to log only a count because 'a line of source may hold a literal'. No caller logs these messages today [...]; for a list of lines the message should carry the count, so that a later `log.warning(..., e)` cannot print source text." A single literal, a name the caller searched for, is still shown. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/code/app/memory_links.py, server/code/domain/successor.py): "a line of the definition is passed to `create_subprocess_exec` as an argument. A line holding a NUL byte raises `ValueError` (embedded null byte), which is neither `OSError` nor `GitError`, so it would fail the recheck of that path instead of reading as 'git cannot search them'. [...] Dropping lines with `\x00` in `own_lines` closes it." A file's bytes are decoded with replacement and split into lines, so a NUL inside a parsed file reaches `own_lines` as written. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/code/domain/successor.py): "`_LINES` and `_MIN_LINE` name the mechanism; `_OWN_LINES` / `_MIN_OWN_LINE` (or similar) would say they bound `own_lines`. There is also an extra blank line between `_MAX_LINES` and the new comment that leaves the two constant groups three lines apart." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/code/domain/successor.py):
"the docstring is wrapped unevenly ('kinship among every changed file. A
member's name is one any' / 'class may define ...') and runs to ten
lines restating rules that `_grown` and `_with_its_class` already
document. Rewrap it and leave the detail to those two."
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/memory/app/code_link_recheck.py): "'Nothing, as before this search, when ...' describes history rather than the behaviour [...]. Say what is returned: no successor." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the line search (server/memory/app/code_link_pass.py):
"the INFO line 'a definition not searched for across the N files' is
written once per lost definition, also when the cause is range-wide
(`git cannot search them`, already remembered under `("unsearchable",
base, head)`). A range that lost many linked definitions repeats the
same line for each; the past-the-setting warning is logged once a range,
and this one could be too."
A definition whose own lines are in too many files, or that has none,
is still logged for itself.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the earlier follow-ups (server/memory/app/code_link_pass.py): "No test asserts that `limit` is part of the `_once` key; the before/after proof is a snippet only. [...] Add a test that reads one range under two limits, or leave the key alone and say the memo holds one limit per pass." The test fails when the limit is dropped from the key: the answer under the narrower limit would then be the answer under the wider one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the earlier follow-ups (docs/features/memory/extraction.md):
"The conversation prompt sizes ('about 57,000 for a short input and
86,000 for a longer one') are pinned by no test. Only `len(prompt) <
9000` for the session prompt is asserted [...]. Assert them with a
margin, or drop them and keep the pinned bound."
The two figures had drifted: the conversation prompt measures 58,083 and
92,454 characters with every flag-gated block off. The page now gives
the session prompt's bound and its ratio to the conversation prompt, and
the test asserts both.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the tie order (server/code/store/index/search.py): "`_nearest_first` re-sorts the whole pool in Python on `r["distance"]`. A NaN distance (cosineDistance against a zero-norm stored vector) compares false both ways, so `sorted` can leave rows with real distances out of order around it, where ClickHouse's own sort put NaN last [...]. Reachable only if a row with `embedding_dim > 0` holds an all-zero vector; a read of the embed writers would settle it." It is reachable: the local embedder returns an all-zero vector for a blank text. The sort key puts such rows last, in the tie order among themselves. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the tie order (tests/unit/test_code_search_determinism.py): "`test_symbol_lookup_reads_its_candidates_in_one_order` asserts the bound `keys` parameter of the second statement, the implementation rather than the rows read back. A behavioural case needs more than 4,000 candidate keys; if that is why it stays a stub, say so in its docstring in one clause." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the lexical pool (docs/architecture/code-index-architecture.md): "The revert removes the paragraph that describes the ranking's test-path and prose penalties and the test-word and doc-word exemptions. That behaviour still ships in `_apply_fusion_signals` [...]. The page now says nothing about the penalties." A later change put the exemptions back on the page. This adds the sentence they refer to: which paths are ranked lower, and by how much. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… changes Review nit on the issue-length priors (docs/architecture/code-index-architecture.md): "The paragraph lists four things test intent turns off (test-path penalty, fan-in prior, kind prior, per-file saturation) and omits the fifth reader this PR rewires: the definition leg's exclusion of definitions on test paths (definitions.py named_definitions asks_tests)." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the issue-length priors (tests/unit/test_code_fusion_signals.py): "`test_a_question_up_to_the_issue_body_length_is_read_whole` and the test after it build questions from settings.code_search_query_max_tokens with a 60-word list. A unit environment that sets the cap above 59 raises IndexError in `_question` instead of a readable failure, and a cap of 15 or less makes the second test index past the question. Pin the cap with monkeypatch as the third test does." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the issue-length priors (server/code/app/search/definitions.py): "Missing test for a promised behaviour: the body draft says the definition leg prefers a source definition for a long report that mentions a test, but no test covers the leg with such a query. [...] One named_definitions or _definition_leg case with a query over 48 lexemes and a test word past lexeme 16 would close it." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the issue-length priors (server/code/app/search/priors.py): "`_intent_lexemes` takes the first 16 lexemes of the raw query, while the trim it borrows its length line from reads the query after strip_boilerplate. A flattened templated body that opens 'Company or project name _No response_ Describe what's wrong ...' spends 9 of the 16 lexemes on headings [...]. The failure direction is the safe default (ranked as a report). Fix: take the head from code_tokens(strip_boilerplate(query)[0]), or say in the comment that headings count." The comment and the architecture page say so. Reading the head after the headings are stripped would change which questions keep the path penalties, which needs the held-out measurement the rule was chosen on. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s length Review nit on the issue-length priors (server/code/app/search/priors.py): "The length test is code_tokens(query), but query_trim.plan() decides 'issue body' on code_tokens(query + extra_terms). A request with extra_terms can be trimmed as an issue body while intent is still read from the whole question. [...] Either state that extra_terms do not count for intent, or pass the same token count." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the issue-length priors (server/code/app/search/priors.py): "`_apply_fusion_signals` now tokenizes the query three times in a row (q_tokens, asks_for_tests, asks_for_docs), each a full regex pass over up to 20,000 characters [...]. A single _intent_lexemes(query) call intersected with both word sets, or helpers that take the token list, would remove the repeat." `_intent_lexemes` takes the token list. The ranking of the same units is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the lexical pool (server/code/store/index/search.py): "The restored `rows = await self._ch.query_all(...)` followed by `return rows` is a local with one use. Returning the awaited call directly is the simpler form." The statement is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill round reads (server/code/app/index/round_reads.py): "`refused` is every path `parse_for_round` returned None for, which includes declared-only generated files and files over the byte cap. `ingest_file` tombstones neither, so their prefetched file rows are never read. The docstrings call these 'the paths `ingest_file` refuses', and the module docstring says the prefetch reads their 'chunk and file rows' where it reads the chunk index and the file rows." The paths are named for what the round knows of them: it did not parse them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill round reads (server/code/app/index/round_reads.py): "`_buffers(keyed_by: str, ...)` picks the key set with `getattr(self._pending_keys, keyed_by)` from a string literal at each call site, so a misspelt name fails only at run time and mypy cannot check it." `keyed_by` is a `Literal` of the four key sets, so mypy refuses any other name. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill round reads (server/code/app/index/round_reads.py): "the reuse read adds 1 to `statements` whatever the number of batches `embeddings_for_paths` sent; `_round_read` counts one per 100 paths. A round of more than 100 fresh paths under-counts." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…in a round Review nit on the backfill round reads (tests/unit/test_code_round_reads_backfill_statements.py): "a `code_chunks` insert ending the empty-chunk answer is tested, but a `code_files` insert dropping the cached `live_files_for_path` rows is not, nor that `embeddings_for_texts` reads per file for another org or model." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill round reads (server/code/store/index/files.py): "nothing exercises `embeddings_for_paths`' limit carried across batches (more than 100 paths, `limit - len(rows)`, the early break). The unit fake reimplements it as `rows[:limit]` and the analyzer case only checks the statement's shape." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…ed write
Review nit on the backfill exit code (server/cli/code_backfill_workers.py):
"`Workers.index_batches` ('why it was held', 'Once a batch is held
nothing more is handed out', 'after a hold') and `Workers._run` ('none
handed out once one comes back held') still describe only the org
switch. The same channel now carries 'a write failed', and the `Done`
comment was updated to 'why it stops the run'. Fix: use the same wording
in both docstrings."
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill exit code (server/cli/code_backfill.py): "`_close_index` passes `errors=counters["errors"] + sum(unwritten(counters).values())`, so `loom.worker_status.partial_failures` adds failed files to dropped rows, beside `items_done`, which counts files. [...] Fix: say in the comment that the number is files plus rows, or pass `errors + 1` per failed pass so the column stays a count of items." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill exit code (server/cli/code_backfill.py): "The `write_failed` docstring 'Why a batch a failed write left rows out of stops its run' is a garden-path sentence." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill exit code (docs/operations/code-index-operations.md): "'A failed insert of the rows the index phase indexed' and 'the write that closes a round a held model call or a signal had already stopped' are hard to parse on a first read. The second is the only place an operator learns which failures still end in a traceback." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill exit code (server/cli/code_backfill.py): "The round is flushed twice: explicitly inside `async with reads:` so a failure is printed and counted, and again by `RoundReads.__aexit__`, which is a no-op on the normal path and the only flush on a hold or cancellation, where its failure propagates as a traceback. [...] Fix: one comment line on the explicit flush saying `__aexit__` then finds nothing buffered, and that it is the flush whose failure still ends the command." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit on the backfill exit code (tests/unit/test_cli_backfill_second_pass.py): "`test_rows_a_failed_write_left_out_fail_the_recorded_pass` stubs `_record_manual_pass`, `_compact_after_bulk` and `_republish_counts`, then checks the kwargs `_close_index` passed. It would still pass if `_record_manual_pass` stopped mapping `errors` to `partial_failures`. Fix: stub only `status_store.record_manual_pass` and assert the `status` and `partial_failures` it receives." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Post-merge review of the code-state lead (tests/unit/test_memory_code_state_lead.py): "test_a_rewritten_row_says_first_written_on_a_row_read_and_written_on_a_hit builds its hit from a hand-made date so its assertion is true by construction (build the hit from the document's created_at)." The document is built at a pinned clock and the hit carries its `created_at`, so the `written=` day asserted is the one the write produced. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Post-merge review of the code-state lead (server/memory/domain/code_change.py): "`lead` docstring shows only the `written=` form." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The undo tests built the busy lock's error through the helper that the lock's error class replaced in this branch. They raise `KeyBusy`, which is what the lock raises. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Main's new first-call test split the code-mode text at the profile, which this branch no longer sends in code mode, and this branch's test asserted the code sentence main reworded. `_split` returns no profile for a text that carries none, and the code-mode test asserts the sentence by the part both wordings keep. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review finding on the link pass (server/memory/app/code_link_pass.py): "One definition's failed line search now stops the line search for every other lost definition of the same range in the pass. `_holding` sets `self._read["unsearchable", base, head]` whenever `code.grep_lines` returns None [...] but `grep_lines` returns None for `ArgumentsTooLong` and any `GitError` too, and those depend on the lines." Failing cases: two definitions lost over one wide range, the first holding a line past what git takes as one argument. Its search raised `ArgumentsTooLong`, the range was marked, and the second, which git could search, read `missing` where it had moved. Pattern: the mark was set for every failed search, and only a timeout is the range's: the paths are the same for each definition, the lines are not. Hypothesis: `grep_lines` raises `GrepTimedOut` for a search git does not finish and keeps None for the rest; `_holding` marks the range only then. Predicted: the second definition is followed, and a timed-out search is still made once a range. Both held. The mark was there before this pull request, which had only moved its log line. A search git cannot run fails at once, so making it again for the next definition costs no wait. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit (server/memory/store/key_write_lock.py): "`__all__` does not list `KeyBusy`, which `code_renames.py` imports and two test files use as `key_write_lock.KeyBusy`." Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review nit (server/transport/mcp_primer.py): "The docstrings say a plugin connection in code mode 'reads no memory'. That holds for `initialize` and `server/discover` only: `resources/read` of `loom://primer`, `prompts/get` of `loom` and `loom_activate` stay callable by name in code mode, and `_loom_primer_text` still appends the caller's profile there." The test docstring that repeated the sentence says the same. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Review finding on the link pass (server/memory/app/code_link_pass.py): "the
`_holding` docstring's logging sentence ('Each is logged: the second as a
warning and the last once a range, the others for each definition') makes
the reader count back through a five-item list, and it leaves out that a
search git cannot run for over-long arguments is also a warning (from
`memory_links._grep`). Name each case with its log level instead of by
position."
The five cases are a list, each with its level and whether it is said for
each definition or once a range. Docstring only.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…range Review finding on the link pass (server/memory/app/code_link_pass.py): "`ArgumentsTooLong` no longer marks the range, on the reasoning that it may come from one definition's lines. It can also come from the path list, which is the same for every lost definition of the range [...] In that case every lost definition repeats the failed exec, one warning from `_grep` and one info line from `_unsearched`, each pass [...] If the setting's ceiling keeps the paths well under the system's argument limit, this cannot happen and the nit drops; otherwise tell the two causes apart." The ceiling does not keep them under it: the setting allows 20,000 paths and a path may be 4,096 bytes, against a limit of 1 to 2 MiB. Measured here (limit 1,048,576, counting each argument's bytes, NUL and pointer): 9,708 paths of 100 bytes start, 9,709 do not. Failing cases: two definitions lost over one range whose paths alone are past the argument limit. git was started twice, and a warning and an info line were logged for each definition. Pattern: an argument list too long has two causes, the lines (the definition's) and the paths (the range's), and both were read as the definition's. Hypothesis: `grep_paths` raises `PathsTooLong`, a kind of `ArgumentsTooLong`, when the paths alone are past `SC_ARG_MAX`; `grep_lines` raises it on as it does `GrepTimedOut`; `_holding` marks the range for both. Predicted: one start of git, one warning and one info line for the two definitions, and a definition with one over-long line still leaves the next one searched. Both held. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…e marked lists of uses The extraction page keeps the size of the session prompt as a share of the conversation prompt and adds main's sentence on the fix record rules. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
9 of 10 tasks
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.
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):
The code-link pass tries a rename revision again when it lost its key's lock, where the memory used to be left unrevised, and keeps looking for the other definitions lost over a range after one of them held a line git could not search for. A plugin connection in code mode gets no authored profile at
initialize, a padded?mode=is read as the plugin's hooks read it, and a code search that abstains on its fused list says the abstain score was too low, not the confidence.Why
Pull requests #1688, #1689, #1691, #1698, #1699, #1700, #1703, #1708, #1712, #1713, #1715, #1716 and #1718 were merged on an agent review that let findings below a defect through, to be fixed in one follow-up. This is that follow-up for the server, the tests and the docs. Each finding was read again on current
main. The ones that still hold and take a few lines are fixed here, one commit each, with the finding quoted in the commit message. The rest are listed below with what settled them or why they are left. Findings in plugin files are left to the plugin pull requests that are open.This pull request holds more than one concern, because the reviews of those thirteen asked for one follow-up. It is filed as a bug fix: every change a user can see is one, each with a regression test. Its changelog entry has one sentence for the link pass and one for the MCP connection and code search. The commits are one finding each, and those of one area do not depend on another's, so it can be split by area before it lands.
Four fixes change behaviour. Each was written as a failing test first.
A rename revision that only lost its key's lock (#1703, 7eb744b)
code_renames.revisewhen the conditional write's key lock is busy past its wait. The lock raises a 409PRECONDITION_FAILED,_REFUSEDholds 409,revisereturned False, and the policy step cleared the link's mark. The memory was never revised, though nothing about it forbade the revision._REFUSEDmatches on the status alone, and the lock's refusal shared status and class with the final refusals (the text moved on, a pin, a near peer).KeyBusy, same wire code and status) and havereviseraise it. The policy step's existing handler then leaves every mark of the memory due, stamped behind the rest. Predicted: the new test raises wheremainreturns False. It did.A failed line search that stopped the search for the rest of its range (#1698, 88321a8)
-eargument, and a definition's longest lines are the ones searched for). Its search raisedArgumentsTooLong,_holdingmarked the range, and the second definition, which git could search, readmissingwhere it had moved. The mark is onmainsince A link follows a definition moved and renamed with its body unchanged: across a wide range, past unrelated new definitions, and under 30 tokens by its name or its class #1698; this pull request had only moved its log line.grep_linesraisesGrepTimedOutfor a search git does not finish and still returns None for one it cannot run;_holdingmarks the range only for the first. Predicted: the second definition is followed, and a search that timed out is still made once a range and logged once. Both held. A search git cannot run fails at once, so making it again for the next definition costs no wait.A line search git cannot run for the paths alone (this pull request's review, 02da779)
memory_code_links_mirror_changed_filesallows 20,000 paths and a path may be 4,096 bytes, against a limit of 1 to 2 MiB.grep_pathsraisesPathsTooLong, a kind ofArgumentsTooLong, when the paths alone are pastSC_ARG_MAX(each argument counts its bytes, its NUL and its pointer);grep_linesraises it on as it doesGrepTimedOut;_holdingmarks the range for both. Predicted: one start of git, one warning and one info line for the two definitions, and a definition with one over-long line still leaves the next one searched. Both held; the numbers are under Tests.A padded
?mode=(#1713, e57ba3a)plugin_profile("plugin", "MEMORY ")returnedplugin, the listing of both planes, while the plugin's hooks trim the option and run the memory plane alone."MEMORY "and" code\n"name their one-plane profile, and every other value still changes nothing. Both held.The cost of the line search for a lost definition (#1698): measured, no cap added
unresolvedlinks can cost two repository-widegit grepruns of up to 20 s for each link.unresolvedlink has its own base commit, so no failure is shared between links, and each is rechecked on every new head for 30 days.LOOM_MEMORY_CODE_LINKS_MAX_PASS_SECONDS(600 s) for a hundred such links. The measurement is under Tests. It held, so no per-pass cap is added.Scope and risk
Server, tests and docs only. No plugin file changes, so no plugin version changes. No table, migration, setting, op or field changes.
What can behave differently:
renamedand leaves no error. A line search git does not finish in its time is made once over a range in a pass and logged once, as onmain. One git cannot run because the paths alone are past the system's argument limit is also made once over a range and logged once, withPathsTooLongin its warning. Any other one git cannot run (a line too long, another git error) no longer stops the search for the other definitions lost over that range, and is logged for each.initializeon a plugin connection in code mode: the instructions are the code sentence alone, and nomcp.initializeprofile-read row is written. Both planes and memory mode are unchanged.?mode=is trimmed.?schema_profile=plugin-memoryandplugin-codegiven directly are read as no profile, so such a connection gets the server's default profile. The shipped plugin sendsschema_profile=plugin&mode=<mode>.code.search: theabstain_reasonof alow_calibrated_confidenceabstain starts "the abstain score is too low". Vector rows whose distance is not a number sort last. The fusion signals tokenize the query once, with the same ranking.loom code backfill: only comments, docstrings, a statement counter and tests.Fixed here
low_calibrated_confidenceabstain said "calibrated retrieval confidence is too low" beside aretrieval_confidenceof 1.0retrieval_confidencefield comment ran eight lines; the reference keeps one sentenceNO_COSINE_CONFIDENCEnamed one of its two usesmovedlink is marked due againkey_write_lock.__all__did not listKeyBusyrenameddocs/concepts/memory.mdValueError_holdingdocstring named its logged cases by position in a five-item list and left out the warning for over-long arguments_may_bedocstring was wrapped unevenly and restated two other functions_renamed_elsewheredocstring_LINESand_MIN_LINEnamed the mechanism; an extra blank linedocs/concepts/memory.mdinitializestill ended with the caller's authored profileinitializeonly (loom://primer, theloomprompt andloom_activatestill render the profile when called by name)?mode=memorylisted both planesplugin-memoryandplugin-codewere accepted directly as?schema_profile=code_filesinsert dropping the cached file rows, or of vectors of another org or modelingest_filerefuses" for every path the round did not parse_buffers(keyed_by: str)could not be checked by mypywrite_faileddocstring was a garden-path sentenceextra_terms, and no text said soleaddocstring showed only thewritten=form49e58be is the merge of
main: a change merged while this was open edited the same primer function and test file.Already settled on
mainMeasured, nothing changed
unresolvedlink: see Tests. No per-pass cap is added.Deferred to the open plugin pull requests (files under
integrations/)LOOM_SHUNT_GREP/LOOM_SHUNT_BASHREADME row; the stale first sentence of theloom-code-shunt.mjsheader; the lookup that cannot answer fortail -n Non a file over 4 MB;isCompoundCommandon a backslash-escaped quote.planeEnabled('memory')gate and its header comment; "returns before it reads its payload" inHOOKS.md; the staleLOOM_COLLECTIONS_LINEREADME row; the missing tests ofcode.outcomeand of the Stop test gate in each mode; the removedtoolsetoption not named in the title or README.Left, with the reason
code.askanswer serves theretrieval_confidencestored in its row. Checked: a row is served for at mostLOOM_CODE_ASK_CACHE_MAX_AGE_DAYS(14) or until the index head moves, and nothing gates on the number. Left to expire.symbol_names_for_pathsin name order. Changing which names the cut keeps changes ranking inputs.own_linesputs no upper bound on a line; a bound changes which lines tell a definition.FINALread does not pre-sort. They run only against aclickhousebinary that knows the schema's settings, which the local one does not.test_each_pass_names_the_chunk_rows_its_rounds_readasserts keyword arguments. A behavioural version needs a repository fake for the whole ingest of a round; the round's side of those arguments is covered bytests/unit/test_code_round_reads_backfill_statements.py.Compatibility, rollout and rollback
abstain_reasonof acode.searchlow_calibrated_confidenceabstain;initializeinstructions on?schema_profile=plugin&mode=code(no profile);?mode=is trimmed;?schema_profile=plugin-memoryand?schema_profile=plugin-codename no profile.KeyBusyhas the wire code and status of the error it replaces. A build N-1 clears the mark of a revision that lost its lock, as before, and stops a range's line search at any failed one.PathsTooLongis raised and caught inside one process.Tests
Run on the merged tree, Python 3.12, with no environment file:
pyteston the 16 unit test files this change edits (tests/unit/test_memory_code_rename_plan.py,test_memory_code_links.py,test_memory_code_state_lead.py,test_restore_lock_busy.py,test_mcp_listing_budget.py,test_mcp_primer_order.py,test_mcp_initialize_surface.py,test_code_search_provenance.py,test_code_search_confidence.py,test_code_search_determinism.py,test_code_search_definition_leg.py,test_code_fusion_signals.py,test_code_successor.py,test_code_round_reads_backfill_statements.py,test_cli_backfill_second_pass.py,test_coding_session_extraction.py): 919 passed, 5 failed. The five are theclickhouse-localcases oftest_code_search_determinism.py, which fail the same way onmainwith the localclickhousebinary: it refuses a setting of the schema (Unknown setting 'enable_quantized_codec'). CI's binary runs them.main, the test files nearest the changed behaviour that this change does not edit:test_memory_key_write_lock.py,test_abstain_precedence.py,test_search_abstain_score_contract.py,test_sdk_errors_from_response.py,test_package_contracts.py,test_transport_layering.py,test_public_copy.py,test_doc_links.py,test_mcp_home_namespace.py,test_mcp_protocol_version.py,test_mcp_assistant_toolset.py,test_gitrepo_option_injection.py,test_cli_code_backfill_workers.py,test_cli_code_backfill_round_reads.py,test_memory_update_conflict.py,test_domain_metrics.py: all passed. That run is what found the two restore tests fixed in c5eb5b3.pytest: the two new tests and the seven nearest them intests/unit/test_memory_code_links.py(the range mark for a timeout and for over-long paths, a grep that cannot start, the three ways a search is cut short, anunresolvedlink over a range not searched, a wide range read where the lines are, one range under two limits), 17 cases, all passed. CI runs the files whole.ruff format --check .,ruff check, the function-length gate, the secrets gate, every generator's--check, Prettier ondocs/concepts/memory.mdand the four tree-wide checks oftests/unit/test_public_copy.pypass on the pushed head. The mypy gate reports onlyserver/llm/vertex_auth.py, for type stubs missing from the local environment.Failing first, on
main's code:test_a_revision_that_lost_the_keys_lock_raises_so_the_memory_stays_due:DID NOT RAISE,revisereturned False.test_a_line_search_that_fails_on_one_definitions_lines_is_made_for_the_next, on the server code of the commit before it:[('missing', 'pkg/a.py', 'pkg.a::fetch_rows')]where[('moved', 'pkg/b.py', 'pkg.b::warm_up')]is asserted.test_a_line_search_git_cannot_run_for_the_paths_alone_is_made_once_over_the_range, on the server code of the commit before it: git started twice where once is asserted.assert 'plugin' == 'plugin-memory'.mcp.initializerow was written.assert 'plugin-memory' is None.PublicationPendingraised out ofrevise.['mid', 'far', ..., 'near']for rows at 0.10, 0.25 and 0.40.Tokenizer passes over the query in
_apply_fusion_signals, counted by wrapping the tokenizer: 3 before, 1 after, with the same ranking of the same units.A range whose paths alone are past the argument limit, counted. Two definitions lost over one such range, the exec failing with
E2BIG:ArgumentsTooLongPathsTooLongWhat the limit counts was measured on the development machine (
SC_ARG_MAX1,048,576): 9,708 arguments of 100 bytes start and 9,709 do not, so each argument counts its bytes, its NUL and an 8-byte pointer. The same accounting is ingrep_paths. Against a real repository on that machine: 12,000 paths of 99 bytes with a short line raisePathsTooLong; 9,000 such paths with a short line are searched; 9,000 with one line of 100,000 bytes, and one path with one line of 1,100,000 bytes, raiseArgumentsTooLong, which leaves the next definition's search to be made.The line search for a lost definition, timed. A bare clone of an open-source Python web framework with 35,145 commits. 95 definitions that are in a file at an old commit and not at the head, each taken from its own commit between 200 and 4,160 commits back, so each has its own range: 782 to 3,320 changed files, median 2,393. A script calls the recheck's search for a definition renamed elsewhere (
_renamed_elsewhere) for each of them as anunresolvedlink, in one pass's shared reads, on the tree before #1698 and onmain. The machine has 14 cores and was shared, with a load average between 23 and 42, so the times are high and vary.unresolvedlinks, one passmain)git grepruns for linesgit grep(run 2)The search adds 1.1 to 2.3 s for each
unresolvedlink on a new head, about half of it in git and the rest in parsing the files that hold the lines. No search came near its 20 s bound. 95 links take 23% to 42% of the 600 s a pass may run, and a pass the deadline cuts records its last path and resumes there. The search also followed 25 of the 95 definitions, where the earlier code followed none over these ranges. A cap is not added on this evidence. A repository that holds several hundredunresolvedlinks at once would fill a pass; no count of such links from a deployment is at hand.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. Each finding was read against the code on
mainbefore its fix, each behaviour fix has a test that failed first, and the gates and test files listed above were run.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) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.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
Note
Medium Risk
Touches memory auto-revision, code-link git search over large ranges, and MCP initialize behavior; wire shapes are mostly unchanged but user-visible messages and retry semantics differ.
Overview
This follow-up aligns server behavior, tests, and docs with recent merged changes. Memory code links get stricter git mirror search:
PathsTooLongandGrepTimedOutare distinguished from other failures, wide ranges are marked unsearchable once per range (not per definition), NUL bytes are excluded fromown_lines, and rename revisions now raiseKeyBusyinstead of silently giving up, treatPublicationPendingas success, and can be retried when a link is rechecked asmoved.Code search abstains with a
low_calibrated_confidencemessage that refers to the abstain score, notretrieval_confidence(which can read 1.0 while still abstaining).UNREAD_CONFIDENCEreplacesNO_COSINE_CONFIDENCE; vector results with NaN distance sort last; fusion signals tokenize once; intent detection for long issue bodies uses the question’s first 16 lexemes (template headings count).MCP: plugin
codemode startup instructions no longer inline the caller’s profile;?mode=is trimmed; directplugin-memory/plugin-codeprofile URLs are rejected.Smaller fixes include backfill flush/error accounting comments, round-read prefetch for unparsed paths, and matching documentation updates.
Reviewed by Cursor Bugbot for commit 1dc9d7d. Bugbot is set up for automated code reviews on this repo. Configure here.