Repository navigation
A dispatched hosted workflow measures how many source worker copies one Loom process keeps served - #2196
A dispatched hosted workflow measures how many source worker copies one Loom process keeps served#2196zlareb1 wants to merge 3 commits into
Conversation
…ne Loom process keeps served The MCP source worker copy capacity workflow starts ClickHouse and Postgres, Loom from the checkout with worker copies on, the bundled worker's read and enrollment service and two owned synthetic MCP upstreams (resource and mapped tool) with set latencies and per-resource faults. bench/source_worker_copies.py registers N snapshot and selected_refresh sources of M resources each through the setup operations, runs a fixed number of sync passes in its own process, and writes one JSON file of fixed shape: per-copy and per-check latency, copies confirmed per pass, listing lapses, pass bound marks and the worker's 429s. Only a harness error fails the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| LOOM_KNOWLEDGE_SOURCE_SYNC_ENABLED: "false" | ||
| LOOM_KNOWLEDGE_MIRRORED_SOURCES_ENABLED: "true" | ||
| LOOM_KNOWLEDGE_SOURCE_WORKER_COPIES_ENABLED: "true" | ||
| LOOM_KNOWLEDGE_SOURCE_SYNC_INTERVAL_SECONDS: "60" |
There was a problem hiding this comment.
Pass spacing ignores sync interval
Medium Severity
pass_interval is a workflow input and the driver spaces run_sync() with it, including back-to-back when it is 0. LOOM_KNOWLEDGE_SOURCE_SYNC_INTERVAL_SECONDS stays hardcoded at 60, and the copy turn uses that setting for how soon an unconfirmable copy would lapse before the next pass. A non-default spacing retires or keeps copies on a cadence the harness is not actually running, so served-copy and lapse figures no longer match the pass schedule.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c8562ce. Configure here.
…its document through a stopped run Every worker source is mirrored, so the pass result never records the mirrored phase running out of time. The driver now counts the sources with no turn in a pass (`sources_not_reached`, per pass and in total) and calls a pass cut when one is left or a turn was cut. It writes the metrics document after every pass by replacing the file whole, refuses passes times the pass interval beyond the Measure step's budget less a setup allowance, records an HTTP failure or an unreadable harness file as a harness error in the document instead of exiting with a traceback, and reports per-turn time percentiles in place of turn fields it never emitted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8f5fde3. Configure here.
…ts document through any failure A turn the sync records as failed after it raised is now a recorded turn with the status raised:<ExceptionName>, so it no longer counts as a source the pass ran out of time before. Any failure of the run is recorded beside the passes already finished instead of replacing them, and the document is written before and after setup too. The running guide says what a pass bound mark means for each bound, names the raised outcome and the ClickHouse log, wraps at the house width, and says why the sync interval stays set though the server's sync is off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>


Related: #2165
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):
None: a dispatched qualification workflow only.
Why
The source worker copy path keeps copies served only while each one's access is confirmed within
knowledge_source_acl_stale_seconds. A process sends copies and checks one at a time within the mirrored phase, so the number of copies one deployment keeps served has a bound (the boundary page's Capacity paragraph), and nothing measures it yet. This workflow measures it on a free GitHub-hosted runner with owned synthetic upstreams, so the next change can be sized from numbers, not estimates. It measures; it gates nothing.Scope and risk
Workflow:
.github/workflows/mcp-source-worker-capacity.ymlruns onworkflow_dispatchonly, onubuntu-24.04, with a 90-minute limit and the same pinned action shas asci.yml.dev/ci_start_*.sh, the fixture, and Loom from source withknowledge_source_worker_copies_enabledon. Loom's own sync worker is off, so the driver runs every pass.Fixture (
bench/source_worker_copies_fixture.py), run in the source worker's own environment:preparewrites keys and certificates, the worker config with a resource profile and a mapped-tool profile, the routes file, and one synthetic account per collection and profile.serveruns the bundled worker's read and enrollment services behind an mTLS listener, the two synthetic MCP upstreams over TLS with configurable latency and fault kinds, and a loopback stats endpoint.Driver (
bench/source_worker_copies.py):tests/integration/crawl_native_privacy.pydoes. No shipped client changes.run_sync()a fixed number of times in its own process and times each copy and check by wrapping the turn's exchange. A unit test pins both hooks so a rename fails loudly.Metrics: schema
loom.bench.source_worker_copies.v1, per pass and in total:overloadedand worker-side 429 counts;The driver writes the whole document before setup, after setup and after every pass, so a stopped run keeps what it measured. A turn that raises is recorded as
raised:<Type>and counts as reached, sosources_not_reachedmeans only that the mirrored phase's time ran out first. It refuses runs whose passes times pass interval exceed 3600 s (the 75-minute step less a setup allowance). The run fails only on harness errors, which are recorded in the document, never on capacity figures.LOOM_KNOWLEDGE_SOURCE_SYNC_INTERVAL_SECONDSis set to 60 although the server's own sync is off: the copy path's lapsing age reads it during every pass, so it shapes how a copy that keeps answeringunsupportedis retired. The workflow comment and the docs say so.Docs: a "Source worker copy capacity" section in
docs/benchmarks/running.md, an entry inbench/README.md, and one linking sentence in the boundary page's Capacity paragraph. No results are claimed.What this harness could not do without a server change, for a later PR:
Compatibility, rollout and rollback
gh workflow run mcp-source-worker-capacity.yml -f sources=200 -f resources=20. The inputs are listed in the docs section.Tests
tests/unit/test_bench_source_worker_copies.py(39 tests) covers the metrics schema, percentile math, input parsing and the run-length budget, the fault table, unreached sources counting as a cut pass, a raising turn counting as reached, an unexpected error keeping the finished passes, the document written after every pass, harness errors recorded in the document, and the two hooks the driver wraps.test_public_copy.pyandtest_doc_links.py: 335 passed.ruff formatandruff checkon the new Python files, and the prose checker on the new doc section.prepareruns in the worker venv, and Loom'sload_worker_routesloads its routes file. The upstream app answers each fault kind as expected when driven in-process.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 wrote the workflow, fixture, driver and tests. I set the scope (measure, do not gate; no shipped client declares session protection) and checked the setup path against the operations.
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/describe the system as it now is.🤖 Generated with Claude Code
Note
Low Risk
Benchmark and CI-only additions with no production server or API wire changes; internal sync hooks are wrapped only inside the harness process.
Overview
Adds measurement-only CI for source worker copy capacity: how many owner-only worker copies a single Loom process can keep served under sync pass bounds.
A new manual-dispatch workflow (
.github/workflows/mcp-source-worker-capacity.yml) boots ClickHouse, Postgres, Loom from the checkout (worker copies on, built-in sync off), a fixture that runs the bundled source worker plus two synthetic MCP upstreams, thenbench/source_worker_copies.py. The driver registers sources via the real HTTP setup path, injects per-resource upstream faults after setup, and runs spacedrun_sync()passes in-process while monkey-patching sync turn/exchange to record copy/check latency, pass cuts, listing lapses, and worker stats. Results land insource-worker-copies.json(loom.bench.source_worker_copies.v1); the run fails only on harness errors, not on capacity numbers. Docs (running.md,bench/README.md, architecture boundary) and unit tests for config, metrics shape, and the patch seams accompany the harness.Reviewed by Cursor Bugbot for commit a18c1d3. Bugbot is set up for automated code reviews on this repo. Configure here.