Repository navigation
Conversation
A drafted answer is text no person has read, so it is stored as a candidate of the learnings review queue with source_kind curator_draft, which only the namespace's administrators list, count or decide. No memory read path changes. learnings.list serves an administrator the draft's content_sha256 and its evidence pointer. learnings.review promotes it only for a person who administers the namespace and sends that hash as approved_sha256; a service account may reject. The promotion writes the curator's namespace-wide row through memory.set with the reviewer as actor, source_class derived, source_trace curator:<candidate_id>, the absent precondition, and grounding and evidence set through two private attributes no request body reaches. A decided draft takes no other decision, and a promotion that stopped after its write completes on a repeat. Migration 139 adds loom.learnings_queue.evidence. Review of the kind waits for every live replica to have it, because an older build lists the kind to viewers. Redacting the fact a draft became blanks its candidate, found by the row's source_trace. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The generated SDK files and the reference pages are regenerated on the merged tree. 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 1 potential issue.
❌ 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 da04b4d. Configure here.
The journal lists `138_knowledge_suite_required.sql` and then `139_curator_draft_evidence.sql`. Rolling-upgrade rule 102 is the required regression suite's, so the rule for a curator's draft is 103, and the curator page cites that number. The analyzer shape list holds the one shape of the merged schema dump. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… a merged write leaves the draft pending `learnings.review` marks the write of a draft's fact uncertain only while its outcome is unknown. A refusal `memory.set` raises before its insert (409 `PRECONDITION_FAILED`, 409 `PINNED_CONFLICT`, 422 `BLACKLISTED`) clears the mark, so the lease `definition.writer/<org>` is released with the review and the next review, redaction or namespace erasure in the org is not refused until the lease expires. A failure of unknown outcome keeps the lease. `memory.set` merges a draft whose text a row of the namespace already states and stores no row under the draft's key. The review answers 409 `PRECONDITION_FAILED`, naming that row's key when the reviewer may read it, and the draft stays pending. The curator page, the comment on `MemorySetInput` and a test comment say that no `memory.set` body sets `grounding` or `evidence` and that a `memory.bulk_set` entry sets both. `learnings.list` takes a draft's value from the decode its hash is taken over. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related: #2152
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):
The learnings review queue holds a new private kind of candidate, a curator's drafted answer (
source_kindcurator_draft): only a namespace's administrators list it, and a person accepts it withlearnings.reviewandapproved_sha256, after which it is a fact with that reviewer as itsactor. No pass writes a draft.Why
A curator's drafted answer to a question several people asked is text no person has read. Until someone accepts it, only the namespace's administrators may read it. Loom already holds that kind of record: the private candidates of the learnings review queue, which an administrator lists, everyone else gets neither a row nor a count of, and a review promotes through
memory.set. A draft is one more kind of them.What a draft is. A row of
loom.learnings_queuewithsource_kindcurator_draft: the key the fact would be written under (curator/gap/<k>), the drafted answer inproposed_value, the gap it answers insource_resource_id, and in the new columnevidencea pointer as JSON to the shared document it cites (kind,key,version,sha256,recheck,run_id,redraft_of). The pointer never holds a quote or a passage.Why a private candidate and not a
proposedmemory row. A proposed row lives inloom.memory, so every memory read path would need a term that hides a model's unreviewed text from viewers, and a new actor kind would have to own the row. The queue's private candidates already have the audience rule in each statement, the erasure fence and the redaction scrub, so this change touches no memory read, no status predicate and no view. A draft is also not judged as a proposal is: the proposal policy, the advice and the suite checks apply to proposals, and a draft is judged on the document it cites, somemory.proposalsdoes not list it. The cost is that a draft is not served on trial before review.The review.
learnings.reviewof a draft:RESOURCE_NOT_FOUNDunless the caller administers the namespace, then takes the review claim (503 while another reviewer holds it) and the fleet gate below;promoteneeds a person who administers the namespace and acts under their own name (reviewers.reviewer_subjects; a service account gets 403AUTH_INSUFFICIENT) andapproved_sha256equal to thecontent_sha256learnings.listserved. An empty or different hash answers 409PRECONDITION_FAILEDwithout the stored hash.destinationother thanmemoryis a validation error;rejectneeds the admin role only, a service account included;The fact. A promotion writes through
memory.set: identity(org, namespace, loom-curator, -, -)under the draft's key, typesemantic, no tags,source_classderived,source_tracecurator:<candidate_id>,source_resource_idthe cited document's key,if_match_sha256absent, andgroundingverbatimwith the pointer inevidence. The last two are set through two private attributes onMemorySetInput, which are not fields, so nomemory.setbody sets them. Amemory.bulk_setentry sets both columns on the row it writes, so neither proves that a review accepted a row. The row'sactoris the reviewer, from the review's token.A refused write. A row now under the key, the blacklist, a pinned conflict or a text that a row of the namespace already states leaves the draft pending.
memory.setmerges such a text into that row and stores nothing under the draft's key, so the review answers 409PRECONDITION_FAILED, naming that row's key when the reviewer may read it. The review marks its write uncertain only while the outcome is unknown: a refusalmemory.setraises before its insert releases the leasedefinition.writer/<org>, so the next review, redaction or namespace erasure in the org is not refused until that lease expires. A review that stopped after the write and before its decision row completes on a repeat: a live row of the curator with the draft's trace and content hash is taken as written.Redaction and erasure. Redacting a version of the fact a draft became blanks the draft's candidate (
proposed_value,rationale,decision_reason,evidence). The candidate is the one the row'ssource_tracenames, read by id, whatever key the fact holds by then. Namespace erasure deletes the table's rows of the namespace in the existinglearnings_queue.deletestep, and the queue's writer fence covers the kind.Scope and risk
MemorySetInput(two private attributes), the row build ofmemory.set(it copies them to the row when set), the history target a redaction reads (source_traceadded), and the redaction of private candidates.learnings.review's body is split into_reviewand_promoteto stay under the function-length ratchet; the routing of the other kinds is unchanged, and their unit and integration tests pass.status_predicate,memory.proposals, the proposal policy and the dashboard. Nothing writes the kind.(org, namespace, candidate_id)from the token's scope. Below the admin role the transport answers 403 for a draft's id and for an unknown id alike, and the handler answers 404 for a caller the namespace does not admit as an administrator.loom-curatorwith acurator:<id>trace, and amemory.bulk_setentry can also setgroundingverbatimand a pointer, so neither the trace nor those columns prove that a review accepted a row. Redacting such a row blanks the draft that id names, as redacting the accepted fact does. The redaction is an administrator's act, and a trace that names no draft blanks nothing.message, while a missing candidate's does. Only a caller that passed the transport's admin gate reaches either, so this change keeps that answer as it is.Compatibility, rollout and rollback
learnings.reviewinput gainsapproved_sha256: str = "".learnings.listentries gaincontent_sha256: str = ""andevidence: object | null = null, both filled for acurator_draftonly.learnings.list,learnings.qualityandmemory.lineageleave acurator_draftout for a caller below the admin role.LearningsClient.reviewtakesapproved_sha256. The MCP descriptions oflearnings.listandlearnings.reviewsay the same; both stay off every listing.139_curator_draft_evidence.sqladdsloom.learnings_queue.evidence String DEFAULT ''. Every queue row carries the column, and a status row copies it.docs/architecture/rolling-upgrades.md): the previous build does not know the kind is private. It lists a draft, with its text, to every viewer, decides it with no person and no hash, and writes a status row withoutevidence. So review of the kind requiresmachines.fleet_at(ch, CURATOR_DRAFT_MIGRATION)and answers 503OVERLOADEDbelow it.tests/unit/test_curator_draft_candidate.pyties the constant to the migration's file name.mainis138_knowledge_suite_required.sql, and rule 102 onmainis the required regression suite's. If an open pull request that adds a migration or a rule merges first, this one is renumbered to follow it.curator_draftrow of any status exists, and rejecting the drafts does not make it safe, because a rejection keeps the draft's text on its status row. The way back iscurator_modeoffin every namespace, thenALTER TABLE loom.learnings_queue DELETE WHERE source_kind = 'curator_draft', then the downgrade (docs/architecture/curator.md, "Rolling back"). A fact a draft became is an ordinary memory row and stays. Reverting leaves the column, which the previous build ignores.Tests
Run on a ClickHouse and a server started for this change, in the main integration posture (auth not required, fake providers, workers off), on the head that holds
mainatf9cb57fd0.pytest tests/unit/test_curator_draft_candidate.py: 29 passed. It covers the private tuple in every list, quality, redaction and scrub statement and in the writer fence; promotion by a service account, with no hash, with another hash and with the hash served; rejection by a viewer and by an administrator's service account; the written fact and itsactor; a refusalmemory.setraises before its insert (a row now under the key, a pinned conflict, the blacklist), which leaves no decision and no holder of the writer lease; a failure of unknown outcome, which keeps the lease; a write thatmemory.setmerged into a row stating the text, which leaves the draft pending; a body that setsgrounding,evidenceor the private names over the transports' validation and the MCP schema; the fleet gate and the constant's file; both orders of a promotion and a rejection; the repeat after an interrupted promotion; and redaction of the accepted fact, moved or not. The four cases of a refused or merged write failed before the fix.pytest tests/integration/test_curator_draft_candidate.py: 6 passed. Only an administrator lists and reviews a draft; a person promotes by hash and a viewer then reads the fact; a key that now holds a row refuses, the draft stays pending and a rejection of it right after answers 200; a text another row states refuses with that row's key, writes no row under the draft's key and leaves the draft pending; namespace erasure leaves no value and no pointer; a promotion and a rejection sent at once leave one decision.pytest tests/integration/test_definition_draft_access.py tests/integration/test_query_history_drafts.py tests/integration/test_memory_history_redact.py: 11 passed, 1 xpassed.tests/integration/test_assistant_turn_learnings.py, run serially: 10 passed.test_package_contracts,test_op_transport_contract,test_tunable_constants,test_store_names_refused,test_degraded_unnoted,test_public_copy,test_doc_linksandtest_agent_instructions: 903 passed, 13 skipped, 1 failed. The failure istest_degraded_unnoted.py::test_every_broad_handler_notes_its_fallback_or_says_why_it_need_not, which namesserver/code/app/index/review_brief_build.py::_history_section::gather::1. This change does not touch that file, and the test fails the same way on a copy ofmain.pytest tests/analyzer: 12 passed. The corpus was regenerated after the merge: 7 statement shapes differ frommain.make migratefrom an empty ClickHouse applied 109 files, andmake schema-dumpon it leftschemas/schema.sqlas committed: it differs frommainby the one column.--check:sdk_py_gen,sdk_py_client_gen,sdk_py_admin_gen,sdk_ts_gen,sdk_rb_gen,sdk_rust_gen,sdk_rust_gen --fixtures,sdk_go_gen,docs_reference,op_reach_census,plugin_eval_tools. None changed a file.rustfmtandgofmtcame from therust:1.85.1-slimandgolang:1.27.4images.sdk/rust/src/wire_models.rsis 2,401,769 bytes. The registry holds 426 operations, 312 of them experimental.ruff formatandruff checkon the changed files,make typecheck, the function-length gate, and Prettier 3.9.9 ondocs/architecture/curator.mdanddocs/architecture/rolling-upgrades.md: clean.test_mcp_listing_budget,test_sdk_surface_contract,test_go_sdk_contract,test_docs_reference,test_op_reach_census, the erasure, schema and migration scans), which passed on the head beforemainwas merged in and run in CI;make test-mixed-version, which builds two images and runs in themixed-versionCI job; and the full unit and integration suites, which run in CI.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 diff read once against the repository's invariants, the tests above, and the refusal paths over HTTP.
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