Repository navigation
The knowledge factory example reports the problem against the revision it read - #2370
Merged
Merged
Conversation
…n it read The example started its correction from a finding the script made up. Its report stage is exercised: the reporter reads the definition's source row and files knowledge.reports.submit with that read's version_text and content_sha256, the failed run in run_id, and run: and reflection: references as evidence. The same request sent a second time answers the same report. The reviewer takes the report, its resolve that names the reported revision answers 422, and it hands the curator the target the report names and the report id. The curator holds writer and calls no report op. After the promotion the reviewer resolves the report with the published revision, which the reporter reads back, so the result's link from the problem to the correction is held by Loom. The coverage entries report and repeated_report read exercised. qualified stays false until a curation pass is exercised. Agent.call sends "-" for a run_id the caller leaves unset, and knowledge.reports.submit reads that as a run and refuses it, so the example names the run. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The branch holds main at a01c25e. Main changed no file of the knowledge factory example, and the merge has no conflict. 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.
|
… them - A token minted with --read-scope below the namespace fails the run, and not at the report stage: the reviewer needs memory.promote in setup, the reporter run.reliance in run_1, and the curator calls no report op. Loom refuses a narrowed token both ops and every knowledge.reports.* op, and bounds its reads to one user or session. - Only an administrator takes, resolves or dismisses a report. Its reporter adds evidence with knowledge.reports.evidence, which needs writer, so a report does not change through an administrator alone. - While a live replica runs a schema below the migration that adds the reports table, knowledge.reports.submit and knowledge.reports.update answer 503 and the run ends failed at the report stage, after setup registered both namespaces. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hy a report read is not repeated - Every stage entry of COVERAGE is exercised, so no stage can read not_exercised. new_result and run() hold no branch for that status, and the tests accept only not_run for a stage after a stop. - The two knowledge.reports.get reads are single reads: Loom reads a report with sequential consistency, so each shows the last acknowledged change. A comment says so at the first read and at the LAGS table of the tests. - The docstring of evidence() names the report it reads. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…o a run that reaches it While a live replica runs a schema below the migration that adds the reports table, `knowledge.reports.submit` and `knowledge.reports.update` answer 503, and a run that reaches the `report` stage ends `failed` there. Not every such run reaches it. Read receipts are written only when every live replica runs the read receipts migration, which is older than the reports migration. With a replica below both, `run.reliance` lists no version, the `run_1_revision_recorded` check fails and the run ends at `run_1`, with no report op sent. The guide's limit named `report` as the stage for every run. Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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: #1185
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 knowledge factory example (
sdk/python/examples/knowledge_factory.py) files a problem report against the revision of the definition it read, sends it a second time to show that one problem is one report, and resolves it with the published revision. Its coverage entriesreportandrepeated_reportread exercised.Why
The example started its correction from a finding the script made up: nothing in Loom said which revision was wrong, and the link from the failed run to the correction was text in the promotion's
rationale.knowledge.reports.*holds both, so thereportstage runs:memory.get) and filesknowledge.reports.submitwith that read'sversion_textastarget_versionand itscontent_sha256astarget_sha256, the failed run inrun_id, andrun:<run 1>andreflection:<run 1>as evidence.report_id, state and version.resolvethat names the reported revision answers 422VALIDATION_FAILED("the target has no revision newer than reported revision N"), and the report staystakenat version 2.writer, reads that revision and calls no report op.version_textmemory.getserved, and the reporter reads its report back asresolvedwith thatresolution_revision.The result's
problem_to_correctionlink is the report, held by Loom, in place of the rationale text.Two facts of the report ops shape the example, and the guide states both:
knowledge.reports.updatecomparesresolution_revisionwith the versionmemory.getserves for the source row, not with a promotion. A candidate that awaits review is a newer revision, so the refusal the example reads is sent before the candidate exists, and the guide lists as a limit that an administrator can resolve a report before its correction is published.Agent.callsends-for arun_idthe caller leaves unset, andknowledge.reports.submitreads it as a run: the call answers 422 withevidence 'run:-' was not found. The example names the failed run. Filing through the Python SDK without a run is refused until the op or the SDK treats-as unset; this change does not touch either.Scope and risk
The example, its fixture's
expected.json, its guide, its entry in the examples README and its tests. No server, generated SDK or dashboard file changes.expected.json: thereportstage with itsrevisionandhandoff, nine checks, theproblem_to_correctionlink,ids.report_id, and the coverage entriesreportandrepeated_report.qualifiedstaysfalse: the four curation-pass entries are not exercised.knowledge.reports.submit,.getand.updatewith the fields the run sends, so a deployment without them endsunavailable(exit 4) before any write.loom.knowledge_reports: during a rolling upgrade the report ops answer 503, and a run that reaches thereportstage endsfailedthere.knowledge.reports.*op. The guide's mint commands and the tests mint tokens with the default namespace scope.Not in this change: the curation pass and the recurrence check.
Compatibility, rollout and rollback
knowledge.reports.submit,knowledge.reports.get,knowledge.reports.update.cleanup.Tests
Against a ClickHouse and a server started for this change, with fake providers and workers off:
pytest tests/integration/test_sdk_example_knowledge_factory.py -p no:randomly: 19 passed, 1 error at setup. The server thattest_returned_lists_labelled_reads_when_the_trace_log_is_onspawns refused to start because the local run set noLOOM_INSTANCE_LABEL, which CI sets; run alone with the label set, that test passed. The live result equalsexpected.json, with the trace log off and on.test_the_report_names_the_revision_read_and_the_revision_that_resolved_itreads the report as the reviewer and as the reporter (revision, evidence, reporter, assignee,resolved, version 3), finds one report about the definition in the queue, and checks that the curator reads no report and is refused the queue and an update with 403.test_a_resolution_names_a_revision_newer_than_the_reported_onepins both refusal messages and the limit above.pytest tests/unit/test_sdk_example_knowledge_factory.py tests/unit/test_knowledge_factory_example.py -n 2: 216 passed.test_the_report_names_the_revision_that_was_read,test_a_second_submit_returns_the_same_reportandtest_a_resolve_before_publication_is_refusedfailed before the stage existed. The scripted server refuses arun_idthat names no run, as the real one does. Each of the nine checks has a fault row that fails it.pytest tests/unit/test_session_content_senders.py tests/unit/test_public_copy.py tests/unit/test_doc_links.py tests/unit/test_help_docs.py tests/unit/test_agent_instructions.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 -n 2: 656 passed, 10 skipped. The session-content census names no file of this change.LOOM_ENV_FILE= pytest tests/analyzer -n 2: 10 passed, 2 skipped. No statement changes.ruff format --checkandruff checkon the changed files,make typecheck,scripts/gates/function_length_gate.py: clean.--checkofscripts.codegen.sdk_py_gen,.sdk_py_client_gen,.docs_referenceand.op_reach_census: no output moves.npx prettier@3.9.9 --checkon the guide, the README andexpected.json: clean.main, which changed no file of the example:pytest tests/unit/test_session_content_senders.py tests/unit/test_sdk_example_knowledge_factory.py tests/unit/test_knowledge_factory_example.py -n 2: 234 passed. The other commands ran on the tree before that merge.pytest tests/unit/test_sdk_example_knowledge_factory.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 -n 2: 816 passed, 10 skipped, 1 failed. The failure istest_degraded_unnoted.py, onserver/code/app/index/review_brief_build.py::_history_section::gather::1:mainfails it the same way, and this change edits no file the scan reads.LOOM_ENV_FILE= pytest tests/analyzer -n 2: 10 passed, 2 skipped.ruff check,make typecheckand the prettier check on the guide: clean.Left to CI: the full unit and integration suites.
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: the three ops' handlers, rules and wire models read before the example was written; each answer the example asserts was first read from a live server; the commands 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), 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