Repository navigation
Commit 95ff466
fix(obs): hand an agent's own loggers to the logs pipeline, not just agentex's
The hand-over added in #518 had two halves, and only one of them covered an
agent's own modules. The latch in `make_logger` never looked at the logger's
name, so anything created after init was fine. The sweep matched the `agentex`
prefix, so a logger created BEFORE init under any other name kept its handler
and went on printing a second, ungoverned copy of every record.
That is not a corner case: agents call `make_logger(__name__)` from their own
modules, and `project.acp` -- the module that builds the ACP server, in every
scaffold -- logs at import, which is necessarily before `init_sgp_obs` runs.
Measured on dbt-assistant running 0.27.0b1: 123 of 3361 log lines were the
second copy, each 80 microseconds after its governed twin, carrying
`name`/`request_id` but no `trace_id`, `span_id`, `source` or `agent_id`.
Since it is emitted before the pipeline's filters, it also escapes the
allowlist and the truncation.
The SDK cannot know an agent's package name, so `make_logger` now marks each
handler it attaches and the sweep takes back exactly those, on a logger of any
name. Prefix matching stays for `agentex.*` itself, where every handler is ours
by definition. A handler this module did not attach is still left alone --
litellm's three loggers and anything else keep what their owner set up, which
is why sgp-obs warns about them rather than stripping them.
Renamed `route_agentex_loggers_to_root` to `route_loggers_to_root`, since
"agentex loggers" is what the bug was.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 5271bb9 commit 95ff466
4 files changed
Lines changed: 156 additions & 57 deletions
File tree
- src/agentex/lib
- core/observability
- tests
- utils
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
178 | 182 | | |
179 | 183 | | |
180 | | - | |
| 184 | + | |
181 | 185 | | |
182 | | - | |
| 186 | + | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | | - | |
191 | | - | |
192 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
35 | 50 | | |
36 | 51 | | |
37 | 52 | | |
| |||
81 | 96 | | |
82 | 97 | | |
83 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
84 | 110 | | |
85 | 111 | | |
86 | 112 | | |
| |||
102 | 128 | | |
103 | 129 | | |
104 | 130 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
110 | 139 | | |
111 | | - | |
112 | 140 | | |
113 | 141 | | |
114 | 142 | | |
| |||
119 | 147 | | |
120 | 148 | | |
121 | 149 | | |
122 | | - | |
| 150 | + | |
123 | 151 | | |
124 | 152 | | |
125 | 153 | | |
126 | 154 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
130 | 158 | | |
131 | 159 | | |
132 | 160 | | |
133 | 161 | | |
134 | | - | |
135 | | - | |
136 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
137 | 166 | | |
138 | 167 | | |
139 | 168 | | |
| |||
144 | 173 | | |
145 | 174 | | |
146 | 175 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
150 | 187 | | |
151 | 188 | | |
152 | 189 | | |
| |||
157 | 194 | | |
158 | 195 | | |
159 | 196 | | |
160 | | - | |
161 | | - | |
162 | 197 | | |
163 | 198 | | |
164 | 199 | | |
165 | 200 | | |
166 | 201 | | |
167 | 202 | | |
168 | 203 | | |
| 204 | + | |
| 205 | + | |
169 | 206 | | |
| 207 | + | |
| 208 | + | |
170 | 209 | | |
171 | 210 | | |
172 | 211 | | |
173 | 212 | | |
174 | 213 | | |
175 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
176 | 217 | | |
177 | 218 | | |
178 | 219 | | |
| |||
0 commit comments