agent: retire eager KB priority/planner path and its dead flags

The pull-based KB design (on-demand search_knowledge_base tool + pre-injected
workspace tree) fully replaced the old eager retrieval path. Remove its last
remnants:

- Delete KnowledgePriorityMiddleware (knowledge_search.py) and its tests.
- Drop the kb_priority state field + reducer default; trim
  KbContextProjectionMiddleware to project only workspace_tree_text.
- Remove the now-dead feature flags enable_kb_priority_preinjection and
  enable_kb_planner_runnable across backend (flags, route schema, tests,
  env examples) and frontend (settings toggle, zod schema).
- Scrub <priority_documents> and stale KnowledgePriorityMiddleware references
  from prompts, docstrings, and the ADR.

No functional change: nothing wrote kb_priority and neither flag gated live
behavior after the cutover. Full backend suite green (pre-existing unrelated
failures aside).
This commit is contained in:
CREDO23 2026-06-25 18:37:14 +02:00
parent 0148647b98
commit 2beafbdec8
34 changed files with 62 additions and 1890 deletions

View file

@ -74,8 +74,9 @@ class ResolvedMentionSet:
``@Project``).
``mentioned_document_ids`` is an ordered, deduped list consumed by
the priority middleware downstream see
``KnowledgePriorityMiddleware._compute_priority_paths``.
the on-demand ``search_knowledge_base`` tool downstream (via
``referenced_document_ids``) to pin @-mentioned docs into the
retrieval scope.
"""
mentions: list[ResolvedMention] = field(default_factory=list)
@ -113,8 +114,8 @@ async def resolve_mentions(
* Legacy clients that haven't migrated to the unified chip list
still send the id arrays we treat the union as authoritative.
* The id arrays are the canonical input to
``KnowledgePriorityMiddleware`` (via ``SurfSenseContextSchema``);
* The id arrays are the canonical input to the retrieval scope
(via ``SurfSenseContextSchema`` ``referenced_document_ids``);
returning the deduped, validated lists lets the route forward
them unchanged.

View file

@ -4,7 +4,6 @@ This module is the single source of truth for mapping ``Document`` rows to
virtual paths under ``/documents/`` and back. It is used by:
* :class:`KnowledgeTreeMiddleware` (rendering the workspace tree)
* :class:`KnowledgePriorityMiddleware` (computing priority paths)
* :class:`KBPostgresBackend` (``als_info`` / ``aread`` / move operations)
* :class:`KnowledgeBasePersistenceMiddleware` (resolving moves and creates)