Repository navigation
Commit 22a7286
committed
fix(plugin): make a Laminar trace red iff the turn failed
Two defects made trace status uninformative for v4 runs.
A tool that throws is normal agent flow - the model reads the `tool-error`
result and adapts - but the AI SDK stamps ERROR on the `ai.toolCall` span and
Laminar reds a whole trace if any of its spans is ERROR. One buggy
`browser_execute` snippet therefore reported the entire run as a failure:
1,058 errored `browser_execute` spans in two days on prod. Demote those spans
to UNSET, keeping the message on `bcode.tool.error` and the `exception` event
intact.
Conversely nothing ever marked a genuinely failed turn. The AI SDK ends
`ai.streamText` / `ai.streamText.doStream` inside a transform `flush` that
never runs when the consumer aborts, so a provider error arriving mid-stream
drops those spans instead of marking them - the trace showed a clean, shorter
run. Mark the turn span ERROR on `session.error`, which `SessionProcessor.halt`
publishes just before the session goes idle. Aborts are excluded: stopping a
run is not a failure.1 parent 4db4b32 commit 22a7286
2 files changed
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
111 | 133 | | |
112 | 134 | | |
113 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
156 | 172 | | |
157 | 173 | | |
158 | 174 | | |
| |||
0 commit comments