fix(compile): drop archived pages from taken topics and the collision gate - #708
Conversation
… gate `build_prompt` listed every on-disk page under TAKEN TOPICS and `compile_kb` seeded `taken_names` from the same unfiltered list, so an archived page stayed "taken" forever. archiving is how an operator retires a bad compile page, and it was one-way: the llm was told not to redraft a topic the wiki no longer carries, and a draft that reused the title was dropped as a duplicate of a page nobody can read. the only way back was hand-editing storage. claims already get this treatment through `_RETRACTED_CLAIM_STATUSES`; pages did not. one `_live_pages` helper at both call sites, filtering the same live set recall, digest, search and the wiki view already use. pending page proposals stay in the taken set — those are drafts awaiting review, not retirements.
|
of the five archived-page PRs this is the only one that extracts a helper rather than inlining the check, and catching both halves is what makes this a real fix rather than a partial one. patching only keeping pending page proposals in the cross-cutting note for this cluster belongs here more than anywhere, because nothing blocking in the diff itself. |
closes #700
what
build_promptlisted every on-disk page underTAKEN TOPICS … do NOT redraft any of these, andcompile_kbseededtaken_namesfrom the same unfilteredstore.list_pages(). An archived page stayed taken forever.Both halves matter, and together they make archive one-way:
subject silently drops out of the compiled wiki
nobody can read
The only way back was hand-editing storage — which is exactly what archiving a
bad compile page is supposed to avoid.
the fix
One
_live_pages(store)helper, used at both call sites, filteringPageStatus.ARCHIVED. That is the same live setrecall,digest,context,synthesize,triageandvault_syncalready apply, and the sametreatment claims already get here through
_RETRACTED_CLAIM_STATUSES— theinconsistency the issue points at is pages having been left out of it.
Pending page proposals stay in the taken set: those are drafts awaiting
review, not retirements, and redrafting over one still produces the
duplicate-proposal crash #439 fixed.
tests
Four in
tests/test_compile.py, covering both halves and both directions:TAKEN TOPICS(the issue's repro)Full gate green locally:
pytest tests/ --ignore=tests/embeddings,mypy src,ruff check src tests, plusdiff-cover --fail-under 100on the changed lines.