Skip to content

discovery(knowledge): KBSynthesizer.synthesize_docs never logs to SynthesisProvenanceLog — /knowledge/synthesis/log always empty #4656

@mrveiss

Description

@mrveiss

Discovery

SynthesisProvenanceLog was added in #4567 and exposed via GET /knowledge/synthesis/log. The autoresearch KnowledgeSynthesizer correctly calls log_run() after each synthesis:

# knowledge_synthesizer.py:306
await self._provenance_log.log_run(...)

But KBSynthesizer (the KB-side synthesizer, added in #4564) never calls log_run(). Its _synthesize_cluster() stores the result in ChromaDB but writes nothing to the provenance Redis stream kb:synthesis:log.

As a result, GET /knowledge/synthesis/log returns an empty list for all KB synthesis runs, even when synthesis succeeds.

Files

  • autobot-backend/services/knowledge/kb_synthesizer.py_synthesize_cluster() (lines ~199–253): no log_run call
  • autobot-backend/services/knowledge/synthesis_provenance.pySynthesisProvenanceLog.log_run()
  • autobot-backend/api/knowledge_maintenance.py:1915_provenance_log singleton

Fix

After _index_documents([page], ...) succeeds in _synthesize_cluster, call:

from services.knowledge.synthesis_provenance import SynthesisProvenanceLog
await SynthesisProvenanceLog().log_run(
    collection=target_collection or self.COLLECTION_NAME,
    doc_count=len(file_paths),
    source_paths=file_paths[:_MAX_DOCS_PER_CLUSTER],
)

Or inject a SynthesisProvenanceLog instance at __init__ (same pattern as KnowledgeSynthesizer).

Acceptance Criteria

  • After KBSynthesizer.synthesize_docs() succeeds, a log entry appears in kb:synthesis:log
  • GET /knowledge/synthesis/log returns KB synthesis runs
  • Test: mock SynthesisProvenanceLog.log_run and assert it is called after a successful synthesis

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions