Repository navigation
loom code describe-reset returns fake-provider chunk descriptions to structural context - #2373
chenxiaokeng666-prog wants to merge 9 commits into
Conversation
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
…o structural context Signed-off-by: krison <chenxiaokeng666@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
The reset can overwrite a newer chunk tombstone. The inline finding gives the write sequence to cover in a regression test.
| else build_context_text(path=path, scope=scope, content=str(r.get("content") or "")) | ||
| ) | ||
| vec = await embedder.embed(ctx) | ||
| row = CodeRepo.moved_of( |
There was a problem hiding this comment.
P1 — describe-reset --apply can make a removed chunk searchable again. If ingestion tombstones a chunk after the reset reads it and while the embedding call is in flight, moved_of gives the saved live row a version newer than the tombstone. FINAL then returns the reset row with tombstoned_at = NULL. Coordinate the reset write with ingestion so it cannot publish a stale row. Add a regression test that tombstones the selected chunk during embedding and verifies it stays absent.
Closes: #1557
Related: #1679
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):
loom code describe-resetreturns chunks whose description came from the fake LLM provider to structural context and re-embeds them; dry run by default,--applyresets.Why
With
llm.providerset tofake, ingest stored the fake client's echo text as chunk descriptions withcontext_source='llm', and there was no in-place way to clear them: a re-index keeps described rows unchanged, and the only route was removing the repository and re-adding it. The reset command gives operators the in-place recovery the issue asks for, following the maintainer's decision on #1557.Scope and risk
Touches the new
describe-resetCLI command, its parser, thewith_descriptionblank-line fix, unit tests, CLI snapshots, the CLI reference and one operations-table row. Deliberately left alone: part 1 of #1557 (the ingest skip and theloom code describerefusal, PR #1679), the provider-change case, and anycode.index_statusfield. No wire op is added or changed; this is a CLI command only. The reset is scoped to the served embedding model's label, so rows under other labels keep their fake descriptions. Serial per-row embed and insert, mirroring_describe; on a namespace with tens of thousands of fake rows this runs one embed call per row.context_text.pyis a chunk-stage extractor module, so this fix moves the chunk stamp: the worker re-heals the chunk stage in every indexed repository. The heal is cheap by design — content-addressed rows are kept, never re-embedded.Compatibility, rollout and rollback
loom code describe-reset --org <org> --namespace <ns>to preview the count and a sample, then add--applyto reset. A laterloom code describeon a real provider picks the reset rows up again.loom code describeon a real provider restores descriptions. No migration, no generated-file residue beyond the snapshots in this PR.Tests
pytest tests/unit/test_cli_apply_default.py tests/unit/test_context_text_with_description.py tests/unit/test_cli_surface_snapshot.py tests/unit/test_docs_reference.py tests/unit/test_public_copy.py tests/unit/test_doc_links.py— 343 passed.pytest tests/unit/test_cli_apply_default.py tests/unit/test_context_text_with_description.py— 20 passed, including the 3 new tests.ruff checkandruff format --checkon all changed Python files — pass.mypyon the 3 changed source files — no issues.scripts/codegen/docs_reference.py --check— pass.pytest tests/unit/test_code_extractor_stamp.py— 21 passed, 1 failed:test_only_the_stage_grammars_are_stampedfails because the tree-sitter packages are not installed in the local venv (grammar_versions()returns empty); pre-existing environmental failure, unrelated to this change.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Codex gpt-6.2-sol wrote the implementation and tests; I reviewed every line of the diff, ran the targeted tests, the negative control, ruff, format and mypy myself, and verified the fix against the maintainer's spec on Ingest stores the fake LLM's echo as chunk descriptions when
llm.providerisfake, and no op clears them #1557.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
--apply mutates live code-index embeddings in ClickHouse for matched chunks; scope is limited to fake-prefix LLM descriptions and one embedding model label, but a mistaken run still rewrites search vectors until reversed via
describeor re-index.Overview
Adds
loom code describe-resetso operators can undo chunk descriptions written by the fake LLM provider during dev indexing. The command finds livecode_chunksrows wherecontext_sourceisllmandcontext_descriptionstarts with[fake-synthesis:, scoped to the served embedding model; by default it dry-runs with counts and samples, and with--applyit strips the description, setscontext_sourcetostructural, rebuildscontext_text, re-embeds, and supersedes the rows (then triggers the usual post-bulk compact). A laterloom code describeon a real provider can describe those chunks again.with_descriptionnow drops the description line when the description is empty/whitespace instead of leaving a blank line—needed for clean structural context on reset.Docs and CLI reference tables document the command; unit tests cover dry-run vs apply gating and selective reset behavior.
Reviewed by Cursor Bugbot for commit 1c98550. Bugbot is set up for automated code reviews on this repo. Configure here.