Repository navigation
Conversation
…rvice account's worker knowledge.source.worker_assign took only an agent's subject, in that agent's own namespace, so a team's shared index had no worker that could sync it. The worker subject's kind now decides where the source lives. An agent's subject keeps its rule: its own namespace, and not while it has lent it. Any other subject is assigned only in a namespace no workload trust made for an agent, and one that takes a shared source: not a person's own and active. A blank subject is refused. knowledge.source.worker.claim offers an agent's subject the sources of its own namespace, as before. A subject with no namespace of its own is offered the sources that name it across its org: one statement over the registry on the key prefix org that returns the key, version and registration of the rows naming the caller, 2,000 at most, and one read of their sync states. The row a turn starts on is read whole before its lease and is offered only at the version and subject the poll read. Such a poll draws the namespace tier of its rate limit on a slot per subject. The dashboard offers Retire on an assigned source to the subject that assigned it, and says that its copies go with it. No op, field, migration or setting is added. A replica one build behind lists, retires and expires such a source as it does an agent's, refuses to make one and answers its subject's claim with none. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ 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 408da55. Configure here.
| "a source there", | ||
| code="SOURCE_WORKER_NAMESPACE", | ||
| ) | ||
| await source_ops._require_source_namespace(org, namespace) |
There was a problem hiding this comment.
Assignment races agent namespace creation
High Severity
A service-account assignment treats a namespace as shared after trust_made sees no directory row, under sources_lease. Agent provisioning creates that home under account_change after its own in_use check, so both can succeed and leave the source in the agent namespace. knowledge.source.worker.claim then offers that row org-wide and never checks the trust tag.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 408da55. Configure here.
The dependency review compares the snapshot inputs between the merge base and the base branch, and main changed sdk/rust/src/wire_models.rs after the merge base this branch had. The merge is clean: main's hunks in the generated reference pages, the TypeScript ops, the CLI snapshots and the analyzer shapes touch none of this branch's lines. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…PERSONAL_NAMESPACE An agent claim's mark, machine:agent-signup:claimed, starts as a workload trust's tag does and names no trust. trust_made matched it, so knowledge.source.worker_assign answered SOURCE_WORKER_NAMESPACE with "is an agent's own namespace; only that agent's subject syncs a source there" for a namespace no agent's subject can be assigned in. The statement leaves the claim's mark out, and the namespace reaches the shared-source check, which refuses a person's own place as knowledge.source.add does. Both answers are 422. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d maturity The reference cuts a command's help at 200 characters, and the help was 240, so the row ended before "(knowledge.source.worker_assign, experimental)". The help is 158 characters, and the rule for the namespace is in the help of --namespace. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nds of subject Five statements said a claim reads only the caller's home namespace, or that a host connection serves only an agent's own namespace. An agent's claim reads its own namespace and draws the namespace bucket there. Any other service account's claim reads the org's rows that name it, where the assignment is the grant, and draws the bucket on a slot per subject. A host connection gives authority where an administrator assigned the source: the agent's own namespace, or a shared one for a subject that is no agent's. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two generated files conflicted, and both are regenerated from the merged code: tests/unit/snapshots/cli_help.json by the CLI surface snapshot test, and the cli region of docs/reference/cli.md by docs_reference.py. Each holds the sync-now command beside the assign help that names both kinds of namespace. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t, for both kinds of subject The host backend section said a claim reads the home namespace alone, which holds for an agent's subject only. The claim of a service account that is no agent's reads the org's rows that name it. The page says what each claim reads, and that the backend syncs the one namespace it is given: a source claimed from another shared namespace is refused `tool_not_allowed`. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…er many namespace buckets The comment sits above the org's poll and write limits. Only a claim by a subject that is no agent's draws a namespace bucket of its own; `stored`, `put` and `commit` draw the bucket of the source's namespace, which the workers assigned there share. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>


