Skip to content

0007 Log/trace correlation via runner id captured at answer time

Status

Accepted-stopgap

Context

AiAgentEntityWrapper hardcodes its own tag set (ai_agents, ai_agents_<id>, ai_agents_prompt_<id>, ai_agents_runner_<runnerId>) with no caller-supplied injection point, and AgentRequestEvent does not expose tags either. The module still needs to correlate a conversation turn with the ai_log entries that run produced.

Decision

AnswerService sets a known runner UUID before running the agent. captureIds() then queries for the newest ai_agents_runner_<id> ai_log entry once, and stores its log and trace ids on the conversation turn. FeedbackLogger reads only these stored ids — its old fallback of querying by conversation:/turn: tags was dead code and has been removed.

Consequences

  • A multi-round agent run (a turn that calls tools more than once) keeps only the last round's log reference, since the capture happens once per turn.
  • Tracked upstream at ai_agents issue 3586055 (caller-supplied tags). When that lands, per-conversation/turn tags can be restored instead of this single capture-at-answer-time approach.