Skip to content

Errata retrieval always returns 0 — no indexing path from markdown files to DuckDB #547

@mickume

Description

@mickume

Summary

The errata system is write-only theater. Sessions create errata markdown files in docs/errata/ but fox_provider always reports 0 errata items because no code path exists to index those files into the DuckDB errata table. Subsequent sessions are completely blind to errata.

Root Cause

The system has two disconnected halves with no bridge:

Write side — errata files are created by two sources:

  1. Coder sessions write markdown files directly (e.g. 100_triage_archetype_absorption.md, 95_entity_graph.md — 11 files total). No code exists to index these into DuckDB.
  2. _generate_errata() in result_handler.py:334 auto-generates errata on reviewer blocking, calling both store_errata() (DB insert) and persist_erratum_markdown() (disk write). But this path only fires when reviewer blocking occurs (lines 254, 295, 331), and audit logs show zero errata.generated events across all runs — it has never actually triggered.

Read sidefox_provider._query_errata() (fox_provider.py:141) correctly queries the DuckDB errata table. The table exists (migration v19). But it is always empty.

Migration History

  • v17 (migrations.py:662): Created errata_index — a (spec_name, file_path) pointer table designed to link errata markdown to specs. No production code was ever written to populate it.
  • v18 (migrations.py:696): Dropped errata_index as "unused" (spec 116 knowledge pruning), correctly noting 0 rows.
  • v19 (migrations.py:719): Created a new errata table with content columns, populated exclusively by the reviewer-blocking path that never fires.

Evidence

  • 13 errata markdown files exist in docs/errata/ (11 manually created, 2 test artifacts)
  • 0 errata.generated audit events across all available audit logs
  • 0 rows in the errata table in every observed run
  • grep -rn "errata_index" --include="*.py" shows no production code ever populated the original pointer table
  • No code path reads docs/errata/*.md and inserts into DuckDB

Affected Code

File Role
agent_fox/knowledge/errata.py store_errata(), query_errata(), persist_erratum_markdown()
agent_fox/knowledge/fox_provider.py:141 _query_errata() — always returns []
agent_fox/engine/result_handler.py:334 _generate_errata() — never triggers in practice
agent_fox/knowledge/migrations.py:719 v19 table schema (correct, but empty)

Fix

Add an errata indexing step that reads docs/errata/*.md files and inserts structured records into the DuckDB errata table — analogous to how _migrate_legacy_reviews() in session/context.py reads legacy markdown and populates review findings. This should run at knowledge DB initialization or session startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    af:fixIssues ready to be implementedaf:fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions