Repository navigation
namespace.audit tells the deployment's state from the writer's: missing telemetry, an indexing backlog, procedure reads - #183
Merged
Merged
Conversation
…ng telemetry, an indexing backlog, procedure reads telemetry_unavailable and index_backlog are findings of the new kind system_state; exact-key reads of procedures are intentional_exact_key_reads, left out of the object-store gauge; version_churn counts one version per distinct content. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… a backlog; the optimize skill knows the new codes Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ds; churn drops only repeated content Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…how a given-up row is queued again Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… inspector's read; the ratio leaves procedure reads out Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…o not Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ule says it covers settings and grants Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the ledger lag skips the telemetry check Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…elayed case holds its stub; the panel names procedure reads Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/i160-rules
branch
from
November 3, 2026 00:18
3a8e1ba to
6e4b150
Compare
…ks the worker's fill Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… order; the audit's docs name the system findings Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e telemetry case backdates instead of sleeping; pins cover the structured types Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…'s stalled column is stripped with the aggregates Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ested on a non-lease row; the primer names system_state Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ded remedy and comments say what they count Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…etail names worker rows Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…he rules count Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…nd label and procedure-reads note are tested Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…alidate's unembedded check apart Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…idate's Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… real SQL Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…l and docs say which checks a gap skips Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the CLI names procedure reads Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ds leave the gauge too Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… keeps Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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: #160
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):
namespace.audittells the deployment's state apart from the writer's:telemetry_unavailable(the window's writes left no ledger rows, so the ledger checks are skipped rather than reported clean) andindex_backlog(rows the embedding worker has not reached) are findings of the new kindsystem_state, and exact-key reads of procedures areintentional_exact_key_reads, left out of the object-store gauge.version_churnleaves out a version that keeps both the value and the reinforcement count of the one before it (a status change, a tags edit by id, a lock), so it counts what the writer rewrote or restated.unembedded_rows(and thecontext.packhealth block) counts only rows the embedding worker gave up on with an error of their own; a row still being retried (a provider error, an outage) or whose model call was held or unbilled is the deployment's backlog, andget_search_ratioleaves out procedure reads.Why
Issue 160 asks that a finding say whether the writer did something, and that a missing signal read as missing, not as clean. Four cases graded the writer for something it did not do:
exact_key_storeandcoordination_as_memorycounted 0 reads and passed, and the namespace read as healthy.memory.getby design. Those reads counted towardexact_key_storeand toward the read-count arm ofcoordination_as_memory, so a namespace of runbooks read as an object store.version_churncounted each as a rewrite.What changes
server/identity/api/models_findings.py:FindingKindgainssystem_state, a finding about the deployment rather than the writer. The assistant toolset's primer says asystem_statefinding is never a change to draft for the writer. The CLI table labels itsystem, the dashboard panel "The deployment's state, not the writer's doing".server/identity/app/namespace_audit.py:telemetry_unavailable(system_state, runs first among the checks): a warning when live rows were created in the window and the ledger holds no call for the namespace in it apart from reports on it (namespace.audit,validate,summary,inventory,mentor.brief) and the dashboard's or the assistant's calls that change no data (reads, page-view vitals): only an inspector's call that changes stored state (an op a writer calls or the server audits: a memory write, a setting, a grant) counts, and a worker's own ledger row (kind = 'worker', an extractor's spend on the rows) never does. The audit's own row is one of those reports, so a second audit still sees the gap; a write through any op closes it, a person'sprofile.setin the dashboard included. Rows are judged bycreated_at: a worker's revision of an old row (a sensitivity relabel) keeps it and may leave no ledger row, so a window of revisions only is not judged; nor are copied rows (cross_promoted_from_namespaceset), since a copy's call names a source and a target and is ledgered under no namespace. A recentnamespace.restore(ledgered the same way), in-process writes, and a ledger that keeps less than the window (it holds some calls, so it is not a gap, and the ledger checks then count only the part it kept) are named in the rule'suncertainty. While it warns,exact_key_storeandintentional_exact_key_readsare skipped with the reasontelemetry_unavailable, socoverage.completeis false, andcoordination_as_memoryruns only its key-segment arm: the statement then readsloom.memoryalone, with no join to the ledger, and reportssamples_complete: false. A write of the lastTELEMETRY_LAG_SECONDS(60) is not judged, since the ledger is flushed in batches and a fresh namespace's rows may not have landed. It is skipped when either summary read it needs failed, and for a window no longer than the lag, which holds no row old enough to judge. The inspector ops that close a gap arestate_change_ops(), shared withnamespace.summary(which keeps itsmemory.*subset).intentional_exact_key_reads(usage_heuristic, info): exact-key reads of live rows whose type is structured by design (STRUCTURED_TYPES, procedures), counted in the ledger summary astyped_gets.exact_key_storev2 leaves those reads out of the gauge and of its hot-key samples, andsummary.get_search_ratioleaves them out too. A ledger read's key is thememory_keycolumn over HTTP andargs['memory_key']over MCP (whose rows leave the column empty), so a procedure read through the coding-agent plugins is matched too; amemory.bulk_getnames no single key and is not.index_backlog(system_state): searchable, non-high-sensitivity, non-empty live rows with no vector that the worker has not given up on (embed_failed_atunset, or set for a model call the deployment held or could not bill:EMBED_HOLDS, the worker's markers, pinned by a test). A row still being retried (a provider error, an outage) and a held or unbilled one are the deployment's: they count here, andunembedded_rowsv2 counts only a row the worker gave up on with an error of its own. Info withinINDEX_GRACE_SECONDS(600,namespace.validate's default grace), a warning once one is older. Samples carry key, id and age.coordination_as_memoryv2 does not count a structured row on its reads (its key-segment arm is unchanged).version_churnv2 leaves out a version that keeps the value and thereinforcement_countof the one before it of the same row (agent, user, session, key): a status change (conflict marking, supersession), a tags or confidence edit throughmemory.update_by_id, a lock or an unpin, and the server's own copies of a write (a freshmemory.setleaves more than one such row). A new value counts, as does a restatement of the same value (amemory.setormemory.pinof it bumpsreinforcement_count), a delete and a set of the same value after it (the tombstoned state changes), a value that flips back and forth and a version with no recorded hash. A row whose tags are edited over and over is therefore not counted; the rule'suncertaintysays so. Judging bystatusinstead was tried and rejected: the labeled clean namespaces then read as churn.NamespaceAuditSummarygainstyped_gets,written_in_windowandledger_calls.loom-optimizeskill (both plugins) gets a row for the three codes, the correctedversion_churntext and a Step 1 line that asystem_statefinding is never a rework; both manifests go to 1.2.4.docs/features/namespaces-and-sharing.md, and indocs/guides/optimize-namespace.mdwhat asystem_statefinding means for a rework (nothing for the writer) and the row for the three codes.Scope and risk
system.query_log, a namespace of 200,000 live rows, 200,000 embedding rows, 600,000 version rows and 200,000 ledger rows):index_backlogreads 415,032 rows and 18.6 MiB (it testsvalue_len, not the value), 55–78 MiB peak, 122–201 ms;version_churn605,324 rows, 157 MiB, 81 ms (on 3,000,000 version rows of one namespace it reads 3,007,938 rows in about 300 ms and peaks at 450 MiB, against 200 MiB for v1's plainGROUP BY: the window reads in the table's order,optimize_read_in_window_order, which halves the 900 MiB it took otherwise); the ledger summary with the procedure-key read, now taking an MCP read's key fromargs, 404,676 rows, 11.7 MiB read, 9.8 MiB peak, 57 ms at the median, andexact_key_store404,676 rows, 11.6 MiB, 19.4 MiB, 58 ms (200,000 ledger rows whoseargscarry a hash, a key and an agent, against 200,000 live rows); the whole audit answers in 661–800 ms once warm.summary_live,summary_ledger, andsummary_embeddingsthroughunembedded_rows' given-up rule), one new statement (index_backlog, an anti-join of the namespace's live searchable rows against its embedding rows, both on the(org, namespace)prefix), andexact_key_store,coordination_as_memory,unembedded_rowsandversion_churnchange their predicates.context.pack'snamespace_healthblock runs its own subset of checks and summary reads, and does not runtelemetry_unavailable; itsexact_key_storeandcoordination_as_memoryread as before apart from the procedure reads they now leave out, and itsunembedded_rowsno longer counts a held or unbilled model call (v2).exact_key_store,coordination_as_memory,version_churn,unembedded_rows): a namespace whose gets were mostly procedure reads no longer reads as an object store, and one whose history was mostly status changes no longer churns.Compatibility, rollout and rollback
kindmay now besystem_state; three finding codes added (telemetry_unavailable,intentional_exact_key_reads,index_backlog);NamespaceAuditSummary.typed_gets,written_in_window,ledger_callsadded;exact_key_store,coordination_as_memory,version_churnandunembedded_rowsgo torule_version2. Nothing removed.system_statefinding with no kind label.namespace.validate'sunembeddedcheck keeps its v1 predicate and kind (contract_violation, every live row with no vector past its grace, held or unbilled model calls included); the docs say so beside thesystem_statekind.NamespaceAuditSummary.get_search_rationow leaves out procedure reads ((gets - typed_gets) / searches), so a namespace of runbooks no longer reads as a key-value store;getsstill counts them.NamespaceAuditSummary.unembedded_rows(and thecontext.packhealth block'sunembedded_rows) now counts only rows the worker gave up on (embed_failed_atset) with an error of their own; a row still being retried, or whose model call was held or unbilled, counts inindex_backloginstead.NamespaceAuditSummary.version_rowsandversion_bytesnow leave out a copy that keeps the row's value and reinforcement count (a status change, a tags edit by id, a lock, the server's own copies), where they counted every version row: a namespace's figures drop across the upgrade with no change to the namespace.Tests
Labeled cases (
tests/integration/test_findings_labeled_cases.py, private ClickHouse and server): nine namespaces built through the API (each audited once its rows are embedded, but for the delayed-indexing case, whose row carries a held embedding stub the worker leaves alone), each labeled with the findings it must raise and every other rule required to stay quiet — clean, double-encoded values, an oversized claim blob, hash keys, valid typed records and a procedure, a procedure read 220 times by key over HTTP, stale verification and an endedvalid_to, a row whose model call was held (delayed indexing), and writes whose ledger rows were removed (missing telemetry). The missing-telemetry case rewrites its rows as created two minutes earlier, so it does not wait out the 60-second lag. Across both reports, every rule with a label or a hit (the table leaves out a rule that stayed quiet on every case). No labeled case raises the four rules this PR moves torule_version2; their evidence is the clickhouse-local unit tests below, and the labeled run shows they stay quiet on the cases they should:Unit (
tests/unit/test_namespace_audit.py): writes with no ledger rows skip the ledger checks and say why, while a ledger with the window's calls and a quiet namespace read clean; reads of structured rows leave the gauge (and its hot keys) and are reported apart; an indexing backlog is the system's state and warns only past the grace; a failed summary read leaves the telemetry check skipped; the threshold pins for the new constants and raised versions.Integration (private ClickHouse and server): the labeled cases above, the findings-contract and audit-summary suites and the assistant toolset suite (11 passed); the findings-contract suite is what showed a fresh namespace's writes, not yet ledgered, reading as missing telemetry, hence the 60-second lag.
Unit, clickhouse-local (real SQL on the production tables): the ledger summary counts a dashboard write and no inspector read; an audit run twice over writes the ledger never recorded (its own row, a summary and a dashboard read in the ledger) still warns, and a
procedure.addcall closes the gap, as does a person'sprofile.setin the dashboard (ledger_callscounts an agent's get and a dashboard set, not the dashboard's or the assistant's reads); a worker's revision of a row created two days earlier is not judged, a dashboard page view (ui.vitals) or a worker's own row does not close a gap, and a settings save (namespace.register) does; a copied row into an empty ledger is not judged;version_churncounts a row's status-only versions once, another user's row with the same content as its own, a status flipping A→B→A→B four times, versions with no recorded hash each, and a writer's three restatements of one value three times, a delete and a re-set of the same value as two more, and copies that keep both once; a hot short procedure is not coordination state while a hot short status row is, and during a gap only the key-segment arm (a lease) is sampled; a procedure read over MCP (its key inargs) is left out of the gauge and the plain fact read beside it is sampled fromargs; a held model call and a provider error still being retried are a backlog and not an unembedded row, a row given up on with an error of its own the reverse, and an empty, an episodic or a high-sensitivity row neither. The held markers equal the embedding worker's.Frontend: a panel case shows the
system_statekind label and the procedure-reads note on the ratio; the tests andnpm --prefix frontend run buildpass.Plugins:
agent_plugin_sync --checkis clean and the twoloom-optimizecopies are identical. The plugin evals (integrations/claude-code-plugin/evals) grade theloom-memoryskill only, so none covers this text.make format-check lint typecheck, the unit tests above and the generator checks.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 each predicate against the tables it reads and the labeled cases against a live server.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited. (No migration.)loom-optimizechanges; both manifests go to 1.2.4, past the 1.2.3 the release PR uses.)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.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code