Repository navigation
Conversation
… its own namespace A conflict waits for the namespace's admin: in the dashboard's Review queue, or with conflicts.resolve over HTTP or an SDK. An agent that reaches Loom only over MCP had neither route: both ops were hidden from MCP, and the refusal told it to ask the user to open the dashboard. An agent of a workload trust was refused by the role too. Its first exchange writes it the owner's admin grant on its own namespace, and its token names that namespace as a writer's. On a namespace where no person holds admin, only an org or platform admin could settle a conflict, and flagged rows stayed flagged. conflicts.list and conflicts.resolve leave the hidden list: the `all` toolset lists both, `readonly` lists conflicts.list, and the other toolsets reach them through loom_op. The Review queue's suggestions and the allowlist stay hidden. conflicts.resolve keeps its admin role. The transports' gate admits one more caller once the ordinary gate refused the role: the agent whose own namespace it is (agents.owns), while its owner grant is live and the gate passes it as a writer. The rule names its ops (agents.OWNER_OPS), never applies to a restricted namespace, and reaches no namespace the agent was lent or granted and no other admin op. conflicts.resolve refuses to tombstone a locked memory (423 LOCKED), as memory.delete and memory.dedup_resolve do. Without that, a writer's token could have deleted a row its admin had locked: flag the pair with memory.link, then resolve it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: pufit <pufit.dev@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…view Signed-off-by: pufit <pufit.dev@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The new agent route needs a conflict precondition and accurate MCP metadata for its tombstones.
A resolve took any live row as its target and wrote every live peer the target named. `contract` tombstoned an ordinary fact that was in no conflict. A `revise` on a proposal awaiting review tombstoned the facts it contradicts before the write fence refused to serve the proposal. And a row keeps its `conflict_with` once its conflict is settled, so a `revise` on a row flagged again tombstoned a peer it had been settled with by `allow`. A row awaits a decision when it is flagged `conflicted` and is not held for a proposal's review. A target that does not answers `resolved: false`, decided on its head before anything is written. A peer that does not is neither tombstoned nor reactivated: each write judges the heads it reads, read current, before it writes one. `allow` still allowlists the pair of every live peer. `revise` and `contract` write the target last, and `allow` writes the allowlist first: a write that fails midway leaves the target flagged, and a retry completes. The answer lists the rows written. The peer set and the allowlist's keys come from the heads a resolve reads, so `lookup_keys_for_ids` has no caller left and is removed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: pufit <pufit.dev@gmail.com>
The `destructiveHint` and the action schema's effect class were read from the op's name, and no word of `conflicts.resolve` says delete. The tool was listed as an ordinary write although `revise` and `contract` tombstone memories. An op can be marked `destructive`. `conflicts.resolve` carries the mark: its tool reports `destructiveHint: true`, and the action schema files it under `Destructive`. A read-only op is never destructive, marked or not. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: pufit <pufit.dev@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high 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 839f599. Configure here.
|
|
||
| affected = [str(row["memory_id"]) for row in tombstoned] + kept | ||
| if not affected: | ||
| return unresolved # every row left the conflict before its write |
There was a problem hiding this comment.
Allowlist written then resolve reports failure
Medium Severity
allow writes the allowlist before the status change, then returns resolved: false when every memory write is skipped. A concurrent settle of the target leaves a durable loom.conflict_allowlist row while the caller is told nothing was written. A retry sees an unflagged target and does not undo that pair.
Reviewed by Cursor Bugbot for commit 839f599. Configure here.
There was a problem hiding this comment.
Kept, and listed in the description under "Left as it is". The allowlist goes first so that a failed memory write leaves the rows flagged and a retry completes; the other order leaves the rows active with no allowlist row and a retry that answers resolved: false. In the case reported another caller settled the rows meanwhile: the pair this caller asked to allow is allowlisted, and resolved: false says that this call wrote no memory. A target that awaits no decision is refused before the allowlist is written.
zlareb1
left a comment
There was a problem hiding this comment.
The new precondition rejects ordinary rows and pending proposals, and the MCP tool advertises its tombstones. Two destructive paths still need to be scoped to the live decision.
`conflicts.resolve` reads the heads it judges with `strong=True`, which reads with sequential consistency first. Every point lookup outside the repository also passes `fresh=True`, and `test_every_point_lookup_outside_the_repository_asks_for_fresh_rows` holds the source to it; the resolve's lookup did not. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: pufit <pufit.dev@gmail.com>
A resolve made two inserts: one side's tombstones, then the other side's status. `contract` asserted the target's lock on its first read, wrote the peers `active`, and read the lock again for the tombstone: a lock landing in between answered 423 with the peers already out of review. A write refused midway left one side written. And a peer named in `peer_id` that was deleted was dropped from the fan-out, so a targeted `contract` tombstoned the only live row. The rows a resolve changes go in one insert (`conflicts_repo.settle`). The write reads every head current and judges it again: a row that no longer awaits a decision leaves the write unmade, and a lock on a row it would tombstone refuses it. The insert is committed only over those heads, as `memory.lock` and `memory.verify` commit theirs: a lock or another write landing after the read answers 503 `ADMISSION_CONTENDED`. A refused resolve changes no memory, and a retry of a failed one completes it. A peer named in `peer_id` must await a decision too. When it is gone, settled or a proposal on trial, the resolve answers `resolved: false`. Each side is named by the ids the store holds, so a request that spells the target's id another way decides the same rows, and a row is not its own peer. A `peer_id` is matched as the target names it. `write_versions_by_ids` takes `exact` and `whole`, and `tombstone_cascade_by_ids` takes rows to write beside the tombstones in the same insert. `conflicts_repo.tombstone_ids` is replaced by `settle`, and `mark_active_by_ids` is as it was. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: pufit <pufit.dev@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The allowlist finding reproduces on this head. I settled the peer after the first reads. allow returned resolved: false and wrote no memory versions, but persisted an allowlist pair that suppresses future conflict checks. Make the pair durable only for an accepted settlement, and assert the allowlist state in the existing race test.


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):
MCP serves
conflicts.listandconflicts.resolve, and an agent of a workload trust settles the conflicts of its own namespace; every other caller still needsadmin.conflicts.resolvenow writes only memories in an unresolved conflict, in one insert that a refusal leaves unmade, and refuses to tombstone a locked memory (423LOCKED).Why
A conflict waits for the namespace's admin: in the dashboard's Review queue, or with
conflicts.resolveover HTTP or an SDK. An agent that reaches Loom only over MCP had neither route. Both ops were hidden from MCP, and the refusal told it to ask the user to open the dashboard.An agent of a workload trust was refused by the role too. Its first exchange makes its namespace and writes it the owner's
admingrant, but its token names that namespace as a writer's. On a namespace where no person holdsadmin, only an org or platform admin can settle a conflict: the agent holds the grant without the role, and a viewer or writer holds neither. Flagged rows stay flagged, and thenamespace.validatefindings that depend on them are never cleared.The refusal protected little. A writer can already replace or tombstone either row of a pair with
memory.updateandmemory.delete.conflicts.resolvedoes the same with an audit row, the pair's flags cleared, and tombstones thatmemory.restorerevives.Scope and risk
This changes the auth model, so the design is here and in
docs/architecture/security.md("The gate").MCP.
conflicts.listandconflicts.resolveleave_MCP_HIDDEN_OPS. Thealltoolset lists both andreadonlylistsconflicts.list; every other toolset exceptassistantreaches them throughloom_op. Thecore,coding,atomic,tasksandtrackerlistings are unchanged.conflicts.propose_revisionand the two allowlist ops stay hidden.Role.
conflicts.resolvekeepsrequired_role=ADMIN.authorize_op, the gate both transports call, admits one more caller once the ordinary gate refused the role: the agent whose own namespace it is (agents.owns). The rule needs all of:agents.OWNER_OPS, which holdsconflicts.resolveonly;agents.home_of(subject)is the namespace;admin(claim_cap);ns_writeleaves the namespace out are refused as on any write.It follows the shape of the two rules the code already has for an agent on its own namespace and for a code namespace's members:
grants.share_agentchecksagents.namespace(trust, me), andcode_member_may_writere-runs the ordinary gate at a lower role.Locks.
conflicts.resolvetombstoned a locked row:tombstone_idspassed noskip, unlikememory.deleteandmemory.dedup_resolve. While only an admin could call it, an admin could have unlocked the row first. With the rule above a writer's token could have deleted a row its admin had locked, by flagging the pair withmemory.linkand resolving it.conflicts.resolvenow asserts the lock on every head it would tombstone, read current, before the first write, for every caller.What a resolve writes.
conflicts.resolvetook any live row as its target and wrote every live peer the target named.contracttombstoned an ordinary fact that was in no conflict. Areviseon a proposal awaiting review tombstoned the facts it contradicts before the write fence refused to serve the proposal. A row keeps itsconflict_withonce its conflict is settled, so areviseon a row flagged again also tombstoned a peer it had been settled with byallow.A row awaits a decision when it is flagged
conflictedand is not pending review byproposal_review.pending_review, the fence's own test. A target that does not answersresolved: falsebefore anything is written, the allowlist included. Of the peers the target names, a resolve writes the ones that await a decision too: a peer settled earlier, revised since or still a proposal is neither tombstoned nor reactivated, andallowstill allowlists the pair of every live peer. A peer named inpeer_idmust await a decision, or the answer isresolved: false; before, a named peer that was deleted was dropped and a targetedcontracttombstoned the only live row. The states, the peer set and the allowlist's keys come from the rows' heads, read current from the authority. The peer set and the keys came from ClickHouse lookups that can trail, andlookup_keys_for_ids, left without a caller, is removed.The rows a resolve changes go in one insert (
conflicts_repo.settle); there were two, one per side. The write reads their heads current and judges them again: a row that no longer awaits a decision leaves the write unmade (resolved: false), and a lock on a row it would tombstone refuses it (423). The insert is committed only over the heads the write read, asmemory.lockandmemory.verifycommit theirs, so a lock or another write landing after that read answers 503ADMISSION_CONTENDED. A refused resolve changes no memory, and a retry of a failed one completes it.allowwrites the allowlist before that insert. Each side is named by the ids the store holds, so a request that spells the target's id another way decides the same rows; apeer_idis matched as the target names it.write_versions_by_idstakesexactandwholefor this, andtombstone_cascade_by_idstakes rows to write beside the tombstones.MCP annotation. The
destructiveHintwas read from the op's name, and no word ofconflicts.resolvesays delete.Operation.destructivemarks an op that tombstones under such a name, andconflicts.resolvecarries it:loom_conflicts_resolvereportsdestructiveHint: true, and the action schema files the op underDestructive.What the rule does not widen. A namespace the agent was lent or granted
adminon, a restricted namespace, any other admin op on its own namespace, a person who is a writer there, and a token of another org or of every org with the same subject are refused. The handler reads and writes only the body's namespace.Alternatives.
adminon its own namespace. That opens every admin op to a token a model drives: grants, policy, unlock, snapshot and restore.conflicts.resolveatwriter. That hands every writer of every namespace the decision the model keeps for the namespace's owner, in a shared namespace too. This change needs it only for the one agent that owns a namespace.Left as it is.
allowcannot take the pair off the allowlist: listing and removing stay an admin's, off MCP.resolved_byis taken from the request body, as before, and lands on the allowlist row and in the tombstone's note; the audit row names the token's subject.conflicts.listrows carry no lock field, so a caller learns of a lock from the 423.allowwrites its allowlist row before the memory write. When that write is then not made (a row another caller settled in between, a refusal, a failure), the pair stays allowlisted while the answer isresolved: falseor an error. A retry of a failed call completes it.activeby a resolve; it leaves the queue by acontract, a delete or a revision of its value.loom.memoryis partitioned by the month a row was created. Every refusal comes before the insert, and the Postgres authority commits once; a server failure inside an insert whose rows were created in different months can still land one part of it.conflict_with, and a flag is one per row, not one per pair. A peer settled earlier and flagged again in another conflict is written as a flagged peer. A peer whose flag another resolve cleared is left as it is, so arevisecan answerresolved: truewith both rowsactive.can_call("conflicts.resolve")answers false for the owning agent: it reads the op's role and the token's claims.Risk. A model that holds an admin token can settle a conflict over MCP with no person involved. The tool description tells it to ask first where a user owns the facts, the tool is listed as destructive so a client can ask before the call, the resolve is audited, its tombstones are restorable, and a lock stops it.
Compatibility, rollout and rollback
conflicts.resolveanswers 423LOCKEDwhere it tombstoned a locked row before. It answersresolved: false, writing nothing, for a target that is not flaggedconflictedor is a proposal awaiting review; before, it applied the decision to any live row. A peer that is not flagged is left as it is by the three decisions, andaffected_memory_idsdoes not list it; before,revisetombstoned it andcontractandallowwrote itactive. Withpeer_id, a peer that is gone, settled or a proposal answersresolved: false; before, the target was decided without it. A resolve whose rows change after it read them answersresolved: falseor 503ADMISSION_CONTENDED, which a client retries; before, it wrote over the change. A resolve refused midway leaves no side written; before, one side could be.affected_memory_idslists the target under the id the store holds, where it echoed the request's spelling. Over MCP,loom_conflicts_listandloom_conflicts_resolveare callable and listed as above; before, both answeredOP_NOT_ON_MCP.loom_conflicts_resolvereportsdestructiveHint: true, and the action schema's effect class forconflicts.resolveisdestructive, where it waswrite. The MCP descriptions of the two ops are rewritten, and theconflicted_agingfinding ofnamespace.validatenames the decisions as the op takes them (revise,contract,allow).adminthere and lower or revoke the agent's grant. A resolve tombstones no memory that is locked.resolved: false, and a 503 the queue's generic error notice. A Keep no longer tombstones a peer settled earlier that the row still names.Tests
tests/unit/test_agent_owner_ops.pyruns the real gate over a faked grant table, 18 cases: the agent is admitted on its own namespace; refused on a namespace it was lent, on one it was grantedadminon, on four other admin ops, with its owner grant lowered or revoked, with no grant row, with a token that may not write there, on a restricted namespace, as a writer who is no agent, and as a token of another org or of every org. A copy ofagents.ownswith any one condition removed fails at least one of them (run once, not committed).tests/unit/test_conflicts_resolve_writes.pyruns the real handler,conflicts_repo.settle,tombstone_cascade_by_idsandwrite_versions_by_idswith the reads and inserts faked; the faked insert runs the real proposal fence and the check of the heads an exact commit makes. 63 cases.resolved: falseand writes nothing, the allowlist included.revisenor rewritten bycontractorallow; a proposal stays on trial under the three decisions, andallowallowlists its pair;peer_idnarrows the resolve; a named peer that is deleted, settled or on trial answersresolved: falsefor the three decisions; an id spelled in upper case names the same row, a locked target named that way is refused, and a row is not its own peer.ADMISSION_CONTENDEDwith no side written; a failed insert, and anallowwhose allowlist write fails, change no memory, and the retry completes.reviseandcontractthat would tombstone aread_onlyorno_deleterow answer 423 and write nothing, also when an unlocked peer is read first;allowsettles the locked pair; a lapsed lock is no lock.tests/unit/test_tombstone_cascade.pyandtests/unit/test_conflicts_repo.py, on the real store helpers:settlewrites the tombstones and the status changes in one insert committed over the heads read, writes nothing when a row is gone, lives in another namespace or is left byskip, and refuses a row that is on neither side or on both.settle,write_versions_by_idsandtombstone_cascade_by_ids, each undoing one of these rules, each fail at least one of those cases (run once, not committed).tests/unit/test_mcp_loom_op.py, with auth on and a token shaped as the exchange mints it:loom_oprunsconflicts.resolveon the agent's namespace;memory.reindexand, once the owner grant is lowered,conflicts.resolveanswerAUTH_INSUFFICIENT;alllists both tools;conflicts.propose_revisionandconflicts.allowlist_removestill answerOP_NOT_ON_MCP. WithOWNER_OPSemptied the first call is refused for its role (run once, not committed).tests/integration/test_agents.py::test_an_agent_settles_conflicts_in_its_own_namespace_only, against a private ClickHouse with Keeper, with the token_machine_tokensmints andverify_tokenreads: the owner grant thatensure_namespacewrote admits the agent; a namespace an admin granted itadminon andmemory.unlockrefuse; the agent flags two of its facts with acontradictsedge and settles the pair withrevise, naming the target's id in upper case (one tombstoned, oneactive, committed through the store's own fences), and itscontracton a fact in no conflict answersresolved: falseand leaves the factactive(with the target check and the writes' own check both removed, the fact is tombstoned and the test fails); after another subject takesadminand the agent's grant is revoked, it is refused. The file's 13 tests pass.tests/unit/test_mcp_initialize_surface.py:conflicts.resolveis marked, thealllisting reportsloom_conflicts_resolvewithdestructiveHint: true, a marked read-only op stays non-destructive, andloom_conflicts_liststays read-only.tests/analyzer/shapes.txtis regenerated: the shape oflookup_keys_for_idsleaves, and the point lookup by id read current enters.pytest tests/analyzerpasses against the private ClickHouse.make lintsteps that need no Node toolchain (ruff, the function-length and secret gates, every generator--check),scripts/gates/mypy_gate.py,ruff format, and Prettier on the changed Markdown pass. Unit files for the areas touched pass: the MCP toolsets and listing budget,loom_op, the mentor and its guide, the op surfaces and reach census, the action schema and policy tests,test_code_member_writes.py,test_agent_shares.py,test_conflicts_resolve_scope.py,test_tombstone_cascade.py,test_doc_links.py,test_public_copy.py,test_agent_instructions.py,test_package_contracts.py.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 reading the gate, the token exchange and the resolve handler before the rule was chosen, by an independent review of the rule that found the lock and restricted-namespace gaps fixed here, and by running the tests 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) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.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
Note
Medium Risk
Changes authorization (agents may resolve on own namespace) and conflict resolution semantics (no-op on non-flagged rows, locks, atomic writes); MCP clients can run destructive settle without dashboard admin.
Overview
Exposes
conflicts.listandconflicts.resolveon MCP (alllists both;readonlylists onlyconflicts.list; other toolsets useloom_op) and addsagents.ownsso a workload-trust agent with a live owneradmingrant can callconflicts.resolveon its own namespace after the normal role gate fails—it still must pass as a writer, and restricted namespaces, lent/granted namespaces, and other admin ops are unchanged.conflicts.resolveis tightened: it only changes rows that stillawait a decision(flaggedconflicted, not proposal review), refuses tombstoning locked rows (423), and applies tombstones/activations in onesettle()write with exact/whole head checks.Operation.destructivemarks ops like resolve for MCPdestructiveHint. Docs, mentor copy, and tests follow.Reviewed by Cursor Bugbot for commit f74d37d. Bugbot is set up for automated code reviews on this repo. Configure here.