From 86573ea313fc2f40a03af26d4bcefdb35e0d9f1c Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 14:56:55 +0530 Subject: [PATCH 01/21] The stored-memory read's docstring says the per-call valid_at default is not read Review nit on the change that drops a coding fact a stored memory states: > The validity check reads only the fact's own `valid_at`, `valid_to` and > `foresight`. A capture sent with a per-call `valid_at` default still has > its facts compared with stored rows and dropped. [...] The > `_stored_neighbours` docstring could say the per-call default is not > considered. The docstring now says so. No behaviour changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/pipeline.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/memory/app/pipeline.py b/server/memory/app/pipeline.py index d2346dbad2b..2e67d11c255 100644 --- a/server/memory/app/pipeline.py +++ b/server/memory/app/pipeline.py @@ -704,9 +704,10 @@ async def _stored_neighbours(state: WorkflowState, facts: list[dict[str, Any]]) earlier session may already have stored of this capture's claims. One `embed_many` call for the capture, and the reads bounded like the conflict checks of the write that follows. None for a fact that carries `valid_at`, `valid_to` or `foresight`: - the verifier compares text and sees no validity. None under `append_only`, where - every write is its own event, or under a policy that could not be read. Fail-open: - with none, no fact is dropped as already stored.""" + the verifier compares text and sees no validity. The call's own `valid_at` default + is not read: a fact that takes its start from it is still compared. None under + `append_only`, where every write is its own event, or under a policy that could not + be read. Fail-open: with none, no fact is dropped as already stored.""" import server.memory.store as memory_repo from server.embedding import get_embedder from server.memory.app.handlers import nearest_existing_rows From 785fe7c9a0ee631fa94b74ad888014d2c56862ce Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 14:58:07 +0530 Subject: [PATCH 02/21] namespace.validate reads the names of unlinked memories off the event loop Review nit on the change that publishes no-link causes: > `unlinked` runs `mentions()` (six regex passes) over the value of up to > 2,000 memories on the event loop of a serving process. The link pass > does the same work in `asyncio.to_thread` (`code_links._memory_mentions`). > A `namespace.validate` without `keys` on a namespace of large values > stalls other requests on that replica while it runs. Fix: filter the > heads in `asyncio.to_thread`. The filter now runs in a thread. The report is the same. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/code_unlinked.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/memory/app/code_unlinked.py b/server/memory/app/code_unlinked.py index 215671eb894..d23095f7c02 100644 --- a/server/memory/app/code_unlinked.py +++ b/server/memory/app/code_unlinked.py @@ -9,6 +9,7 @@ from __future__ import annotations +import asyncio from collections import defaultdict from collections.abc import Sequence from typing import Any @@ -86,11 +87,9 @@ async def unlinked( out: dict[str, list[dict[str, str]]] = {cause: [] for cause in CAUSES} if not any(cfg.org == org for cfg in configured_repos()): return out # the org indexes no repository: no memory of it could be linked - heads = [ - h - for h in await store.linkable_of_namespace(org, namespace, keys, limit=SCANNED) - if _names_code(h) - ] + linkable = await store.linkable_of_namespace(org, namespace, keys, limit=SCANNED) + # reading names is CPU work: off the loop + heads = await asyncio.to_thread(lambda: [h for h in linkable if _names_code(h)]) if not heads: return out named = {h["mid"]: code_namespace_for(org, namespace, list(h.get("tags") or [])) for h in heads} From d9f6163aed6463203b134fc81cd7b35a1aeb57c3 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 14:58:17 +0530 Subject: [PATCH 03/21] The code-state probe's comment names what its first statement reads Review nit on the change that publishes link lag and link states: > the state statement now also runs `SELECT DISTINCT org, code_namespace > FROM loom.memory_code_links WHERE tombstoned_at IS NULL` over every link > version, every minute on the lease holder. The comment in > `_probe_code_state` still says the rows of this statement "cost nothing" > and that only the counts read every live row. Update the comment, or > move the linked-repositories leg to the counts clock. The comment now names what the statement reads. The probe is unchanged. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/observability/otel_probes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/observability/otel_probes.py b/server/observability/otel_probes.py index 61889bad4c3..996947a8d6c 100644 --- a/server/observability/otel_probes.py +++ b/server/observability/otel_probes.py @@ -780,9 +780,10 @@ def _probe_code_state() -> dict[str, list[tuple[float, dict[str, str]]]]: client = _probe_client() rows = list(client.query(_CODE_STATE_SQL).result_rows) # The FINAL counts over the four code tables read every live code row (GBs a call on - # a large deployment) for figures that move once an index run; the watermark rows - # above cost nothing. So the counts refresh on their own, slower clock: - # LOOM_OTEL_CODE_COUNTS_CACHE_S, default an hour, 0 = every call. + # a large deployment) for figures that move once an index run. The statement above + # reads the small state table and, of every link row, only its repository. So the + # counts refresh on their own, slower clock: LOOM_OTEL_CODE_COUNTS_CACHE_S, default + # an hour, 0 = every call. ttl = float(settings.otel_code_counts_cache_s) now_m = time.monotonic() never = float(_CODE_COUNTS_CACHE["at"]) <= 0.0 # monotonic() may be < ttl after boot From db550c69b564d4e312de98441ca3298ef30d59ab Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 14:59:16 +0530 Subject: [PATCH 04/21] The link findings say their 2,000-memory limit also applies under keys Review nit on the change that publishes no-link causes: > both say the memories read are "all under `keys` when given", but > `linkable_of_namespace` applies `LIMIT 2000` with `keys` too (`unlinked` > always passes `limit=SCANNED`). The claim holds only if > `NamespaceValidateInput.keys` cannot match more than 2,000 served > memories; several identities can hold one key. Reword to "the 2,000 last > written under `keys`", or drop the limit when `keys` is given. Reworded in the `code_unlinked_*` contract text, the `unlinked` docstring and the concepts page. `code_rename_edits` reads through the same limit and made the same claim in its contract text and on the page, so it is reworded too. No read changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/concepts/memory.md | 12 ++++++------ server/identity/app/namespace_validate.py | 6 +++--- server/memory/app/code_unlinked.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index ba87cd92042..1b10e66ee8a 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -651,9 +651,9 @@ counts the served memories that name code (a backticked or qualified name, a cal | `code_unlinked_name_unresolved` | lists no `files`, and each name is defined nowhere on trunk or more than once. | | `code_unlinked_pending` | waits for its link; each sample says what it `waits_for`: `link_pass` (the worker has not read this write), `index` (no index yet, or a file that does not parse) or `trunk` (a qualified name trunk does not define yet). | -The counts are of the 2,000 served memories last written (all under `keys` when given), -and only in an org that indexes a repository; a raw tool observation, which is never -linked, is not counted. How far each repository's links trail its +The counts are of the 2,000 served memories last written (of those under `keys` when +given), and only in an org that indexes a repository; a raw tool observation, which is +never linked, is not counted. How far each repository's links trail its index is a gauge, and a health warning when it lasts ([monitoring](../operations/monitoring.md#what-to-alert-on)). @@ -698,9 +698,9 @@ says. A sentence ends after `.`, `!` or `?` and a space (not after a one-letter such as `e.g.`), at a blank line and before a list item; a line break alone does not end one. The words that mark a sentence as being about the name are English, and `call` or `calls` is not one: it is read as calling -the code. The finding reads the 2,000 memories whose `moved` link was last checked (all -under `keys` when given), in the repositories the caller may read, and no high-sensitivity -memory; a link whose code also changed is listed under `code_links_stale`. Neither the +the code. The finding reads the 2,000 memories whose `moved` link was last checked (of +those under `keys` when given), in the repositories the caller may read, and no +high-sensitivity memory; a link whose code also changed is listed under `code_links_stale`. Neither the memory's key, tags, `files`, entities and concepts nor a line number written in its text is edited. diff --git a/server/identity/app/namespace_validate.py b/server/identity/app/namespace_validate.py index 312ecb6b08f..dbed9e9c787 100644 --- a/server/identity/app/namespace_validate.py +++ b/server/identity/app/namespace_validate.py @@ -326,8 +326,8 @@ # What every `code_unlinked_*` check reads (`code_unlinked.unlinked`). _UNLINKED_READ = ( - f"Only the {code_unlinked.SCANNED} served memories last written are read (all under " - "`keys` when given), and only in an org that indexes a repository. A raw tool " + f"Only the {code_unlinked.SCANNED} served memories last written are read (of those " + "under `keys` when given), and only in an org that indexes a repository. A raw tool " "observation is never linked and is not read; a word of the prose counts as a name " "only beside `files`." ) @@ -409,7 +409,7 @@ 1, exceptions=( f"Only the {code_unlinked.SCANNED} memories whose `moved` link was last checked " - "are read (all under `keys` when given), only in repositories the caller may " + "are read (of those under `keys` when given), only in repositories the caller may " "read, and no high-sensitivity memory. A link whose code also changed is " "`code_links_stale`'s." ), diff --git a/server/memory/app/code_unlinked.py b/server/memory/app/code_unlinked.py index d23095f7c02..aa22f4528c2 100644 --- a/server/memory/app/code_unlinked.py +++ b/server/memory/app/code_unlinked.py @@ -80,8 +80,8 @@ async def unlinked( read), the last written first: each with its memory_key and memory_id and, under `pending`, what it `waits_for` (`index`: its repository's first index or a file that does not parse; `trunk`: a qualified name trunk does not define - yet; `link_pass`: the pass to read it). Read of the memories under `keys` when given, - of the `SCANNED` last written otherwise. A memory whose repository the caller may not + yet; `link_pass`: the pass to read it). Read of the `SCANNED` last written, among + those under `keys` when given. A memory whose repository the caller may not read counts as naming none: its cause must not tell what that repository holds. Nothing is read, and nothing counted, in an org that indexes no repository.""" out: dict[str, list[dict[str, str]]] = {cause: [] for cause in CAUSES} From c086f985457cb6eeb6380fbee9154914efee0fea Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:00:00 +0530 Subject: [PATCH 05/21] The env examples no longer set the ingest poller to its default Review nit on the change that turned the ingest poller on by default: > the comment "The stock single-node stack enables the non-LLM indexing > workers" and `LOOM_CODE_INGEST_ENABLED=true` now restate the default; > `deploy/standalone/env.example:63` does the same. Drop the line or > reword the comment so the files do not suggest the setting is needed. Both files drop the line. The stock comment stays for the two workers below it that are off by default. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- .env.example | 2 -- deploy/standalone/env.example | 1 - 2 files changed, 3 deletions(-) diff --git a/.env.example b/.env.example index 28ed3b2efe5..721692e4b59 100644 --- a/.env.example +++ b/.env.example @@ -204,8 +204,6 @@ OPENAI_API_KEY= # LOOM_CODE_GITHUB_TOKEN= # private clones and PR history; empty = public clones, no PR sync # The stock single-node stack enables the non-LLM indexing workers so repositories # added in the dashboard make progress without a second setup step. -# Per-merge fast tier (tree-sitter + embeddings). -LOOM_CODE_INGEST_ENABLED=true # LOOM_CODE_PR_HISTORY_ENABLED=true # merged-PR sync (needs the GitHub token) # Re-embed code rows whose embedding failed. LOOM_CODE_EMBED_RECOVERY_ENABLED=true diff --git a/deploy/standalone/env.example b/deploy/standalone/env.example index 2fd1b812db0..4a2695cc32a 100644 --- a/deploy/standalone/env.example +++ b/deploy/standalone/env.example @@ -60,7 +60,6 @@ OPENAI_API_KEY= # C/C++ compiler indexing needs a project compilation database and scip-clang; # these are repository build prerequisites, not additional running services. # LOOM_CODE_REPOS_JSON=[{"org":"dev","namespace":"code-myrepo","repo":"acme/myrepo","git_branch":"main","public":true}] -LOOM_CODE_INGEST_ENABLED=true LOOM_CODE_EMBED_RECOVERY_ENABLED=true LOOM_CODE_GRAPH_STATS_ENABLED=true LOOM_CODE_SCIP_DELTA_ENABLED=true From 314f75026f6fd62ac5d5b08e6730d535f1f0821d Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:00:20 +0530 Subject: [PATCH 06/21] The file re-hash names the case where a link adopts its last checked lines Review nit on the change that makes a file link follow the lines it cites: > readability. `took`, `first` and `written` carry the whole baseline rule > of `_file_rehashed` in three one-word locals; `took` in particular means > 'no baseline text is readable and the last check matched it'. A name such > as `adopts_checked` would let the branch at line 133 read without the > docstring. `took` is now `adopts_checked`. A rename only. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/code_link_rehash.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/memory/app/code_link_rehash.py b/server/memory/app/code_link_rehash.py index fe738c49212..21cd8e25515 100644 --- a/server/memory/app/code_link_rehash.py +++ b/server/memory/app/code_link_rehash.py @@ -133,10 +133,10 @@ async def cited_at(commit: str, path: str) -> str | None: first = written or await cited_at(a["baseline_commit"], a["baseline_path"]) or "" read = await cited_at(a["checked_commit"], link.path) checked = read or "" - took = not first and link.matched_baseline() - baseline = first or (checked if took else NO_BASELINE) + adopts_checked = not first and link.matched_baseline() + baseline = first or (checked if adopts_checked else NO_BASELINE) out = {"anchored_hash": written, "body_hash": baseline, "checked_hash": checked} - if took and checked: + if adopts_checked and checked: # the next re-hash reads the baseline where this one took it out |= {"baseline_commit": a["checked_commit"], "baseline_path": link.path} # a file that is gone stays gone; lines that cannot be read show no change From b3ec87d2df460cc327a241444393ba35e13fd693 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:00:46 +0530 Subject: [PATCH 07/21] The unread list of via labels is gone Review nit on the change that serves a spelled-out definition second: > `VIA_VALUES` is extended to nine labels but no code or test reads it (the > only reference at this head is its own definition). It had already > drifted from what `_extra_via_labels` serves, which is why this PR had to > add `history`, `card`, `concept` and `hyde` by hand. Delete it, or add a > unit test that the labels `leg_provenance`, `_extra_via_labels` and > `_held_definitions` can produce are all in it. Deleted: nothing read it. The comment above `via` keeps the description. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/code/domain/units.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/server/code/domain/units.py b/server/code/domain/units.py index dd5ded7da95..a9bc359222d 100644 --- a/server/code/domain/units.py +++ b/server/code/domain/units.py @@ -113,22 +113,12 @@ def estimate_unit_tokens(unit: CodeUnit, *, body: str | None = None) -> int: } ) -# Every served unit says which leg found it. `via` is one of VIA_VALUES: a content leg -# or both, the symbol route, or the other leg that proposed a unit neither content leg -# found. The ranks are 1-based positions inside the leg's pool before fusion (0 = the -# leg did not return this chunk). Computed from the leg results BEFORE the fusion priors -# reorder anything, so they answer "what did each leg say", not "where did it end up". -VIA_VALUES: tuple[str, ...] = ( - "lexical", - "vector", - "both", - "symbol", - "definition", - "history", - "card", - "concept", - "hyde", -) +# Every served unit says which leg found it. `via` names a content leg or both +# (`lexical`, `vector`, `both`), the symbol route, or the other leg that proposed a unit +# neither content leg found. The ranks are 1-based positions inside the leg's pool before +# fusion (0 = the leg did not return this chunk). Computed from the leg results BEFORE the +# fusion priors reorder anything, so they answer "what did each leg say", not "where did +# it end up". _DEFAULT_GRANULARITY = "unit" From 01584bd2b1fec5abaa24ab6cc61ba685f2bcba58 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:01:19 +0530 Subject: [PATCH 08/21] A moved-code note reads its line numbers as integers Review nit on the change that makes readers name where moved code is: > `_now` reads the line numbers through `_field`, which turns every value > into a cleaned, truncated string, and then parses them back with > `int(_field(link, 'start_line') or 0)`. Read the two integers directly; > `_field` is for the path and name text. `_now` reads the two integers as they are; `_field` keeps the path and name text. The notes read the same. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/domain/code_change.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/memory/domain/code_change.py b/server/memory/domain/code_change.py index 8405d1065ae..b5fe25f8747 100644 --- a/server/memory/domain/code_change.py +++ b/server/memory/domain/code_change.py @@ -93,9 +93,13 @@ def relocation(link: Mapping[str, Any]) -> tuple[str, str] | None: _NAME_CHARS = 120 +def _value(link: Any, name: str) -> Any: + return link.get(name) if isinstance(link, Mapping) else getattr(link, name, None) + + def _field(link: Any, name: str) -> str: - value = link.get(name) if isinstance(link, Mapping) else getattr(link, name, None) - text = " ".join(str(value or "").replace("`", "'").split()) + """A path or name of `link` as one line of a note.""" + text = " ".join(str(_value(link, name) or "").replace("`", "'").split()) return text if len(text) <= _NAME_CHARS else text[: _NAME_CHARS - 1] + "…" @@ -105,7 +109,7 @@ def _now(link: Any) -> str: path, symbol, was = _field(link, "path"), _field(link, "symbol"), _field(link, "was_symbol") if not symbol: return f"`{_field(link, 'was_path')}` is now `{path}`" - start, end = int(_field(link, "start_line") or 0), int(_field(link, "end_line") or 0) + start, end = int(_value(link, "start_line") or 0), int(_value(link, "end_line") or 0) lines = f":{start}-{end}" if 0 < start <= end else "" name = f"`{symbol}` " if symbol != was else "" return f"`{was}` is now {name}at {path}{lines}" From a182ce2c32f64f414b09d6738819798f7b06358b Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:01:49 +0530 Subject: [PATCH 09/21] A test pins the note for a definition whose module prefix follows its file Review nit on the change that makes readers name where moved code is: > the deleted test `test_a_file_move_names_the_files_not_a_rename` covered > a definition whose module prefix follows its file (`reader::fetch_rows` > to `loader::fetch_rows` in `loader.py`). `memory.ask`'s note now reads > that as a rename (`reader::fetch_rows` is now `loader::fetch_rows` at > loader.py), which is accurate but no test pins the new wording for that > case. One test pins that wording. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- tests/unit/test_memory_code_staleness.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/unit/test_memory_code_staleness.py b/tests/unit/test_memory_code_staleness.py index 8fabcc75e3b..7283c876126 100644 --- a/tests/unit/test_memory_code_staleness.py +++ b/tests/unit/test_memory_code_staleness.py @@ -108,6 +108,25 @@ async def test_a_rename_within_its_file_names_the_old_and_the_new_symbol(monkeyp ) +@pytest.mark.asyncio +async def test_a_module_prefix_that_follows_its_file_reads_as_a_rename(monkeypatch) -> None: + moved = _link( + "m1", + "moved", + qn="loader::fetch_rows", + path="loader.py", + prev="reader.py", + prev_qn="reader::fetch_rows", + ) + _links(monkeypatch, [_head("m1")], [moved]) + note = await ma._annotate_stale_code_memories([_mem("m1")], _IN) + assert note is not None + assert ( + "[m1]: `reader::fetch_rows` is now `loader::fetch_rows` at loader.py" + in note.content_excerpt + ) + + @pytest.mark.asyncio async def test_two_renames_name_what_the_memory_was_written_against(monkeypatch) -> None: renamed = _link("m1", "moved", qn="n::retrieve_rows", path="src/n.py", prev="src/m.py") From fbfd6a9628d980fa3204bbc83054dcfa5118779c Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:02:50 +0530 Subject: [PATCH 10/21] A link-recheck test case says what it asserts Review nit on the change that follows a moved and edited definition past unrelated new definitions: > The case comment "unsure, as before" narrates history. Say what holds > instead: a deletion beside an unrelated addition is not called removed. The comment now says what the case asserts. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- tests/unit/test_memory_code_links.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_memory_code_links.py b/tests/unit/test_memory_code_links.py index b9881626336..889af754e90 100644 --- a/tests/unit/test_memory_code_links.py +++ b/tests/unit/test_memory_code_links.py @@ -2784,7 +2784,7 @@ async def candidates(org, cns, *, names=None, qualified_names=None): "fresh", [("unresolved", "pkg/a.py", "pkg.a::fetch_rows")], ), - # deleted beside the export list, its name nowhere else: unsure, as before + # deleted beside an added export list, its name nowhere else: unsure, not removed (_EXPORTS, {}, "fresh", [("unresolved", "pkg/a.py", "pkg.a::fetch_rows")]), # its name is new in another module over an unrelated text: unsure ( From 8a6650bae7e5dfb61885a11014e54645c88af720 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:03:12 +0530 Subject: [PATCH 11/21] The comment on the cross-file search states its condition in two lines Review nit on the change that follows a moved and edited definition past unrelated new definitions: > The comment above `moved_and_edited` runs to three lines and stacks > "never ... nor ... unless". Two lines would do: searched for a live link > whose same-file answer is certain, or unsure only because no new > definition there is close (`unmatched`). Two lines, stated positively. The condition is unchanged. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/code_link_recheck.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/memory/app/code_link_recheck.py b/server/memory/app/code_link_recheck.py index 7ecc5f9430d..53953b26abc 100644 --- a/server/memory/app/code_link_recheck.py +++ b/server/memory/app/code_link_recheck.py @@ -371,9 +371,8 @@ async def _recheck( if new is None and r.before.state != "missing": renamed = Successor(None, uncertain=True) # cannot tell: a live link is unsure far = new or [] - # found under no name it had: looked for where it may have moved, never for a - # link already missing, nor one the same-file search left unsure, unless the new - # definitions there were each compared with it and none is close + # found under no name it had, and live: looked for where it may have moved when the + # same-file answer is certain, or no new definition there is close (`unmatched`) unsure = renamed.uncertain sought = ( r.lost From e6103888a139d75fac3aaa23d43beaaf20c274ad Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:03:56 +0530 Subject: [PATCH 12/21] A range's turnover is remembered per file limit Review nit on the change that follows a rename across files: > `limit` is a parameter with one caller and one constant value > (`_MAX_ELSEWHERE`), and it is not part of the `_once` key `("turnover", > base, head)`, so a second call with another limit would get the first > call's answer. Drop the parameter or add it to the key. The key now holds the limit. The one caller passes one value, so no answer changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/code_link_pass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/memory/app/code_link_pass.py b/server/memory/app/code_link_pass.py index e9100c400ff..077fd8b8a62 100644 --- a/server/memory/app/code_link_pass.py +++ b/server/memory/app/code_link_pass.py @@ -303,7 +303,7 @@ async def read() -> Turnover | None: pass # the index holds nothing of a file that does not parse return found - return await self._once(("turnover", base, head), read) + return await self._once(("turnover", base, head, limit), read) async def _file_turnover( self, scope: code.IngestScope, base: str, old: str, head: str, now: str, found: Turnover From 00681a2dd863ca5a8c22fe71cca39323516cf8f0 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:03:56 +0530 Subject: [PATCH 13/21] The turnover docstring names every case that returns None Review nit on the change that follows a rename across files: > the docstring says None means the range cannot be read or is too wide, > "counted in `wide_ranges`". None is also returned when no repository > indexes the namespace (`ingest_scope` is None), and only the too-wide > case is counted. The docstring names the three cases and which one is counted. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/code_link_pass.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/memory/app/code_link_pass.py b/server/memory/app/code_link_pass.py index 077fd8b8a62..102570074a1 100644 --- a/server/memory/app/code_link_pass.py +++ b/server/memory/app/code_link_pass.py @@ -269,8 +269,9 @@ async def touched(self, base: str, head: str) -> set[str] | None: async def turnover(self, base: str, head: str, *, limit: int) -> Turnover | None: """The definitions `base..head` brought in and took out of the files it changed, those the ingest would not index left out, a renamed file read as one. None when - the range cannot be read (a force-push, a diff git fails on), or changed more - than `limit` files under the entry's prefixes: counted in `wide_ranges`.""" + the range cannot be read (a force-push, a diff git fails on), when no repository + indexes the namespace, or when the range changed more than `limit` files under + the entry's prefixes: only that last case is counted in `wide_ranges`.""" async def read() -> Turnover | None: changed = await self.range(base, head) From 0d9d248398f4e07abd79860104f157b3f8b913a6 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:04:18 +0530 Subject: [PATCH 14/21] The extraction prompt docstring says a coding session takes no flag-gated block Review nit on the change that gives a coding session its own extraction prompt: > `_extraction_base_prompt(agent_learnings=True, coding_session=True)` now > returns the session prompt and silently drops the agent-learnings block; > on main both were appended. The pipeline never sets both [...], so no > capability is lost, but the docstring does not say the flag is ignored > and tests/unit/test_coding_session_extraction.py:45 passes > `agent_learnings=True` without saying it is asserting that. Fix: one > clause in the docstring ("a coding session takes no flag-gated block") > and the same in the test comment. Both say it. The prompt is unchanged. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/memory/app/extract/prompts.py | 5 +++-- tests/unit/test_coding_session_extraction.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/memory/app/extract/prompts.py b/server/memory/app/extract/prompts.py index e1598558b45..49ae9f51a69 100644 --- a/server/memory/app/extract/prompts.py +++ b/server/memory/app/extract/prompts.py @@ -32,8 +32,9 @@ def _extraction_base_prompt( compact: bool, *, agent_learnings: bool = False, coding_session: bool = False ) -> str: """The extraction system prompt before the preamble: a coding session's own - prompt at every input size, else the full or the compact examples plus the - flag-gated blocks.""" + prompt at every input size, which takes no flag-gated block (`agent_learnings` + is not read for it), else the full or the compact examples plus the flag-gated + blocks.""" if coding_session: return _CODING_SESSION_SYSTEM_PROMPT base_prompt = ( diff --git a/tests/unit/test_coding_session_extraction.py b/tests/unit/test_coding_session_extraction.py index ed0db1b6cb8..82492b92d45 100644 --- a/tests/unit/test_coding_session_extraction.py +++ b/tests/unit/test_coding_session_extraction.py @@ -42,12 +42,12 @@ def system_prompt(existing: list[dict[str, str]] | None) -> str: existing_memories=existing, namespace_categories=None, custom_instructions="", - agent_learnings=True, + agent_learnings=True, # not read for a coding session coding_session=True, ) prompt = system_prompt(None) - # No conversation rule or example and no examples preamble. + # No conversation rule or example, no examples preamble and no flag-gated block. assert prompt == _CODING_SESSION_SYSTEM_PROMPT assert "EXAMPLE 1" not in prompt # Most captures hold nothing to keep, so this prompt is what their call costs. From 4c5d1625014ab33b9f6496b7319a8ad2b8b43130 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:05:00 +0530 Subject: [PATCH 15/21] A test pins the pool cut's depth under the lazy-materialization cap Review nit on the change that marked the pool cut's depth as not a setting: > The marker says a deeper scan reads every candidate's body, yet nothing > pins MAX_DEPTH at or under ClickHouse's lazy-materialization cap. [...] > Raising MAX_DEPTH to 20_000 would pass both files and the tunable gate, > which the marker now silences. [...] Fix, here or in a follow-up: > `assert MAX_DEPTH <= LAZY_LIMIT_CAP` in > test_pool_depths_stay_under_the_lazy_materialization_cap. The test asserts it. With MAX_DEPTH set to 20,000 the test passed before this commit and fails after it. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- tests/unit/test_code_legs_ride_lazy_materialization.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/test_code_legs_ride_lazy_materialization.py b/tests/unit/test_code_legs_ride_lazy_materialization.py index 4b29e2e3c30..2ce46e9c5fa 100644 --- a/tests/unit/test_code_legs_ride_lazy_materialization.py +++ b/tests/unit/test_code_legs_ride_lazy_materialization.py @@ -15,6 +15,7 @@ import pytest from server.code.app.search.state import _POOL, _POOL_KEEP +from server.code.domain.index.pool_cut import MAX_DEPTH from server.code.store.index import CodeRepo # ClickHouse's default for query_plan_max_limit_for_lazy_materialization. @@ -49,6 +50,8 @@ async def _leg_statements() -> list[tuple[str, dict[str, Any]]]: def test_pool_depths_stay_under_the_lazy_materialization_cap() -> None: assert _POOL <= LAZY_LIMIT_CAP assert _POOL_KEEP <= _POOL + # the lexical leg's cut scans this deep at most (`cut_depth`) + assert MAX_DEPTH <= LAZY_LIMIT_CAP @pytest.mark.asyncio From f536f3349539396e7d1934e3e0563cb74fd78dab Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:05:17 +0530 Subject: [PATCH 16/21] The lessons bullet of the memory concepts page is wrapped like its paragraph Review nit on the change that makes readers name where moved code is: > the edited `code.search`/lessons bullet leaves one line unwrapped (`any; > a row another row read for the answer supersedes is not served. > `lessons_left_out` counts the rows the cap, a cut or that rule left`, > about 150 columns) in a paragraph wrapped at about 100. Rewrap it. Rewrapped from that line to the end of the bullet. No word changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/concepts/memory.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index 1b10e66ee8a..e3913efa15d 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -602,10 +602,11 @@ The links are read where the code is: commit that put its code in a changed, unresolved or missing state) when one is known, and `supersedes_key` when it replaces an older row, and `code_moved` (its links to code in the file that is now at another path or symbol than it was written against) when there are - any; a row another row read for the answer supersedes is not served. `lessons_left_out` counts the rows the cap, a cut or that rule left - out. A decision or constraint is served whole or left out. The read runs after the answer, - never enters the search memo, and is skipped for `include_lessons: false`, with - `code_result_lessons` off, or for a token narrowed to its own user or session. + any; a row another row read for the answer supersedes is not served. `lessons_left_out` + counts the rows the cap, a cut or that rule left out. A decision or constraint is served + whole or left out. The read runs after the answer, never enters the search memo, and is + skipped for `include_lessons: false`, with `code_result_lessons` off, or for a token + narrowed to its own user or session. - `code.grep` in matches mode focuses inline lessons on the definitions its matches name in trunk files. When selecting files to read, grep prefers files with a current lesson linked to a matched definition at the returned From 752dec24e4a6c61f36a73708e54535b8423c29a7 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:06:12 +0530 Subject: [PATCH 17/21] The paragraph on following a renamed definition and rolling-upgrade entry 66 are wrapped evenly Review nits on the two changes that follow a moved and edited definition and a rename across files: > The added sentence starts mid-line and runs to about 105 characters in a > paragraph wrapped near 90, and the next sentence is broken after "is" > onto a two-word line. Rewrap the paragraph. > the new paragraph is hard-wrapped unevenly ("Two definitions that may be > it," and "first. A" end short lines mid-sentence), and the same is true > of entry 66 in docs/architecture/rolling-upgrades.md, where one line > runs past the others. Re-wrap. The paragraph is rewrapped from its first short line to its end, and entry 66 whole. No word changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/architecture/rolling-upgrades.md | 8 +++--- docs/concepts/memory.md | 36 +++++++++++++-------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/docs/architecture/rolling-upgrades.md b/docs/architecture/rolling-upgrades.md index def3d88b90f..5264cc37724 100644 --- a/docs/architecture/rolling-upgrades.md +++ b/docs/architecture/rolling-upgrades.md @@ -964,10 +964,10 @@ See the [participant lifecycle baseline](cells.md#participant-lifecycle-baseline (`server/code/domain/successor.py::elsewhere`): N's link recheck follows it; N-1's reads the link `missing`, as before. One host rechecks a repository at a time, so a range is read by one build. A `missing` link is never handed to a definition added - since, so a link N-1 read `missing` during the rollout stays `missing` under N - until its own name returns. The link rows are unchanged; `wide_ranges` is one more - number in the `memory_code_links` pass outcome, which every build serves as stored. No gate holds the - rollout. + since, so a link N-1 read `missing` during the rollout stays `missing` under N until + its own name returns. The link rows are unchanged; `wide_ranges` is one more number + in the `memory_code_links` pass outcome, which every build serves as stored. No gate + holds the rollout. ## What checks them diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index e3913efa15d..24460140895 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -475,25 +475,23 @@ definition under 30 tokens is told by neither its text nor its own name, which a may define: it is followed there only under a name of the same words (`_read_rows` or `read_rows_v2` for `read_rows`) and with its scope, from module level to module level or, once no member of its class is left in its file, into the class that is that one -renamed or keeps its members. Two definitions that may be it, -or one that another removed definition may have become, leave the link `unresolved`. A -range that changed more than 32 files under the entry's `path_prefixes` is not searched -this way, and a warning in the server log names it; nor is a range whose diff cannot be -read. Over such a range a live link is read as if nothing was renamed. An `unresolved` -link is looked for from the commit its code was last read at, so its range grows with -every commit. While that range is searched, the link is followed once one definition -that may be it is left. Over a range that is not searched it stays `unresolved`, and no -later commit narrows that range. The `memory_code_links` worker's pass outcome counts in -`wide_ranges` the ranges its own pass followed, not those a `code.refresh` call followed -first. A -namesake that was already there never inherits a link, and a `missing` link comes back -only when its own name does. A definition moved to another file under its own name with -an edit is followed there when its text is close to the one the link last read. A new -definition left where it was stops that search only when it may be the old one under a -new name: an export list or an unrelated function added beside it does not. The search -for a definition renamed as it moved is not made past a new definition left there, -unless that one is another definition renamed alone. A name gone from its file is -looked for in the files changed +renamed or keeps its members. Two definitions that may be it, or one that another removed +definition may have become, leave the link `unresolved`. A range that changed more than +32 files under the entry's `path_prefixes` is not searched this way, and a warning in the +server log names it; nor is a range whose diff cannot be read. Over such a range a live +link is read as if nothing was renamed. An `unresolved` link is looked for from the +commit its code was last read at, so its range grows with every commit. While that range +is searched, the link is followed once one definition that may be it is left. Over a +range that is not searched it stays `unresolved`, and no later commit narrows that range. +The `memory_code_links` worker's pass outcome counts in `wide_ranges` the ranges its own +pass followed, not those a `code.refresh` call followed first. A namesake that was +already there never inherits a link, and a `missing` link comes back only when its own +name does. A definition moved to another file under its own name with an edit is followed +there when its text is close to the one the link last read. A new definition left where +it was stops that search only when it may be the old one under a new name: an export list +or an unrelated function added beside it does not. The search for a definition renamed as +it moved is not made past a new definition left there, unless that one is another +definition renamed alone. A name gone from its file is looked for in the files changed since its last check as the mirror holds them, beside the index, so a definition moved by a commit the index has not taken in whole (past `code_ingest_max_files_per_commit`) is followed when the link is rechecked. When `memory_code_links_mirror_naming_files` or more From b157488eb456ed159f306be58597a656155901e3 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:06:29 +0530 Subject: [PATCH 18/21] The rename-edits paragraph of the memory concepts page is wrapped at its width Review nit on the change that lists the edits a followed rename allows: > one unwrapped line ("...or the one `reason` no edit is offered. The > finding's `totals` count the memories by `edits` and by reason. Loom") > in a paragraph otherwise wrapped at about 90 columns; rewrap. Rewrapped from that line to the end of the paragraph. No word changes. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/concepts/memory.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/concepts/memory.md b/docs/concepts/memory.md index 24460140895..0973546d416 100644 --- a/docs/concepts/memory.md +++ b/docs/concepts/memory.md @@ -660,11 +660,12 @@ A `moved` link is at its code, and the memory's text may still name the old defi path. `namespace.validate` lists each memory whose text does under the `info` finding `code_rename_edits`, with either the `edits` its text allows (replace `old` with `new` from `start` to `end`, counted in Unicode code points of the text, where the text reads -`old`) and the `content_sha256` they are of, or the one `reason` no edit is offered. The finding's `totals` count the memories by `edits` and by reason. Loom -writes nothing: to apply an edit, read the sentence it changes, then call `memory.update` -on the key with the revised text and `if_match_sha256` set to the listed hash. That is a -revision by the caller, with its conflict check, and it is refused when the memory changed -after the report read it. The link pass then links the revised memory where the code is. +`old`) and the `content_sha256` they are of, or the one `reason` no edit is offered. The +finding's `totals` count the memories by `edits` and by reason. Loom writes nothing: to +apply an edit, read the sentence it changes, then call `memory.update` on the key with the +revised text and `if_match_sha256` set to the listed hash. That is a revision by the +caller, with its conflict check, and it is refused when the memory changed after the +report read it. The link pass then links the revised memory where the code is. An edit is offered only for a name written as code (a whole backticked identifier, an `A::b`, or a call written `a.b(` or `name()`) and for a whole repository path, in the From 28de679db59a3d1c68c95151815a2aa0efb77b73 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:06:59 +0530 Subject: [PATCH 19/21] The extraction page gives where a session fact's valid_at comes from, in order Review nit on the change that gives a coding session its own extraction prompt: > The page says the extractor sets no `valid_at` on a session capture's > fact and that the row takes `valid_at` from `temporal_anchor` or the > observation date. Two unchanged paths set it first: > `apply_message_timestamps` [...] writes the cited turn's time into > `temporal_anchor` and `valid_at` when the capture's messages carry a > `timestamp`, and the write step prefers the call's own `valid_at` [...]. > Fix: say the prompt does not ask for `valid_at`, and name the turn > timestamp and the per-call default ahead of the anchor and the > observation date. The page gives the four sources in the order the write step reads them. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/memory/extraction.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/features/memory/extraction.md b/docs/features/memory/extraction.md index 4508a92e5fe..257b260f262 100644 --- a/docs/features/memory/extraction.md +++ b/docs/features/memory/extraction.md @@ -91,11 +91,14 @@ keep and the prompt is then what the call costs. What the user states that holds the session is kept: a standing rule, a preference, a decision, a fact about their setup. What the user asks for the task alone is not. Its schema asks for the fields a coding fact uses and for the end of a state the user bounds (`valid_to`, `foresight`), so a freeze -"until Friday" stops being served after that day. The extractor sets no `valid_at`, -`temporal_confidence`, occurrence record or `question_topic` on a session capture's fact; -the row takes its `valid_at` from the fact's `temporal_anchor` when that is not in the -future, else from the observation date. From the work, only knowledge about the codebase -that a later session in the repository can reuse without reading the code again is kept: +"until Friday" stops being served after that day. The prompt asks for no `valid_at`, +`temporal_confidence`, occurrence record or `question_topic` on a session capture's fact. +The row takes its `valid_at` from the time of the latest turn the fact cites, when the +capture's messages carry a `timestamp` and the fact's `temporal_anchor` names no other day +or time of day; else from the call's own `valid_at`; else from the fact's `temporal_anchor` +when that is not in the future; else from the observation date. From the work, only +knowledge about the codebase that a later session in the repository can reuse without +reading the code again is kept: - how a behaviour is reached across definitions or files, as one claim for the whole path; - a relation between definitions that reading one of them does not show; From 0448ce63d085e9bd73820ad5de625ebfab1579af Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:07:21 +0530 Subject: [PATCH 20/21] The extraction page sizes the session prompt in characters, as its test does Review nit on the change that gives a coding session its own extraction prompt: > "about 2,700 tokens where the conversation prompt is 20,000 to 34,000" > gives token counts with no model or tokenizer, and disagrees with the > comment above `_COMPACT_EXAMPLE_IDS` [...]. The only pinned size is > `len(prompt) < 9000` characters in the test. Fix: state the size the > test pins (under 9,000 characters, against roughly 86,000 for the full > conversation prompt), or name the tokenizer and make the comment and the > page agree. The page gives characters: under 9,000, which the test pins, against about 57,000 for the compact conversation prompt and 86,000 for the full one. Measured with len(): 8,058, 56,898 and 86,041. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/memory/extraction.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/features/memory/extraction.md b/docs/features/memory/extraction.md index 257b260f262..90d828b132e 100644 --- a/docs/features/memory/extraction.md +++ b/docs/features/memory/extraction.md @@ -85,20 +85,20 @@ The rules in `server/memory/domain/durable_facts.py` match sentence shape, not t a release changed is kept; whether its CI was green at the time is dropped. A plugin's session capture (a `source:` tag) is extracted with a prompt of its own, at -every capture size. It holds no conversation rule or example, and is about 2,700 tokens -where the conversation prompt is 20,000 to 34,000, because most captures hold nothing to -keep and the prompt is then what the call costs. What the user states that holds beyond -the session is kept: a standing rule, a preference, a decision, a fact about their setup. -What the user asks for the task alone is not. Its schema asks for the fields a coding fact -uses and for the end of a state the user bounds (`valid_to`, `foresight`), so a freeze -"until Friday" stops being served after that day. The prompt asks for no `valid_at`, -`temporal_confidence`, occurrence record or `question_topic` on a session capture's fact. -The row takes its `valid_at` from the time of the latest turn the fact cites, when the -capture's messages carry a `timestamp` and the fact's `temporal_anchor` names no other day -or time of day; else from the call's own `valid_at`; else from the fact's `temporal_anchor` -when that is not in the future; else from the observation date. From the work, only -knowledge about the codebase that a later session in the repository can reuse without -reading the code again is kept: +every capture size. It holds no conversation rule or example, and is under 9,000 +characters where the conversation prompt is about 57,000 for a short input and 86,000 for +a longer one, because most captures hold nothing to keep and the prompt is then what the +call costs. What the user states that holds beyond the session is kept: a standing rule, a +preference, a decision, a fact about their setup. What the user asks for the task alone is +not. Its schema asks for the fields a coding fact uses and for the end of a state the user +bounds (`valid_to`, `foresight`), so a freeze "until Friday" stops being served after that +day. The prompt asks for no `valid_at`, `temporal_confidence`, occurrence record or +`question_topic` on a session capture's fact. The row takes its `valid_at` from the time +of the latest turn the fact cites, when the capture's messages carry a `timestamp` and the +fact's `temporal_anchor` names no other day or time of day; else from the call's own +`valid_at`; else from the fact's `temporal_anchor` when that is not in the future; else +from the observation date. From the work, only knowledge about the codebase that a later +session in the repository can reuse without reading the code again is kept: - how a behaviour is reached across definitions or files, as one claim for the whole path; - a relation between definitions that reading one of them does not show; From b1aabf5c4132ea48abc6540451cf2a631f3ee3d9 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 15:07:56 +0530 Subject: [PATCH 21/21] The pending-link check states which writes it counts under their cause for one pass Review nit on the change that publishes no-link causes: > `has_read` compares the memory's `version` (the writer's clock, at write > time) with the queue cursor's `queued_at` (ClickHouse's clock, at queue > insert). A write with `version <= read_to < queued_at` (an insert in > flight, or clock skew between the server host and ClickHouse) is counted > under `code_unlinked_name_unresolved` or `code_unlinked_file_not_indexed` > instead of `code_unlinked_pending` until the next pass reads it. Info > severity and transient; the check's `uncertainty` text should say so, or > the read should allow a margin. `code_unlinked_pending`'s `uncertainty` text and the `has_read` docstring say so. The comparison is unchanged. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- server/identity/app/namespace_validate.py | 4 +++- server/memory/app/code_unlinked.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/identity/app/namespace_validate.py b/server/identity/app/namespace_validate.py index dbed9e9c787..3b474961b8a 100644 --- a/server/identity/app/namespace_validate.py +++ b/server/identity/app/namespace_validate.py @@ -446,7 +446,9 @@ exceptions=_UNLINKED_READ, uncertainty=( "While the link pass backfills earlier writes, a memory it has not reached is " - "counted here even when nothing of it will resolve." + "counted here even when nothing of it will resolve. A write queued after the " + "pass's position with an earlier write time (an insert in flight, a writer " + "clock behind ClickHouse's) is counted under its cause until the next pass." ), ), } diff --git a/server/memory/app/code_unlinked.py b/server/memory/app/code_unlinked.py index aa22f4528c2..921016dd19f 100644 --- a/server/memory/app/code_unlinked.py +++ b/server/memory/app/code_unlinked.py @@ -65,7 +65,9 @@ async def read(cls) -> _Pass: def has_read(self, org: str, memory: dict[str, Any]) -> bool: """The pass read `memory` as it is now: written before the queue position and, while the backfill runs, at or before the identity it has reached. A version is - the write's wall-clock time in ns.""" + the write's wall-clock time in ns, and the position is ClickHouse's time at the + queue insert: a write queued after the position with an earlier version (an + insert in flight, a writer clock behind) reads as read until the next pass.""" if not self.read_to or int(memory["version"]) // 1000 > self.read_to: return False ident = (org, *(str(memory[c]) for c in IDENTITY[1:]))