[sweep] strip Fxxx audit-ID tokens + trim bloated comments/docstrings + add behavior-change docs

Post-audit sweep over the 135 audit-fix commits since 19a474d3:

1. Stripped every # Fxxx: audit-ID token from comments AND every Fxxx token
   from docstring openings across 211 blocks / ~626 lines. The CEO flagged
   these twice: audit-issue IDs in code confuse future devs/agents. The
   descriptive text is preserved; only the Fxxx token is removed (and bloated
   narrative blocks trimmed to 1-3 lines keeping the one non-obvious invariant).
2. Trimmed bloated comments/docstrings to the concise standard (1-3 lines).
3. Added missing behavior-change docs for the audit-fix batch: prompts/roles
   (documenter, pr_reviewer, qa), user-facing docs (api auth, websockets,
   agent-gateway, megatask, merge-model, task-lifecycle, grok, resilience,
   conventions, panel, security, troubleshooting), and the RAG corpus (cell-pm,
   main-pm, pr-reviewer, qa roles; conventions; messaging-tools; escalation;
   megatask; task-claiming workflows).

Comment/docstring/prose ONLY — zero code-line edits (verified: the diff
contains no def/class/return/if/for/await/assignment/call lines). Gates green:
ruff format + ruff check clean, mypy clean on roboco/. The only pytest failures
are the pre-existing sync_branch tracing-decision gap (B1, 250be5c2) — not
sweep-caused and tracked separately.
This commit is contained in:
Renn F
2026-06-29 01:25:40 +02:00
parent fb850e8235
commit 3441e37120
131 changed files with 842 additions and 1391 deletions
@@ -1,26 +1,7 @@
"""F054: the LEARNINGS index must not leak private (shareable=False) entries
through ANY shared retrieval path.
A private LEARNING journal entry is recorded into the LEARNINGS index with
``shareable=False`` (journal.py records it for completeness but it is never
meant to surface to other agents). The shared retrieval paths all reach the
plugin's retrieval with no ``include_private`` opt-in:
- ``OptimalService.search`` (used by the briefing / ``similar_memory``) calls
``search_with_embedding`` directly with no filters.
- ``search_learnings`` (shareable_only=True, the default) and the
``get_learnings_by_category`` / ``get_learnings_by_role`` /
``get_team_learnings`` cross-agent views call ``search`` with a filters dict
that does NOT carry a ``shareable`` key.
The base ``_citations_to_results`` only filters when a ``shareable`` filter is
present, so a ``shareable=False`` chunk sails through into another agent's
briefing — a private reflection leaked across the cross-agent corpus.
The fix: the LEARNINGS plugin forces ``shareable=True`` on retrieval unless the
caller explicitly opts into the private view via ``include_private=True`` (the
``search_learnings(shareable_only=False)`` audit/admin path). An empty filters
dict does NOT opt out — shareable is the safe default on every shared path.
"""The LEARNINGS index must not leak private (``shareable=False``) entries
through any shared retrieval path. The plugin forces ``shareable=True`` on
retrieval unless the caller opts into the private view via
``include_private=True``; an empty filters dict does NOT opt out.
"""
from __future__ import annotations
@@ -44,8 +44,8 @@ def test_build_source_uri_none_when_missing() -> None:
def test_delete_playbook_removes_its_chunks_by_source() -> None:
"""F011: deleting a playbook removes its embedded chunks from the vector
store by the playbook's source URI (idempotent — no-op if absent). A
"""Deleting a playbook removes its embedded chunks from the vector store
by the playbook's source URI (idempotent — no-op if absent). A
rejected/archived playbook must not stay retrievable in the PLAYBOOKS index."""
plugin = PlaybooksIndexPlugin.__new__(PlaybooksIndexPlugin)
store = MagicMock()
@@ -1,16 +1,7 @@
"""F108 — ``VectorStore.replace_chunks`` must be a single atomic transaction.
The replace-on-reingest path used to be ``delete_by_source`` (one pool
connection) followed by ``add_chunks`` (a *second* pool connection). Two
concurrent re-indexes of the same source interleaved across those two
connections and produced duplicate chunk rows; an add failure after a
successful delete also lost the source's index rows. The fix is a single
``replace_chunks(source, chunks)`` that deletes + inserts on ONE connection
inside ONE asyncpg transaction, so the whole replace is atomic.
These tests mock the asyncpg pool/connection to assert the atomicity
invariant (single acquire, transaction entered, delete + insert on the
same connection) without standing up a pgvector DB.
"""``VectorStore.replace_chunks`` is a single atomic transaction: delete +
insert on ONE connection inside ONE asyncpg transaction, so concurrent
re-indexes can't interleave and an insert failure can't lose the source's
rows. These tests mock the asyncpg pool to assert that invariant.
"""
from __future__ import annotations