Skip to content

Agent Swarm handoff routing can be lost after metadata outage #230

@nicko-ai

Description

@nicko-ai

Summary

Run-mode Agent Swarm sessions can lose an explicit handoff recipient when metadata refresh is unavailable. The UI may still show the handed-off agent, but the next request can omit recipient_agent and route through the default coordinator instead.

Why metadata refresh affects routing:

  • Before sending a run-mode request, the CLI refreshes Agency metadata to validate recipient candidates.
  • The old failure path returned no recipient override when that refresh failed.
  • The request adapter only sends recipient_agent when recipient resolution returns a value.
  • In the captured session, logs showed metadata refresh timing out while the candidate recipient was Slides Agent; the local session DB still had that prompt marked for Slides Agent; and stored Agency history then showed the coordinator calling send_message to Slides.

That evidence supports the narrow cause: metadata refresh failure dropped the recipient override. It does not require claiming reconnect alone caused the routing change.

The same session shape can also make manual compaction fail because flat Agency metadata is replayed as AI SDK provider options.

Expected behavior

  • An explicit current-turn handoff recipient is preserved when metadata refresh is unavailable.
  • Compaction should ignore non-provider Agency metadata while preserving provider-keyed metadata.

Verification target

Add focused unit coverage and Agent Swarm TUI E2E coverage for the metadata-outage handoff path and compaction metadata conversion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions