fix(agent-sessions): Mastra scorer runs are not agent sessions - #1140
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Sep 30, 2026 in 9m 33s
Confidence 4/5 · No issues found
🟢 Confidence 4/5 · likely safe to merge
The ingest tool-call/stamp changes and the session-rule HAVING are shared by ingest, the list, the facets and the Tools tile; the added e2e that proves the SQL was not run against ClickHouse.
quality 100/100 · no findings · tests partial · risk medium
Drops Mastra scorer runs at ingest and narrows the "tool" span-name needle to spans that name no operation, plus a per-trace session rule (model call, tool call, named agent or session id) applied to the list, facets, distributions and the Tools tile. The three parts agree with each other on the rows I checked, so this is safe to merge.
- Scorer spans (mastra.span.type scorer_* or mastra.metadata.targetTraceId) return None from run_predicates, before the vendor lookup
- facts::is_tool_call and usage::named_like_a_model_call apply the name needle only when the operation is empty
- isSessionTraceCond added to indexTraces, the facets and ai-tools' traceFacts
- classifyAiSpan reads "tool" off the name only when no operation is named
What was checked
- Ingest now agrees with the detail page: both skip the name needle when an operation is named (facts.rs:399-403, session-turns.ts:93), and a non-empty unknown op with a "tool" name is neither a tool no…
- ai-tools' tool population filters
IsToolCall = 1and the new traceFacts HAVING keeps every trace withIsToolCall = 1, so the inner join cannot lose a tool call (ai-tools.ts:213-258, 315) - Scorer early return precedes the vendor match in run_predicates and the flag is set in absorb_key before any vendor scope check, so the cross-instrumented judge case the earlier comment raised is cove…
9773e7b · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading