Repository navigation
Agents report wrong, outdated or missing knowledge with knowledge.reports.* - #1947
VanshajPoonia wants to merge 86 commits into
Conversation
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Knowledge gaps resolved the asker in private helpers. Knowledge reports need the same person for the reporter, so a user erasure finds both by the same spellings. The helpers move to server/knowledge/app/people.py unchanged. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
memory.get's read-scope narrowing moves into _within_read_scope, and readable_version uses it to answer the version and content hash of the row memory.get would serve, recording no read exposure or sensitive-read audit. Knowledge reports check their memory target with it. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…orts.* submit files a report about a memory claim, a document or missing knowledge under the token's person, after checking the caller can read the target; the id repeats for a retry. get serves it to its reporter and the namespace's admins, list is the admins' queue without anyone's words, update takes, asks for evidence, resolves, dismisses or reopens it, and evidence lets the reporter add references. Writes wait for every replica to know the table, run under a per-report claim, and narrowed tokens are refused. SDKs and the operations reference are regenerated. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
A version is written and read back with every column, the latest wins, the queue filters, the handlers file, take and add evidence under the claim, and both erasure steps remove what they own. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Submit, update and evidence check for an unfinished erasure that reaches the report's namespace or its people before the insert and again once the version is visible, as knowledge gaps record a miss, and delete a version that landed as one started. A link an update keeps is no longer checked again, so a related report erased since it was linked does not block new links. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Submit looked up the existing report only after it checked the related reports and the target again, so a retry after either changed was refused instead of answered with the report. It now answers a repeat first. A problem that is blank once trimmed is refused instead of stored empty. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
Report versions need the write provenance required by the repository. The document target field also needs to describe the identifier the lookup accepts.
A maintainer's update stored the reporter's identity tuple and an assignee, so a version could not say which token principal wrote it. loom.knowledge_reports now has actor and source_class columns, and submit, update and evidence stamp them from the token with writer_actor and source_class_for, never from the body. With auth off the writer is the identity's agent, or "-" for an update, as the reporter and the maintainer are. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The handler looks a document target up by source URI, so the field description and the refusal now say source URI instead of document id. The Go and TypeScript wire models and the operations reference are regenerated. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
knowledge.reports.get is a VIEWER read, so it joins the reads that spend knowledge.read instead of the write-shaped knowledge.add bucket. The admin queue read stays in knowledge.add, as the read bucket test expects for any op that is not read-only. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
delete_version drops a report version that landed as an erasure started. It writes no cell control row, so it goes with the other knowledge store deletes. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Regenerated with LOOM_UPDATE_SNAPSHOT=1. The only change is the five knowledge.reports methods. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…ge-reports Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com> # Conflicts: # docs/reference/operations.md # docs/reference/status.md # sdk/go/wire/models.gen.go # sdk/ruby/lib/clickhouse/loom/generated/ops.rb # sdk/typescript/src/generated/ops.ts
|
The unit jobs have not run on this fork yet. A local run found three failures from the PR: the read bucket for |
The cap of 20 references was checked before repeats were dropped, so adding evidence the report already cites could be refused while the distinct references still fit. The cap now counts distinct references. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
When the directory could not be read or tied the token to two accounts, the reporter fell back to the token's raw principal. The report id was hashed with that spelling, so once the person folded again a retry filed a second report and get and evidence no longer matched the reporter. A directory failure is now a 503 to retry and a tie is a 403. Get and evidence resolve the caller before the report, so neither answer says whether it exists. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The provenance and source URI fixes are in this head. The remaining blockers include report access after a grant downgrade, erasure of maintainer-authored data, and version checks across replicas. The existing reporter identity thread also needs a fix because a directory failure can change who owns the report.
Get decided a maintainer from the token's claims, so a token minted while its subject was an admin kept reading other reporters' reports after the grant fell to viewer. It now asks the namespace gate at admin, which caps the claim at the live grant. The report tests run on real tokens. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The id hashed the target key without the identity tuple the key is read under, so a reporter who filed the same problem about the same key in two users' rows got the first report back for the second. A memory target's agent, user and session are now part of the id. A document is read by its URI alone and keeps one id across tuples. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Resolve took any nonblank text, so a draft id or a revision of a target that never changed closed the report. For a report about a memory claim or a document, resolution_revision is now a revision number newer than the reported one and no newer than what readers are served now. A target that is gone has no published correction, so its report is dismissed. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
This head fixes the unstable reporter identity and counts unique evidence references toward the cap. The previous blocking findings still apply. I verified that a downgraded maintainer is still authorized from the token role and that maintainer-authored reasons are still outside user erasure. The new identity-folding thread also reproduces from the call order. Report detail refuses an already-authorized maintainer when the reporter identity lookup fails, while the queue remains available.
A writer could answer with version 2 and release its claim before another replica held the insert. The next writer's FINAL read could then return version 1, pass expected_version=1 and write a second version 2. Head reads now use select_sequential_consistency and each version is inserted synchronously, as the task inboxes do. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…opy there now Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…ge-reports Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…ge-reports Main's 121_code_repo_base_namespace.sql took number 121, so the reports migration and its gate move to 122. The schema version test now holds a replica at 121 instead of 120. NARROW_REFUSED_OPS keeps main's worker setup ops beside the reports prefix. Generated files are main's copies with every generator rerun on the merged tree, and shapes.txt is rewritten for the combined schema. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for the review. Round 14 is up. 5a15cc0 reads an address's copies from every acknowledged live report. 60131ac keeps publication proofs only for the copies a page lists, and a Main is merged twice. 06bb7c2 took main's copies of six generated files and reran every generator. Main moved again while this round was checked, and its
Thank you for the design check of the report fields against the read receipts and the roadmap. The three points read as follow-up issues to me as well, and I can open them once this lands if that helps. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit c453012. Configure here.
zlareb1
left a comment
There was a problem hiding this comment.
The first submission still accepts a revision that could refer to a different document copy. The digest is optional, and identical bodies can share a digest. The admitted document ID would distinguish those copies. The release path can also clear the maintainer's reason. Copy binding · Maintainer reason
zlareb1
left a comment
There was a problem hiding this comment.
The tunable constant test flags the worker approval bigint bound on the clean CI base and this merge. The same test passes with the existing bound fix. The exception inventory failure is separate. Failed job · Bound fix #2138.
…o people.py The fold is folded_person now, which raises instead of falling back, so the entry for gaps.py::_person named a handler that is gone and failed the test. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Every other report read does. A replica behind a take or a resolve listed the old state, or left out a report another replica had acknowledged. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
take, release and a resolution of a report about a target sent the reason empty and wrote that over the stored one. A report released after its evidence came in lost the question get served. An action now replaces the reason and reason_by only with words of its own, and reopen clears the resolution. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Copies at one address count revisions from 1 and can hold the same text, so neither the revision nor the content hash says which copy a reporter read, and a body without them was not checked at all. A first filing about a document now names target_doc_id, the doc_id knowledge.get returned, and is refused with 412 unless the document found now has that doc_id. The SDKs and the reference are regenerated for the new field. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…ge-reports Main's rule 73 covers worker sources, so the knowledge reports rule in rolling-upgrades.md is now 74. The generated Go wire models conflicted on their schema hash line only: they are main's copy with every generator rerun on the merged tree. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…there now memory.get falls back to another agent's row of the same user, so the row a reporter read can stop being the one a fresh lookup finds once the caller's own row is written. The report then held the read version beside the identity of the other row, and a retry filed a second report under that row. A first filing whose version or hash the row found now does not hold answers 409, as a document read in another copy does. The page also names the 409 that the document check answers. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The handler took the report's claim before it checked the reporter. Another caller who hit a report held by a slow change got 503 instead of 404, which said the id exists. The reporter is now checked before the claim and again inside it. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…ure clears reopen has always cleared the assignee, which the actions table left out. The storage layout note said a user erasure clears only the assignee, while it also clears the reason, its author, the writer and a resolution with no target; the note now points to the erasure section. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Erasure removes report rows with DELETE and no op withdraws a report, so no version was ever written deleted and every NOT deleted filter guarded a state the code cannot reach. Migration 122 is not released, so the column goes from the migration, the reference schema and the reads. shapes.txt picks up the new schema dump. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
A memory report compares memory.get's content_sha256, the hash of the canonical JSON, and a document report the SHA-256 of knowledge.get's content. The field said only "hash of the content", and a client that hashed a memory's text got a 409 that reading again never cleared. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…y report A report filed on another agent's row is not found once the caller's own row is written at the key: the repeat then answers 409 when it names the version it read, or files a report on the new row when it names none. The page promised the same report back without a key, and the op's comment said a retry always files the same report. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for the review and for pointing at the admitted document id, which is what the copy check now uses. Round 15 is up.
Before pushing I went through every place a document or memory report picks, binds or rereads its target, and every update action against each column
The other red jobs on c453012 fail on main too. |
zlareb1
left a comment
There was a problem hiding this comment.
Document filings now check the admitted copy ID. The queue reads acknowledged changes and release preserves the maintainer’s reason. Gap references still bypass the gap availability checks.
| ) | ||
| return await readable_version(lookup) is not None | ||
| if kind == "gap": | ||
| return admin and await gaps_store.gap_for_draft(org, namespace, ident) is not None |
There was a problem hiding this comment.
P2 — Report detail still shows a stored gap ID after knowledge gaps are disabled. knowledge.gaps.list hides the same build immediately when gaps or capture are off, but this lookup reads it until its TTL expires. Use the same availability checks for report references and cover disabling gaps while a build is still stored.
zlareb1
left a comment
There was a problem hiding this comment.
The read-scope isolation test cannot build the worker approval and enrollment requests on this run or on the earlier main run. #2156 adds those request fields and keeps the refusal assertion. The failed run still blocks this head. PR job · Main job · Merged fix
…ge-reports The Go and Rust wire models were the only conflicts. They are main's copies with every generator rerun on the merged tree. Main brings ClickHouse#2156, which the read-scope isolation gate needs. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
Thank you for tracing the isolation failure to #2156. Main is merged in 7ef2d1a, which brings #2156 in. The Go and Rust wire models were the only conflicts. They are main's copies with every generator rerun on the merged tree. The report, store, schema baseline, read scope, tunable constant, SDK parity and docs tests pass on the merge (724). |
zlareb1
left a comment
There was a problem hiding this comment.
The gap availability finding remains. A current proof for a replacement document also exposes report text about the private revision it replaced. GitHub reports a merge conflict in the rollout notes and generated references and SDKs.
| detail = KnowledgeReportDetail( | ||
| **_summary(row, known=known).model_dump(), | ||
| target_changed=_changed(row, target), | ||
| problem=row["problem"] if mine or readable else "", |
There was a problem hiding this comment.
P1 — A reporter can quote a private revision in this field. When the same mirrored source publishes a replacement with a different reader list, readable is based on the replacement. A maintainer admitted only to the replacement then receives the old quote. Require proof for the reported revision before serving its prose to other readers, and cover a replacement with a different reader list.

Related: #1147
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):
Agents and clients report a memory claim or a document as incorrect or outdated, or report missing knowledge, with
knowledge.reports.submit. Namespace admins review the reports withknowledge.reports.list,knowledge.reports.getandknowledge.reports.update, and a reporter adds evidence withknowledge.reports.evidence.Why
Step 1A of #1232. An agent that finds a claim wrong or a passage outdated has no way to say so short of editing the target, and maintainers have no queue of such findings. A report records the problem and points at its target; it never edits it. The fix stays an ordinary memory or document write, and resolving a report names the published revision that made it.
Memory proposals and definition drafts were checked first and cannot hold this: both are candidate memory rows decided by accept or reject, while a report points at someone else's claim, or at nothing, and must never be recalled. So reports get their own table,
loom.knowledge_reports, modelled on the knowledge gap tables.Design, in docs/architecture/knowledge-reports.md:
written_by, which lets the erasure find a version written through the user's service account. A resolution on a report with no target is the maintainer's words:reason_bynames their author as it does for a reason. An action with words of its own replaces the reason andreason_by, and one without, such astakeorrelease, carries them forward. The gap helpers move toserver/knowledge/app/people.py. A failed service-account registry read is told apart from an account with no person behind it (read_sa_creator): a report answers 503 and writes nothing, and a gap still counts no asker.readable_version, which reads asmemory.getdoes and serves nothing of the row; a document throughknowledge.get's read path. A target the caller cannot read answers 404. A memory report takes the identity tuple of the row its key was found in. That row may belong to another agent or session of the same user. It never belongs to another user, even underagent*. Later reads look in that row only. A first filing whose version or hash the row found now does not hold answers 409, so a version read in one row never binds to another.getdecides it. A missing report and an unreadable one get the same refusal, so a link never says whether an id exists.leases.holding), so two maintainers never build on the same version.erasure_since, as knowledge gaps use).getserves a report to its reporter and the namespace's admins. A caller who cannot read the target now sees it without the problem, the correction and a maintainer's reason. The reporter keeps reading their own words. Evidence and related reports are served only while the caller reads them.listrows carry no one's words and notarget_changed.known_documentsindocument_reads.py) sees no address or revision for it ingetorlist, and atarget_keyfilter on it finds nothing.target_copy): the namespace's own document or one mirrored copy. Every later read of its target reads that copy alone, so another document at the same address never releases the report's words or address. A document report namestarget_doc_id, thedoc_idknowledge.getreturned, and a first filing answers 409 unless the document found now has thatdoc_id, so a read of one copy never binds to another. Copies at one address can share a revision and text, so neither tells them apart. Each mirrored copy a read admits keeps its proof with the response, and access that ends before the response is sent refuses it.knowledge.reports.*, as withknowledge.gaps.*.target_versiontakes it as a number or a decimal string, and a report carriestarget_version_text, asmemory.getcarriesversion_text. Go readstarget_versionasuint64.Scope and risk
Touches: a migration and the report table, its erasure steps and census rows, five ops,
memory.get's read-scope narrowing (moved into_within_read_scope, behaviour unchanged), and the gap person helpers (moved, behaviour unchanged).Left for a follow-up: the dashboard's report queue, so #1147 stays open for it. Until it exists
get,listandupdateare named inNOT_IN_DASHBOARD. Also left out: #1766 (a search verdict on a missing-knowledge report).Risk: a report holds people's words, so every read checks the target and the role, list rows carry no text, and both erasure scopes cover the table. The migration is 122, after main's 121 for a branch's base namespace.
Compatibility, rollout and rollback
knowledge.reports.submit,get,list,updateandevidence, allexperimental. No existing op or field changes.knowledge.reports.submittakestarget_doc_id, required for a document target.knowledge.reports.listis not idempotent, so its answer never enters the replay cache (as forknowledge.source.push_status).Tests
tests/unit/test_knowledge_reports.py(59 tests): the reporter comes from the token, the target read check, the id a retry repeats (also after the target or a linked report is gone, and for a document after another copy appears or its copy is gone), the one report two agents file when they read one row, a wildcard agent kept to its own user's row, the served revision a resolution names, the author of a resolution with no target, atarget_versionabove UInt64 or sent as a malformed string, a memory version above 2^53 that stays exact from submit to get and list, a blank problem, the refusals, a failed service-account registry read that files nothing, who reads a report, a changed or unreadable target, related reports and a maintainer's reason served only to callers who read them, a document's address served only to whoever may know of it, a filter on an address that keeps the copy the caller sees before the limit, a report that stays bound to its copy when another document appears at the same address, a mirrored address checked again before the response is sent, a submit or resolve that landed still answered after access to its target ends, the queue without words or target state, every maintainer action, the person behind a service account's version,expected_version, the claim held elsewhere, the reporter's evidence, both sides of the erasure fence, a link to an erased report, a link only to a report the caller reads, the rollout gate with an older replica of the other deployment kind, a replica at schema version 121 that holds writes, narrowed tokens,readable_versionserving nothing, a filter that reads no copies for a memory key, a page that keeps proofs only for the copies it lists and drops one its caller stopped knowing, a queue retry that reads source access again instead of replaying, a document report refused unless it names thedoc_idof the copy found now, also when both copies hold the same revision and text, a memory report refused when its version came from another row, a reason kept by actions that bring none, and evidence from another caller answered not found while the report is busy.tests/unit/test_knowledge_reports_store.pychecks the statementscopies_atand the queue send. The domain rules keep their tests intests/unit/test_knowledge_reports_domain.py.tests/integration/test_knowledge_reports.py(8 tests) against a ClickHouse started withdev/ci_start_clickhouse.shandmake migrate: a version read back with every column, the latest version winning, the queue's filters, a copy filter applied before the limit, the copies at an address, the handlers' submit, update and evidence under the claim, a real memory's version above 2^53 filed from itsversion_textand read back unchanged, and both erasure steps, including a resolved missing-knowledge report another maintainer linked and a version written through a service account.tests/unit/test_erasure_knowledge_reports_sql.py(2 tests) runs the user erasure step and the census as real SQL on clickhouse-local: an end-user maintainer who did not file the report, a maintainer's service account, and a resolution with no target that another maintainer's link carried forward. Every version goes in as one unfolded part. No merge can then drop an older version before the test reads it.sdk/go/wire/models_test.go: a get and a list response with the largesttarget_versiondecode in the Go SDK.sdk/typescript/src/client.test.ts: the TypeScript client files a report with a memory'sversion_textand readstarget_version_textback exactly.tests/unit/test_sdk_go_codegen.py: the Go SDK keeps a marked UInt64 field that also takes a string asuint64.The erasure census counts and step order (
test_erasure_verify.py,test_erasure_step_order.py) include the new table and step, and every report count reads with sequential consistency.make lintandmake typecheckpass;schemas/schema.sqldrops the unwrittendeletedcolumn with migration 122; every generator indocs/development/adding-an-operation.mdwas run, and the reach census, SDK, docs and op-gate tests pass.tests/unit/test_knowledge_ingest.pyandtests/integration/test_knowledge_gaps.py::test_gap_draft_rereads_eligible_questions_and_claims_one_model_attemptfail on this machine onmaintoo (the first needs the local job runner, the second a server heartbeat), so they were not part of this check.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 diff and ran the checks listed under Tests.
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.Note
Medium Risk
New experimental API persists user and maintainer text with layered auth, target-read, mirrored-document, erasure-fence, and rolling-upgrade rules; mistakes could leak words or accept reports against the wrong row/copy.
Overview
Introduces knowledge reports: writers file problems about memory claims, documents, or missing knowledge via
knowledge.reports.submit; namespace admins work the queue withlist,get, andupdate; reporters add reference-only evidence withevidence. Reports do not mutate their target—resolution names a published revision or a dismissal reason.Storage and ops: migration
122addsloom.knowledge_reports(ReplacingMergeTree(version)), wired through new handlers, domain validation, and store code (referenced in architecture docs). Operation count goes from 385 to 390; all five ops are experimental and blocked for narrowedread_scopetokens like gaps.Behaviour highlights in the diff: target binding (memory identity tuple, document
target_doc_id/target_copy), idempotent submit by hashed report id, lease-guarded updates,409on stale targets or erasure-in-progress, and 503 on mixed-version replicas without the table (rolling-upgrades rule 74). Person folding for reporters moves toserver/knowledge/app/people.py; failed SA registry reads useread_sa_creatorso reports fail 503 instead of filing under the account. Mirrored-document helpers (known_documents,document_copy) redact addresses admins cannot see and attach proofs on read paths.Erasure and census: user step deletes filed reports and scrubs maintainer fields on others; namespace step deletes all reports; census counts use sequential consistency.
Clients: Go/Python/Rust/TypeScript/Ruby SDKs and codegen gain the new ops; Go/TS handle memory
target_versionabove 2^53 viauint64/ decimal string andtarget_version_text. Docs cover architecture, storage layout, operations reference, and feature overview—no dashboard UI yet (NOT_IN_DASHBOARD).Reviewed by Cursor Bugbot for commit 7ef2d1a. Bugbot is set up for automated code reviews on this repo. Configure here.