Related: #1189
Related: #1232
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):
A namespace administrator can assign a document source in a shared namespace to a service account that runs a worker (
knowledge.source.worker_assign), and that worker'sknowledge.source.worker.claimis offered its sources in every namespace of the org. Assigned sources stay experimental.Why
knowledge.source.worker_assigntook only an agent's subject, in that agent's own namespace. A team's shared index, such as public documentation, has no agent: an operator runs the worker under a service account, and no assignment could name it.The worker subject's kind now decides where an assigned source lives:
sa:<trust>:<agent>)A claim follows the same split. An agent's subject is offered the sources of its own namespace and nothing else. A subject with no namespace of its own is offered the sources that name it across its org, from one statement over the registry and one read of their sync states, never a read per namespace.
Scope and risk
Touches the assign handler, the claim handler, three new store statements, the op and CLI descriptions, the docs, and the dashboard's menu for an assigned source. No op, field, migration or setting is added.
Tenant isolation:
PERSONAL_NAMESPACE). A namespace that holds an active source cannot later become an agent's own, since the name is in use.worker_assigncannot tell what a subject string names, so a source that names a person is stored and never synced. The docs say so.Design calls:
PERSONAL_NAMESPACE,NAMESPACE_INACTIVE).tool_not_allowedand leftblocked.docs/architecture/mcp-source-worker-boundary.mdstates the rule for both kinds of subject.What could break: a service account that polled
claimand was answerednoneis now answered the turns of the sources that name it. No such source could exist before this change.Compatibility, rollout and rollback
knowledge.source.worker_assignaccepts aworker_subjectthat is no agent's in a shared namespace, where it answered 422SOURCE_WORKER_NAMESPACE; in that case it can also answer 422PERSONAL_NAMESPACEorNAMESPACE_INACTIVE.knowledge.source.worker.claimoffers a service account that is no agent its sources across the org. The descriptions ofnamespaceandworker_subjectonworker_assign, the description ofclaim, and the help ofloom knowledge source assignchanged.removeand expires its copies as it does an agent's. It refuses to make or change one, and answers that subject's claimnone, so a worker routed to it polls again.stored,putandcommiton a turn the new build opened are served by both builds.docs/architecture/rolling-upgrades.mdrecords this under the assigned-source rule.Tests
The branch holds
mainat 54c149c, merged in twice: first at f9cb57f, then at 54c149c. The second merge conflicted in two generated files,tests/unit/snapshots/cli_help.jsonand thecliregion ofdocs/reference/cli.md; both are regenerated from the merged code and hold thesync-nowcommand beside the changedassignhelp.git merge-treeagainstmainat 377ad6b reports no conflict. The results below marked "merged tree" were measured after the first merge, those marked "second merge" after the second, and the others at the head before either (408da55, on b462e6c).test_a_service_subject_is_assigned_only_outside_agent_homes,test_a_service_worker_claims_across_namespaces,test_a_person_named_as_worker_subject_claims_nothing,test_the_org_wide_claim_is_one_statement_and_one_state_read, andtest_a_source_rewritten_since_the_poll_read_it_starts_no_turn. The first also covers a namespace claimed at sign-up, a case that answeredSOURCE_WORKER_NAMESPACEbefore its fix.pytest -n 2ontests/unit/test_assigned_source.py,test_source_worker_ops.py,test_by_id_ops_scoped_tokens.py,test_cli_surface_snapshot.py,test_cli_knowledge_source.py,test_cli_knowledge_source_worker.py,test_agent_shares.py,test_knowledge_source_retirements.py,test_source_worker_wire_fixture.py,test_docs_reference.py,test_package_contracts.py,test_op_transport_contract.py,test_tunable_constants.py,test_store_names_refused.py,test_degraded_unnoted.py,test_public_copy.py,test_doc_links.py,test_agent_instructions.pyandtests/analyzer: 910 passed, 13 skipped, 1 failed. The failure istest_degraded_unnoted.py::test_every_broad_handler_notes_its_fallback_or_says_why_it_need_not, on_history_sectioninserver/code/app/index/review_brief_build.py. This change touches neither that file nor the test's list, and the same test fails in the CI run ofmainat f9cb57f.pytest -n 2:test_cli_surface_snapshot.pyandtest_cli_knowledge_source.py, 25 passed.test_source_worker_ops.py, the sixtest_ratelimit_*.pyfiles,test_admission_gates.py,test_admission_parity.py,test_runtime_overrides.py,test_traffic_classes.py, the eight scans named above andtests/analyzer: 848 passed, 12 skipped, 1 failed. The failure is the sametest_degraded_unnoted.pycase: the file it names is the onemainholds at 54c149c, andmainchanges that file for this scan in f2eeb8a, which this branch does not hold.test_mcp_listing_budget.py,test_sdk_surface_contract.py,test_go_sdk_contract.py,test_op_reach_census.py,test_read_scope.pyandtest_session_content_senders.pypassed with the files above. The MCP listing budget is unchanged.tests/integration/test_assigned_source_ch.pyandtest_a_reader_of_the_shared_namespace_finds_a_service_workers_copy, 8 passed. The newtest_a_namespace_claimed_at_sign_up_is_refused_as_a_persons_own_placefailed before its fix, answeredSOURCE_WORKER_NAMESPACE. Before the merge:tests/integration/test_source_worker_turn_ch.pyandtests/integration/test_assigned_source_ch.py, 22 passed, and the new case intests/integration/test_cross_principal_leakage.pypassed withLOOM_AUTH_REQUIRED=trueand with auth off. The service worker test and the leakage case were written with the code, so they have no failing run on the branch; onmainthe first assignment they make is refused with 422.python -m tests.analyzer.corpus --writeleaves three statement shapes of this change inshapes.txtand no other difference.tests/analyzerpasses, andtest_every_shape_passes_the_analyzerpasses against that ClickHouse.docs_reference,sdk_py_gen,sdk_py_client_gen,sdk_ts_gen,sdk_rb_gen,op_reach_censusandplugin_eval_toolspass--check, and the CLI snapshot test passes.sdk_rust_genandsdk_go_genneedrustfmtandgofmt, which the machine these checks ran on does not have, so CI is their check; this change's diff againstmainholds no file undersdk/rustorsdk/go. Second merge: the same seven,sdk_py_admin_genandsettings_referencepass--check.ruff format --check,ruff check,make typecheck, the function-length gate (at its baseline), Prettier on the changed pages and the prose checker pass on the merged tree, and again after the second merge.npx vitest run src/views/SourcesList.test.tsx src/flows/KnowledgeSourceDialog.test.tsx --maxWorkers=2: 85 passed, 1 failed. The failure isSourcesList > names the collection in the toast and offers Open when the source lands elsewhere, which times out at 5,000 ms in this environment with the base branch's files too; this change does not touch it.npm --prefix frontend run buildand the bundle budget pass, and the budget is not raised. Second merge:npx vitest runonSourcesList.test.tsx,KnowledgeSourceDialog.test.tsxandKnowledgeSourceDialog.connected.test.tsx, 120 passed, andnpx tsc -breports no error.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. Checked by hand: the two assign rules and their refusals, that the org-wide statement answers only rows naming the caller, the fresh read before the turn lease, and each test result above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code