PD-7712 · stock-tool-agent · 2026-08-07 11:12:03 UTC
Error
KeyError: 'change' File "agents/stock/format.py", line 27, in format_quote delta = q["change"] quotes-api v3 renamed 'change' -> 'pct_change'; the hard index has no default, so every quote raises here.
kind=function: your own function and a third-party tool result produce the same span shape. Nothing here justifies a label.
I analyzed trace aab13de33b9dbd4b: stock-tool-agent, 29 spans over 55.2s, 16.8K tokens (~$0.0441).
stock-agent.runformat_quote at agents/stock/format.py:27format_quote reads q['change'] by direct index. quotes-api v3 renamed the field to pct_change, so the first quote raised KeyError and aborted the run after 1 of 4 symbols.
Confidence 94% (judge: claude-haiku-5-5).
3f9a1c05 added format_quote(), which reads q['change'] by hard index at agents/stock/format.py:27. quotes-api v3 removed change on 2026-07-29 (pct_change replaced it, and the absolute delta is no longer returned), so the first v3 payload raised KeyError and aborted the run. The formatter's tests use a v2-shaped fixture, so CI stayed green. digest.py:112 and alerts/gap.py:44 share the same hard index.
Introduced in commit 3f9a1c05 (agents/stock/format.py:27).
Counterfactual: If format_quote had read v3's pct_change and rendered a missing value as n/a, the digest would have posted with explicit gaps instead of the run crashing on its first symbol.
The fixquotes-api v3 dropped change for pct_change, and three call sites hard-index the old key: format.py:27, digest.py:112 and alerts/gap.py:44. Read pct_change at all three and render a missing or null field as n/a. Nothing is synthesized: previous_close is null before the session opens, so a derived delta would publish numbers the provider never sent, which is what the no_silent_defaults guardrail rejects.
→ PR #2044 (causal/fix-PD-7712), +15/−6, merged and shipped in market-2026.08.08.
TL;DR: Direct dict index on a provider field that was renamed. Fixing agents/stock/format.py removes this failure class entirely.