Repository navigation
Conversation
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
This reverts commit 43642ce. Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The earlier changes corrected the reported type errors, documented the metadata tables, classified live reads, and regenerated the SDK and settings snapshots. The focused checks passed. Fresh source review and required hosted checks are pending; setup, stored copy writes and native retirement remain disabled. |
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The full CI run for
The base commit's CI run already failed seven of the same unit and isolation job categories. That comparison does not clear any required check. The changes above still need a new exact-head run and an independent whole-diff review. This draft remains limited to the protected live read path; it does not enable a deployment, stored copies, or the refresh worker. |
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
Independent review of
The exact head passed hosted lint and type checks. Both PostgreSQL storage jobs are still running, so the local revision is not published yet. A new independent review and exact-head hosted run are required after the next push. No activation is proposed by this draft. |
|
Hosted workflow New head |
|
Independent review of The exact-head HTTP schema job failed in |
|
Exact head
The overall required workflow failed; separate unit and isolation jobs are red, and the separate HTTP contract workflow still records the input generation health check failure noted above. The independent review requests verification. This head cannot merge. The storage result covers the live-read control and its fence; it does not qualify scheduled refresh, stored document copies, or a real upstream provider. |
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Resolve the current enrollment, account realm, and worker approval before checking selection for a team reader. Keep unselected owner requests out of the approval lookup. Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
|
The formatter failed on PR job: https://github.com/ClickHouse/loom/actions/runs/45862140452/job/140055809389 |
End the worker read timeout before retaining the protected result. The retention path still validates session and source authority under its bounded delivery deadline. Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…rasure docstrings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…e; drop unreachable checks - _alias_tied reads each owner's verified spellings once for both registries. - WorkerReadChannel and open_worker_routes no longer recheck bounds the routes file and module constants already fix. - Revert an unrelated docstring rewrap in steps_pg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…cross both scans Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…typed fields make dead - pg_worker_row_lock.fetchrow_for_share reads FOR SHARE NOWAIT and raises WorkerRowBusy, so the directory no longer imports the driver. - WorkerProfile and WorkerRoute stop re-checking types the routes file already fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…e strict model's shapes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…lock; TLS checked by the channel - pg_worker_row_lock.require_authority_transaction replaces four differently worded copies. - WorkerRoute no longer repeats the channel's TLS verification check. - Tests: the busy-row fake states its transaction; the routes file refuses wrong-shape profiles the dataclass now trusts it for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…one guard per write - test_owner_deletion_keeps_worker_rows_written_after_the_cutoff passes every spelling, as callers do (hosted unit part 5). - Route-file errors name a profile's org as [org]. - issue_challenge relies on lock_account's guard; the guard's pg-disabled refusal is tested; enrollment tests assert statement order without the guard's own check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…control Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com> # Conflicts: # server/transport/mcp.py
…time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
| await _revoke(account, credential=credential, deadline=deadline) | ||
| if erase_owner: | ||
| async with asyncio.timeout(settings.knowledge_connected_stop_timeout_s): | ||
| await _erase_worker_owners(subjects, org, found, spellings) |
There was a problem hiding this comment.
Repair timeout starves worker erasure
Medium Severity
stop_subjects now runs _erase_worker_owners under a second full knowledge_connected_stop_timeout_s window after the account-stop loop. SCIM DELETE's error tail wraps the whole stop_connections call in one timeout of that same duration, so time spent stopping accounts leaves none for worker erasure, and the repair swallows the timeout. A failed delete can therefore leave mcp_worker_* rows in place until a later retry.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit fee9f7b. Configure here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ot starve it - pg_source_lock.exclusive uses pg.dedicated(); a write whose body needs pooled connections, or nests a second lease, no longer waits on a pool its locks fill. - Tests: the lock fakes take no pooled connection; dead pg.enabled patches dropped; the user-scope residue check passes the saga's user_id scope type. 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 high effort and found 1 potential issue.
There are 2 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 8ce53ba. Configure here.
…for it - pg_source_lock.exclusive opens its connection within the pool acquire bound and answers POSTGRES_UNAVAILABLE past it. - storage-authority states that each source write in flight holds one connection outside the pool; pg.dedicated's docstring names that use; stale comment, helper name and wrap fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… the rule generally Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…r lease and process Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…ound; rewrap two paragraphs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…med as one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…for the text check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
A 5xx the status table does not name comes from the worker or its proxy failing, so the caller may retry; any other unnamed status still fails closed as denied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The test now covers every named worker status, the table drops 503, which the server-error default already answers, and the boundary page says unavailable also covers a worker that failed to answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
401 and 403 already fall back to denied, and the boundary page says a timeout also covers the worker's own read timing out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
main retired the hand-kept llms.txt; the Go and Rust wire models are regenerated from the merged sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The publication size check derives the escaped copy's length from the ASCII JSON it already built, and the retains_no_payload comment names the MCP batch and notification rules that read it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The MCP endpoint passes its verified token to the batch dispatcher, so the refusal row carries the caller's org and subject whatever the live entry's position, rather than whatever an earlier entry left in the auth context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
The refusal comes from the request's framing before any dispatch, as a single live notification or bad request id does, and those write no row; the batch now follows the same rule, so no row can carry another entry's auth, run or consumer. The auth argument added for that row is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>


