Skip to content

bug(company-os): heartbeat RAG queries an agent:<id> KB collection that no code path creates, so the agent scope is always empty #19579

Open

Description

@mrveiss

Found while fixing #19519.

LLCRAGAssembler.assemble() (autobot-backend/llc/kb/rag_assembler.py, _collections_for) queries an agent-scoped collection, now named by agent_collection(agent_id) = agent:<id> (the KbCollectionManager.AGENT_PREFIX format). No code path creates or writes that collection: KbCollectionManager.ensure_collection is never called with AGENT_PREFIX, and agent capability documents go to company:<company_id>:agents (llc/kb/capability_indexer.py). So the agent leg of every heartbeat query returns nothing.

Evidence (grep on the #19519 branch): grep -rn "AGENT_PREFIX\|agent_collection" autobot-backend/llc --include=*.py | grep -v /tests/ returns only the definition in llc/kb/collections.py and the reader in rag_assembler.py.

Decision needed: either write agent knowledge (diary, wiki) to agent:<id>, or point the agent leg at the collection that does hold agent knowledge. Under #19512 this naming is replaced by buckets in the main store, which may make the first option moot.

  • The agent leg of the heartbeat query reads a collection some code path writes; tested create-then-query.

Part of #19512.

Activity

  1. mrveiss commented on Oct 25, 2026

    @mrveiss
    OwnerAuthor

    Owner decision, 2026-10-25: agent and role knowledge goes into the #19512 buckets design: the heartbeat will read the agent's role/agent bucket once #19513 and its siblings land. No interim per-agent collection is built. Meanwhile the heartbeat should stop querying the never-created agent:<id> collection, so that leg isn't a silent no-op; it can ride with the next #19512-tree PR. Parent stays #19512.

  2. changed the title [-]bug(llc): heartbeat RAG queries an agent:<id> KB collection that no code path creates, so the agent scope is always empty[/-] [+]bug(company-os): heartbeat RAG queries an agent:<id> KB collection that no code path creates, so the agent scope is always empty[/+] on Oct 30, 2026
  3. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Decision needed: what should the agent leg of the heartbeat query read?

    Nothing writes agent:<id>, so that leg always returns nothing. Capability documents go to company:<id>:agents, and the diary and wiki aren't in any collection this query reads.

    Option Effect Cost
    A. Remove the agent leg until #19512's buckets land No query for an empty collection; the code says what's true Agents get no personal knowledge in heartbeats until then
    B. Write the diary and wiki to agent:<id> Agents get their own knowledge now Builds an indexing path that #19512 then replaces
    C. Point the leg at company:<id>:agents Finds real documents They describe every agent's capabilities, so this is about colleagues, not the agent's own knowledge

    Recommendation: A, with the agent's own knowledge delivered through #19512. It avoids building something due to be replaced.

  4. added
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    and removed
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    on Nov 1, 2026
  5. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Landed on main in 58cbf98 (PR #20613). _collections_for in llc/kb/rag_assembler.py no longer has an agent leg, per the maintainer's choice of option A, and test_assemble_never_queries_the_unwritten_agent_collection_19579 pins it.

    AC Evidence
    The agent leg reads a collection some code path writes; tested create-then-query Not met as written: there is no agent leg now, so nothing was tested create-then-query.

    The criterion describes the option that wasn't chosen, so I've left it unticked and the issue open. It needs rewording to match option A, or closing by a maintainer. Not checked on a live host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions