Repository navigation
Conversation
…t need a second look A namespace admin had no one read of what waits for a person. `curator.status` (experimental, admin, read-only) computes it on every call from rows Loom already holds, stores nothing and calls no model. - `proposals`: the pending count, the days the oldest has waited, the facts filed as a proposal and the decisions of the last 7 days, and whether the count is over `memory_proposals_scan_cap`. - `flagged`: accepted facts with a harm report left after retractions, then those that runs graded `fail` relied on. A conflicted fact stays with the conflicts list. - `stale`: served facts with a stale code link, then those tagged `source-changed`. Each finding names `memory.update_by_id` with the fact's id and, as `if_match_sha256`, the content hash `memory.get` serves, read by the report citation read. A fact that read cites no hash for (high sensitivity, a value over `namespace_report_hash_max_bytes`) is listed with no write. A `flagged` read that reaches its scan cap answers `too_large` with no items, and the other sections still answer. The op is served over HTTP, as the MCP tool `loom_curator_status` on no toolset, by every generated SDK and by `loom curator status`. The dashboard has no view of it, which `NOT_IN_DASHBOARD` records. Related: #2152 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.
|
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
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):
curator.status(experimental, namespace admin) reports what in a namespace waits for a person: the proposal queue in counts, the accepted facts with a harm report or a failed graded run, and the served facts whose linked code or source document changed. Each finding namesmemory.update_by_idwith the fact's id and current content hash, andloom curator status --namespace <namespace>prints the report.Why
A namespace admin has no one read of what needs a person. Pending proposals are listed by
memory.proposals, harm reports sit in the usage totals, failed grades in the runs, stale links in the code link table and a changed source in a tag. Finding the facts to look at again means calling each of them and joining the answers by hand.curator.statuscomputes the answer on every call from rows Loom already holds. It stores nothing, calls no model and changes no fact.sectionspicks fromproposals,flaggedandstale; empty, the default, computes all three side by side. A section that was not asked for isnulland makes no read. Another name is a validation error.proposalsis counts only:pendingandoldest_daysfrom the live rows ofloom.memorywithstatus = 'proposed',filed_7dfrom the versions written as a proposal inloom.memory_versions,decided_7dfrom thememory.proposal_acceptandmemory.proposal_rejectrows ofloom.audit_log(two ranges of its sort key), andover_scan_capwhenpendingis overmemory_proposals_scan_cap. No value column is read.flaggedlists accepted facts (status = 'active'): first those whose harm reports inloom.memory_usage_totalssum to more than zero, most first (harm_reported), then those under a key that runs gradedfailrelied on, most runs first (graded_fails). A conflicted fact is not listed, becauseconflicts.listalready holds it.stalelists served facts: first those with a stale code link, by the existingcode_link_reads.stale_linksread (stale_link), then those taggedsource-changed(source_changed).apply, in the shapenamespace.tunegives its drafts:memory.update_by_idwithorg, the fact'smemory_idandif_match_sha256,args_complete: falsebecause the person adds the new value, andrequired_roleread from the operation registry.if_match_sha256is the onememory.getserves, which is whatmemory.update_by_idcompares. The storedcontent_sha256column differs from it for an object with a null field, so a write guarded by the column would be refused. After the sections are read, one read fetches the live revision and served hash of every fact the lists show, throughfinding_evidence.revisions_for, the readnamespace.auditcites its rows with. That read cites no hash for a high-sensitivity fact or a value overLOOM_NAMESPACE_REPORT_HASH_MAX_BYTES; such a fact is listed withapply: null, because an emptyif_match_sha256is no precondition.SCAN_CAP, a constant ofserver/memory/store/curator.py), and so do the rows under the failed keys. Aflaggedread that reaches its bound answersunavailable: "too_large"with no items, because a cut list would read as the whole one; the other sections still answer. Thestalereads ask forlimitrows each.Decisions made while building it:
GROUP BYoverarrayDistinct(memories_used)), so the bound applies to the distinct keys of failed runs and not to the runs.# not a setting:reason. No setting is added.limitfindings while a fact is being deleted.Scope and risk
Touches:
server/memory/api/ops_curator.py,server/memory/api/models_curator.py: the operation and its wire models.server/operations/registry.pyappends the module.server/memory/app/curator_status.py: the handler.server/memory/store/curator.py: every statement.server/memory/domain/curator.py: the section names, the codes and their titles.server/operations/dashboard.py:curator.statusinNOT_IN_DASHBOARD, with the reason.server/operations/reach_manifest.py(generated).server/settings/catalog.py:OP_BUDGETS_P99_MS["curator.status"] = 1500, and the comment ofnamespace_report_hash_max_bytesnames the new reader.sdk/python/loom/cli_curator.py(new),sdk/python/loom/cli.py,server/cli/login.py: theloom curator statuscommand.docs/reference/,loom.example.yaml,schemas/loom-settings.schema.json, the CLI and SDK surface snapshots, and the eight new statement shapes intests/analyzer/shapes.txt.docs/architecture/curator.md(new), a section indocs/features/memory/writing.mdand one indocs/guides/without-the-dashboard.md.Left alone: no table, no migration, no worker, no new setting, no dashboard view and no toolset entry.
memory.proposals,conflicts.listandstale_linksare called or left as they are.What could break:
(org, namespace). The transport admits a namespace admin and refuses a token whose read scope is narrowed below the namespace, as for theknowledge.gaps.operations, before any read. A stale link into a repository the caller may not read is not listed. No answer holds a value: a value is read only to hash it, for at mostlimitfacts a list, and a high-sensitivity fact's hash is not cited.loom.memory FINALby id and by key send one statement for each 64 KiB of the ids or keys they bind, and every other read is one statement. The largest are those two and the twoGROUP BYstatements, each bounded as above. Measurements are under Tests.Known limits, stated in
docs/architecture/curator.md:flaggedbound keeps answeringtoo_largefor that section.graded_failsmatches by key, because a run records the keys it relied on: every identity of the namespace that holds the key is listed.limitor more harm reports theflaggedlist holds no failed run;limitgoes up to 50.Compatibility, rollout and rollback
curator.status: experimental, roleadmin, idempotent, read-only. HTTPPOST /v1/curator.status; MCP toolloom_curator_status, on no toolset and not under thealllisting; a generated method in each SDK (agent.client.curator.status()in Python).org,namespace,sections(list ofproposals,flagged,stale; default empty, which computes all),limit(1 to 50, default 20, per section).proposals(pending,oldest_days,filed_7d,decided_7d,over_scan_cap,unavailable),flaggedandstale(items,unavailable), eachnullwhen not asked for. An item hasmemory_id,memory_key,code,title,count,refandapply(the existingTuneApplyshape, ornull).harm_reported,graded_fails,stale_link,source_changed;unavailableis""ortoo_large.loom curator status --namespace <namespace> [--json].LOOM_NAMESPACE_REPORT_HASH_MAX_BYTESandLOOM_MEMORY_PROPOSALS_SCAN_CAPare read as they are; the first one's description now namescurator.status.Tests
All of it ran against a ClickHouse container and a server from source that were started for this change. The first, the analyzer and the
test_curator_status.pyintegration runs below are on the pushed commit; the others ran on the same change before its last rebases ontomain, which touched none of its hand-written files.pytest tests/unit/test_curator_status.py tests/unit/test_cli_curator.py tests/unit/test_package_contracts.py tests/unit/test_op_transport_contract.py tests/unit/test_tunable_constants.py tests/unit/test_store_names_refused.py tests/unit/test_degraded_unnoted.py tests/unit/test_public_copy.py tests/unit/test_doc_links.py tests/unit/test_agent_instructions.py tests/unit/test_cli_surface_snapshot.py tests/unit/test_op_reach_census.py tests/unit/test_sdk_surface_contract.py tests/unit/test_settings_reference.py tests/unit/test_settings_defaults.py tests/unit/test_live_settings.py tests/unit/test_op_budgets.py tests/unit/test_op_surfaces.py tests/unit/test_sdk_parity.py tests/unit/test_docs_reference.py -n 2: 717 passed.test_curator_status.pydrives the handler over a store that answers from lists, then runs each statement onclickhouse localagainst the real table definitions: which rows count as pending, filed and decided, that a retracted harm report is not read, that a run regraded topassno longer counts, and that the hash cited is the served one and not the stored column.test_cli_curator.pycovers the one line per section and per finding,--json, the hint that names the command as it was run, and a refusal printed without the token.test_op_surfaces.py,test_op_budgets.py,test_op_inputs_after_gate.py,test_op_scope_fields.py,test_read_scope.py,test_read_scope_admission.py,test_mcp_listing_budget.py,test_mcp_toolset.py,test_idempotency_across_transports.py), the generated SDK checks of the five SDKs,test_sdk_parity.py, the SDK surface snapshot (which gains thecuratorclient), the settings reference checks,test_docs_reference.py,test_page_summary.pyandtest_namespace_audit.py, with-n 2: 1318 passed.pytest tests/unit -k "test_sdk_ or test_cli_ or test_mcp_ or test_docs_ or test_settings_ or test_op_ or test_schema_baseline or test_i18n" -n 2: 5559 passed.pytest tests/analyzer -n 2: 12 passed, with the eight new statement shapes intests/analyzer/shapes.txt.pytest tests/integration/test_curator_status.py: 5 passed. A writer, an admin of another namespace and an admin token narrowed to one user are refused. The proposal counts follow the queue as proposals are filed and one is rejected. A harmed fact is flagged andmemory.update_by_idwith the finding's arguments plus a value succeeds, then is refused with 409PRECONDITION_FAILEDonce the fact changed; the same write runs for an object with a null field; a high-sensitivity fact is listed withapply: null. A fact with a stale link or thesource-changedtag is stale, and a link into a repository the caller may not read is not listed. An empty namespace answers zeros.pytest tests/integration/test_read_ops_never_5xx.py tests/integration/test_read_scope_isolation.py tests/integration/test_restricted_namespace_leakage.py -n 2: 39 passed.pytest tests/integration/test_cross_principal_leakage.py, with one worker: 37 passed, 17 skipped. With two workers that file had 2 teardown errors intest_the_file_lookups_wider_read_serves_only_the_callers_own_rows, where both workers reset the same live setting on one server; the test coversmemory.for_file, which this change does not touch.passrun counted, a deleted row read, the stored hash cited, an unguarded write named, a list not cut, a role hard-coded) and 5 to the command each fail a unit test.make typecheck: the mypy gate reports 0 errors andmypy --strict sdk/python/loomsucceeds.ruff checkandruff format --checkpass, as do the function-length and secrets gates and the--checkrun of every generator inmake lint.Latency, from
system.query_logand the client. The namespace held 50,000 accepted facts, 500 pending proposals, 200 facts taggedsource-changed, 1,500 facts with a harm report, 21,500 runs of which 1,500 gradedfailover 1,800 keys, and 20,300 audit rows of which 300 are proposal decisions. Each section was called 200 times withlimit: 50after 10 warm-up calls, on a shared development machine that was busy with other work.proposalsflaggedstaleproposals: pending rowsproposals: filed in 7 daysproposals: decided in 7 daysflagged: harm totalsflagged: failed runs by keyflagged: rows of the harmed idsflagged: rows under the failed keysstale: rows by tagThe stale-link statement is not in the table: that server had no repository registered, so
stale_linksreturned before its read. The integration test covers its result.Tools this machine lacks: the
clickhousebinary,rustfmt,gofmtandshfmt. The statement tests ran with the binary copied out of the ClickHouse container, and the Rust and Go generators ran withrustfmtandgofmtfrom containers at the versions CI pins. No shell file changed, soshfmtwas not needed.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 handler, the statements and the tests were read line by line against the invariants and the area rules; every statement was run on the real table definitions; the mutation checks above confirm the tests fail when the behaviour changes; the hash a finding cites was compared with the stored column on a live row to confirm they differ for an object with a null field.
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. (No migration.)hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version. (No plugin file changed.)npm --prefix frontend run build) and its tests pass, iffrontend/changed. (frontend/is not 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
New admin-only operation runs up to eleven bounded ClickHouse reads per call across proposals, usage harm totals, graded runs, and stale links; incorrect scoping or hash citation could mislead fixes, though it does not mutate data.
Overview
Adds
curator.status, an experimental namespace-admin read that surfaces what still needs a human: proposal queue metrics (proposals), accepted facts flagged by harm reports or failed graded runs (flagged), and served facts with stale code links orsource-changedtags (stale). The op is read-only (no model calls, no writes); each finding can include anapplydraft formemory.update_by_idwithif_match_sha256from the same hash path asnamespace.audit.Surfaces:
POST /v1/curator.status, MCPloom_curator_status(not on default toolsets), generated SDK methods, andloom curator status --namespace …with human or--jsonoutput. Docs adddocs/architecture/curator.mdand cross-links in memory writing and without-the-dashboard guides;LOOM_NAMESPACE_REPORT_HASH_MAX_BYTESdescription now includes this op.Implementation: Handler in
curator_status.pyruns section queries in parallel viaserver/memory/store/curator.py, thenfinding_evidence.revisions_forfor guarded writes;flaggedreturnstoo_largewhen scan caps (2,000) are exceeded.Reviewed by Cursor Bugbot for commit 340f96c. Bugbot is set up for automated code reviews on this repo. Configure here.