Related: #1189
Related: #1190
Related: #1298
Changelog category
Changelog entry
Add an experimental operation for reading a selected document through a provisioned source worker. The read keeps no body and does not change stored document search. This build has no operation that registers a worker source, approval or account, so the operation answers
deniedorunavailableuntil source setup ships.Why
Live reads need the exact caller's upstream connection, but Loom does not need the credential. The worker resolves an opaque connection under a signed request. Loom checks the caller's collection grant, approved worker, selected resource and current account before it contacts the worker and again before it delivers the result.
Scope and risk
knowledge.source.liveis an experimental read operation on the existing HTTP and MCP transports. It requires the protected publication barrier and Postgres knowledge authority. Each response frame holds the namespace's Postgres source lock shared, rereads the source row with sequential consistency and refuses the frame if the row changed at all since the frame's authority check, and locks the exact approval, account and team link rows. Every source write holds that lock exclusively for the length of its source lease, so a retirement, update or erasure that commits first withholds the frame; live reads of one collection share it, and a write waits only for frames already running. A build without the lock writes under the lease alone, so during a rolling upgrade a retirement from such a replica can let through the one frame already past its reread. A frame holds one pooled Postgres connection; a source write holds its lock on a connection of its own, outside the pool, for its lease. The worker read ends before the separate deadline for retention, accounting and delivery. A team reader needs a separate enrolled connection for the same verified resource realm. An account belongs to one collection: the owner's and each team reader's accounts must be enrolled in the source's collection, an account in another collection does not serve the read, and enrollment keys the account on the approval's collection. One connection ID cannot be enrolled in a second collection, so a worker issues a separate connection for each collection. Loom checks current team enrollment, both connections and approval before testing whether the requested identifier is selected. Selected and unselected identifiers get the same response when a team reader lacks current authority. The live read limits document text to 4,000,000 UTF-8 bytes and the encoded document with its escaped MCP text copy to 16 MiB before it retains the publication fence. A document over either limit, or an empty one, returnsunsupportedwithout a document; a digest mismatch staysdenied, and a publication window that runs out of time returnstimeout. Both transports reject unknown argument names that are too large or cannot be encoded as UTF-8. They return valid ignored names to the caller without logging or caching them. MCP applies a separate bound and the same encoding check to the JSON-RPC request ID. This operation admits no answer tokens and does not fall back to a stored copy. The argument-name and request-ID bounds, the capture and ledger handling theno-storeheader and MCP's refusal of the op inside a batch or as a notification (both follow from the per-frame fence) all read oneOperationfield,retains_no_payload; narrowed tokens are refused through the read-scope module'sNARROW_REFUSED_OPS. HTTP marks such an op's responsesno-store, and every MCP response carriesno-storebecause MCP cannot tell which tool a response answers when it sets headers. The ledger keeps request accounting without arguments, result bodies or exception text. The operation disables body capture regardless of namespace consent.This is the live read prerequisite. Account setup, selected imports, refresh and stored access remain separate work. The Postgres store writers for approvals, accounts and readers (
replace_on,set_on,revoke_on,issue_challenge,consume_challenge,revoke_account) ship here with no caller inserver/yet. They stay because the live fence's correctness is defined against their lock protocol: the fence takes the approval, account and link rowsFOR SHARE NOWAITunder the source lock, andtests/integration/test_mcp_worker_pg_fence.pyraces these writers against a frame on real Postgres. Everything above the stores that only setup would call moved out to the change that adds the setup ops: the approval, enrollment and enrollment-flow modules, the routes' enrollment route and verifier key,WorkerReadChannel.request_enrollmentand the worker access-check call, the selection proof, the stored-copy permission check and setup planning, with the selection setting. A Postgres outage in the live read's lookups before the response, or in a source write's lock, answers 503, and one during a frame's handoff withholds the response; and the lock's session uses short TCP keepalives so a vanished holder's lock is released within about a minute. A large body can be cut off after the status line when its chunks cannot be fenced and received within the publication deadline; the boundary page states this. Each 512 KiB chunk repeats the authority resolution and the fenced reread, so the largest body that arrives intact depends on datastore latency and has not been measured against real stores. That measurement belongs to the hosted scale qualification before large live reads are enabled. The worker challenge, account and team reader tables key the canonical sign-in owner in their ownsubjectcolumn, and their identity-tupleuser_idis always-, so a user-scope erasure never matches them; an approval belongs to its collection and names its approving administrator only asactor. Namespace erasure removes every worker row of the namespace. SCIM deletion of a user removes the worker rows of every owner the user's spellings name or a verified alias ties to them, after the connected accounts are stopped and their provider revocations have run, so its failure cannot keep a credential live; SCIM revokes the user's service accounts even when it fails, and a retry finds the same owners. As for connected accounts, a worker row written at or after the owner's revocation cutoff is kept (the reader links gain anupdated_atfor this). A live read refuses a registration whose mode is not live. The dashboard has no protected live view. No provider or native source is removed. See Document source worker boundary.Compatibility, rollout and rollback
knowledge.source.liveand explicit read status, body, source link and fetch time. Existing operations and defaults are unchanged. Over MCP, aknowledge.source.liveentry in a JSON-RPC batch with other entries is answeredINVALID_REQUEST(-32600, "Send this request individually") before any worker read, and the other entries answer normally: the read's publication fence is held only briefly after the read, and two fenced reads in one batch would each hold the source lock while waiting on the other. A single request or a one-entry batch is unchanged, and the tool description says to send it alone. The MCP refusal of a bad request ID on this op reads "Request ID is invalid or too large for this operation" (INVALID_REQUEST, unchanged code). Its ledger rows, marked ones included, record the closed outcomestatusasout_statusand nothing else from the result.max_connectionsfor it.LOOM_KNOWLEDGE_SOURCE_WORKER_ROUTES_FILEdefaults to empty. A configured route requires explicit trust, a client certificate and a separate request signing key. Worker settings can shorten the read, publication and frame deadlines. The defaults are the caps: 8 s for the read, 2 s for publication and 1 s per frame. Keep registrations and copy writes disabled until the worker, account setup, erasure and mixed versions qualify together.Tests
Focused tests cover worker authority, enrollment, approvals, route configuration, privacy, and the SDK and settings contracts. Configuration tests cover valid overrides and refusal of out-of-range worker limits. Regression tests cover concurrent delivery, retirement during delivery, equal responses for selected and unselected identifiers during approval outages, retention and delivery after the read deadline, and the exact worker metadata erasure statements. Ruff, function length and strict mypy for the changed authority modules pass. The Python, TypeScript, Ruby and Rust contracts describe the protected live read. Large fenced response bodies use bounded chunks. Each chunk resolves current source and worker authority, then takes the publication locks, rereads the source row and locks the approval, account and link rows before it is sent. The response keeps its byte length, stream terminator, and existing deadlines. Focused request-tail and worker tests cover a 16 MiB transport body under simulated datastore latency and revocation between chunks. Worker protocol fixtures also exercise the real HTTP and MCP encoders: escape-heavy content within the budget arrives intact, while oversized content returns a complete refusal without retaining the publication fence. Transport tests cover refusal of escaped lone surrogates, valid Unicode, and ignored names appearing only in the caller’s response. Hosted
tests/integration/test_mcp_worker_pg_erasure.pyseeds all four worker tables through the store writers and checks that a user-scope erasure removes none of them, that owner deletion throughstop_subjectsremoves the subject's rows in every namespace and keeps other subjects' rows and the approvals, that a cutoff erases only rows written before it, and that namespace erasure removes every row of the namespace. Unit tests cover owner deletion reaching an owner only through a verified alias, a failed worker erasure still stopping and revoking every account and the user's service accounts, rows kept or erased by the revocation cutoff (an outright revocation with a cutoff included), anderase_subjectrestarting so it takes its namespace locks in sorted order. Hostedtests/integration/test_mcp_worker_pg_fence.pycovers the real Postgres lock order, a busy authority row withholding the frame, and an account lookup matching only its own collection; mixed-build qualification of this op is not yet run.AI assistance in the code
AI-generated with Codex and Claude Code. Each push was reviewed by an independent agent session against the whole diff, and the focused unit tests, generators, Ruff and mypy were read before the next push.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
Note
High Risk
Touches authz, Postgres locking, and publication fencing for live upstream reads; incorrect fence or erasure behavior could leak content or serve stale frames after revocation.
Overview
Introduces experimental
knowledge.source.live, a read-only path to fetch one selected upstream document through an operator-provisioned MCP source worker without indexing or persisting the body. The op is markedretains_no_payload(ledger stores only closedstatus, HTTP/MCPno-store, narrow tokens refused) and is wired through all SDKs, settings, and operation reference docs.Storage and lifecycle: Three Postgres migrations add worker enrollment challenges, accounts, collection approvals, and team reader links (canonical
subject, no credentials). Architecture docs describe the worker boundary, source lock + shared frame fence, and erasure rules; namespace delete andpg_knowledge.deletenow clear worker metadata, and census/erasure classify these tables as namespace-only or subject-owned.Runtime behavior: A new namespace source advisory lock coordinates exclusive source writes with shared locks during live frame handoff.
request_tailgains publication fences and 512 KiB chunked body delivery so large responses re-check authority between chunks. New env caps (LOOM_KNOWLEDGE_SOURCE_WORKER_*) configure routes file and read/publication/frame deadlines; Postgres sizing docs note extra connections per held source lease.CI and fixes: Storage CI runs integration tests for worker PG fence races and erasure; SCIM token stop now always revokes service accounts in a
finallyeven if connection stop fails.Setup ops that register workers/accounts are intentionally not in this PR—live reads will return
denied/unavailableuntil that ships, though store writers exist for fence tests.Reviewed by Cursor Bugbot for commit 8d2e344. Bugbot is set up for automated code reviews on this repo. Configure here.