From e68d0c0c4472a8083132605e9b4d8965ca234efc Mon Sep 17 00:00:00 2001 From: zlareb1 Date: Thu, 19 Nov 2026 11:10:06 +0000 Subject: [PATCH 1/4] Explain duplicate checks and regression candidates in run history Signed-off-by: zlareb1 --- docs/use-cases/runs-and-pr-history.md | 22 +++++++++++++++------- llms.txt | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/use-cases/runs-and-pr-history.md b/docs/use-cases/runs-and-pr-history.md index 8a6ae75f47..f29400db97 100644 --- a/docs/use-cases/runs-and-pr-history.md +++ b/docs/use-cases/runs-and-pr-history.md @@ -1,12 +1,20 @@ # Agent runs, traces and PR history -Loom records the work coding agents do, as runs and searchable session conversations, and -connects it to your code history. Runs carry goals and outcomes, and model costs when the -Claude Code plugin reports the session's turn usage (on by default). The history covers -merged pull requests, review comments, GitHub issues and, with a tracker source, incidents -and CI runs. Conversation recording, PR history and the tracker are each off until turned -on. An agent or a person can then ask what was tried before, what was decided and which -change introduced a regression. +Loom records agent runs and conversations, checks bug drafts for duplicates and ranks +candidate regression PRs without building the code. + +Runs carry goals and outcomes, and model costs when the Claude Code plugin reports the +session's turn usage (on by default). The history covers merged pull requests, review +comments, GitHub issues and, with a tracker source, incidents and CI runs. Conversation +recording, PR history and the tracker are each off until turned on. An agent or a person +can then ask what was tried before, what was decided and which changes to investigate +for a regression. + +Duplicate checks need a registered tracker source and a namespace the caller may read. +PR ranking needs indexed merged-PR history with `LOOM_CODE_PR_HISTORY_ENABLED=true`. +The [bug draft to candidate PRs](../features/tracker/overview.md#from-a-bug-draft-to-candidate-prs) +walkthrough connects both operations. Candidate ranking neither runs a bisect nor proves +which change caused the bug. ## What you get diff --git a/llms.txt b/llms.txt index 1d37069222..f96c80a06a 100644 --- a/llms.txt +++ b/llms.txt @@ -27,7 +27,7 @@ Start with [the docs map](docs/index.md). To install Loom, a coding agent reads - [Document search and RAG for agents](docs/use-cases/document-search.md): Loom indexes your documents (Markdown and text, and PDF, `.docx` and `.pptx` files that its extractor service converts) and lets agents search them with citations over MCP, HTTP or the SDKs. - [Memory linked to code for coding agents](docs/use-cases/memory-linked-to-code.md): Loom links coding agents' memories to the functions, classes and files they name, follows them through refactors, and flags a memory when its code changes. - [Shared context for multi-agent workflows](docs/use-cases/multi-agent.md): Loom is a self-hosted MCP server for multi-agent memory, with namespace-scoped tokens and separate read and write roles. -- [Agent runs, traces and PR history](docs/use-cases/runs-and-pr-history.md): Loom records the work coding agents do, as runs and searchable session conversations, and connects it to your code history. +- [Agent runs, traces and PR history](docs/use-cases/runs-and-pr-history.md): Loom records agent runs and conversations, checks bug drafts for duplicates and ranks candidate regression PRs without building the code. - [Self-hosted agent memory on ClickHouse](docs/use-cases/self-hosted-clickhouse.md): Loom runs on your own infrastructure, with Docker or on Kubernetes with its Helm chart, and stores agent memory, documents, conversations and code indexes as tables in ClickHouse. ## FAQ and glossary From a6b0f9e0613c0e771bb0af3934bc00bd58257dae Mon Sep 17 00:00:00 2001 From: zlareb1 Date: Thu, 19 Nov 2026 11:14:20 +0000 Subject: [PATCH 2/4] Keep PR-history setup routes in the existing walkthrough Signed-off-by: zlareb1 --- docs/use-cases/runs-and-pr-history.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/use-cases/runs-and-pr-history.md b/docs/use-cases/runs-and-pr-history.md index f29400db97..b1ebcefa53 100644 --- a/docs/use-cases/runs-and-pr-history.md +++ b/docs/use-cases/runs-and-pr-history.md @@ -11,9 +11,8 @@ can then ask what was tried before, what was decided and which changes to invest for a regression. Duplicate checks need a registered tracker source and a namespace the caller may read. -PR ranking needs indexed merged-PR history with `LOOM_CODE_PR_HISTORY_ENABLED=true`. The [bug draft to candidate PRs](../features/tracker/overview.md#from-a-bug-draft-to-candidate-prs) -walkthrough connects both operations. Candidate ranking neither runs a bisect nor proves +walkthrough covers tracker access and PR-history setup for both operations. Candidate ranking neither runs a bisect nor proves which change caused the bug. ## What you get From 69f6604b40bec45485d5461f0b1a78acb9ab2262 Mon Sep 17 00:00:00 2001 From: zlareb1 Date: Fri, 20 Nov 2026 20:52:44 +0000 Subject: [PATCH 3/4] Describe run history and duplicate checks in page metadata Signed-off-by: zlareb1 --- docs/use-cases/runs-and-pr-history.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/use-cases/runs-and-pr-history.md b/docs/use-cases/runs-and-pr-history.md index b1ebcefa53..d961c50d99 100644 --- a/docs/use-cases/runs-and-pr-history.md +++ b/docs/use-cases/runs-and-pr-history.md @@ -1,3 +1,8 @@ +--- +title: Agent run history, duplicate checks and regression candidates +description: Record scoped agent runs and conversations, check tracker-backed bug drafts for duplicates and inspect candidate pull requests without claiming a proven cause. +--- + # Agent runs, traces and PR history Loom records agent runs and conversations, checks bug drafts for duplicates and ranks From 96be03c3d5fa4062c8ca44226a5e138642c86504 Mon Sep 17 00:00:00 2001 From: zlareb1 Date: Fri, 20 Nov 2026 21:40:07 +0000 Subject: [PATCH 4/4] Replicated erasure fixtures provide isolated write leases Fenced memory inserts require a lease table in the selected schema. Give each fixture database its own Keeper root while preserving the replicated content checks. Signed-off-by: zlareb1 --- .../integration/test_erasure_replicated_ch.py | 5 + tests/unit/test_erasure_replicated_fixture.py | 96 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 tests/unit/test_erasure_replicated_fixture.py diff --git a/tests/integration/test_erasure_replicated_ch.py b/tests/integration/test_erasure_replicated_ch.py index a1fa3f60c9..611f07969d 100644 --- a/tests/integration/test_erasure_replicated_ch.py +++ b/tests/integration/test_erasure_replicated_ch.py @@ -74,6 +74,11 @@ def db(raw: Any, monkeypatch: pytest.MonkeyPatch) -> Iterator[str]: parameters={"db": name}, ).result_rows assert engines == [(True,)] + # Fenced memory inserts need leases isolated from the source schema's keys. + raw.command( + f"CREATE TABLE {name}._migration_lock AS {source}._migration_lock " + f"ENGINE = KeeperMap('/{name}/_migration_lock') PRIMARY KEY name" + ) monkeypatch.setattr(settings, "ch_database", name) yield name finally: diff --git a/tests/unit/test_erasure_replicated_fixture.py b/tests/unit/test_erasure_replicated_fixture.py new file mode 100644 index 0000000000..3147871591 --- /dev/null +++ b/tests/unit/test_erasure_replicated_fixture.py @@ -0,0 +1,96 @@ +"""The replicated erasure fixture supplies an isolated write-lease store.""" + +from __future__ import annotations + +from types import SimpleNamespace + +import pytest + +from server.core import leases +from server.settings import settings +from tests.integration import test_erasure_replicated_ch as replicated +from tests.unit.claims_fake import FakeLockTable + + +class Schema: + def __init__(self): + self.tables = {} + self.commands = [] + + def command(self, sql): + self.commands.append(sql) + if sql.startswith("CREATE TABLE "): + self.tables[sql.split()[2]] = sql + + def query(self, sql, parameters=None): + if "engine_full" in sql: + assert parameters["db"] == "source_schema" + return SimpleNamespace(result_rows=[("ReplacingMergeTree(version) ORDER BY tuple()",)]) + assert "SELECT DISTINCT engine" in sql + flags = {"ENGINE = Replicated" in ddl for ddl in self.tables.values()} + return SimpleNamespace(result_rows=[(flag,) for flag in sorted(flags)]) + + +class FixtureLocks(FakeLockTable): + def __init__(self, schema): + super().__init__() + self.schema = schema + + async def query_one(self, sql, params=None): + if "loom._migration_lock" in sql: + if f"{settings.ch_database}._migration_lock" not in self.schema.tables: + raise RuntimeError("Unknown table _migration_lock") + return await super().query_one(sql, params) + + +@pytest.fixture +def isolated_schema(monkeypatch): + monkeypatch.setattr(settings, "ch_database", "source_schema") + schema = Schema() + stream = replicated.db.__wrapped__(schema, monkeypatch) + name = next(stream) + try: + yield schema, name + finally: + stream.close() + assert schema.commands[-1] == f"DROP DATABASE IF EXISTS {name} SYNC" + + +async def test_replicated_erasure_fixture_can_take_and_release_a_write_lease(isolated_schema): + schema, name = isolated_schema + keeper = FixtureLocks(schema) + lease = await leases.take("memory_insert/fixture", ttl_s=60, ch=keeper) + assert lease is not None and lease.held + assert settings.ch_database == name + await lease.release() + assert keeper.keys == {} + + +async def test_a_missing_fixture_lease_table_still_refuses(isolated_schema): + schema, name = isolated_schema + schema.tables.pop(f"{name}._migration_lock", None) + with pytest.raises(leases.LeaseUnavailable): + await leases.take("memory_insert/fixture", ttl_s=60, ch=FixtureLocks(schema)) + + +def test_fixture_lease_paths_are_separate_from_source_and_each_other(monkeypatch): + paths = [] + for _ in range(2): + with monkeypatch.context() as patch: + patch.setattr(settings, "ch_database", "source_schema") + schema = Schema() + stream = replicated.db.__wrapped__(schema, patch) + name = next(stream) + try: + ddl = schema.tables[f"{name}._migration_lock"] + assert "AS source_schema._migration_lock" in ddl + assert f"KeeperMap('/{name}/_migration_lock')" in ddl + assert "PRIMARY KEY name" in ddl + assert all( + "ENGINE = Replicated" in schema.tables[f"{name}.{table}"] + for table in replicated._TABLES + ) + paths.append(name) + finally: + stream.close() + assert paths[0] != paths[1]