P1

Checkout 500s after rollout-flag removal

PD-8890 · storefront-checkout · 2026-08-09 14:32:07 UTC

Trace96386d1613d16dfc
Tokens46.0K → 8.9KCost$0.1354
Post-mortemReplay with the fix
34 spansDurationTokensCost

Causal Copilot

I analyzed trace 96386d1613d16dfc: storefront-checkout, 34 spans over 2m 30s, 54.9K tokens (~$0.1354).

Trace structure
  • 8 LLM calls, 9 tool calls, 12 failing spans
  • Entry point: checkout-assistant.run
  • First failure: tool.resolve_rollout_flag at services/checkout/flags.py:42
Why the tool failure detector fired

resolve_rollout_flag raised AttributeError on 34% of checkout traffic. The rollout guard references flags.checkout_v2_enabled, which no longer exists after commit b91f0ac4. Downstream POST /api/checkout returns 500.

Confidence 96% (judge: claude-haiku-5-5).

Root cause: 3 hops upstream

Commit b91f0ac4, written by the coding agent in session sess-code-4471, deleted checkout_v2_enabled from flags/registry.yaml while resolve_rollout() still reads flags.checkout_v2_enabled.rollout_pct at services/checkout/flags.py:42. The flag was live, gating the 34% v2 cohort; the session notes say the agent “skipped the rollout check to keep the diff small.” CI stayed green because the flag service is mocked in tests, so the missing attribute only surfaced in production.

Introduced in commit b91f0ac4 (services/checkout/flags.py:42).

Counterfactual: If resolve_rollout() had served v1, the legacy path, when the flag was missing, the v2 cohort would have checked out on v1 instead of getting 500s, and the gap would have shown up as flag.degraded on a span rather than as an incident.

The fix

resolve_rollout() dereferences flags.checkout_v2_enabled at services/checkout/flags.py:42, and b91f0ac4 deleted that flag from the registry, so every v2-cohort checkout raised AttributeError. Read the flag through a lookup that can come back empty, and when it does, serve v1 (the legacy path) and record flag.degraded=true and flag.reason=flag_absent on the span. The checkout agent was right not to improvise a variant mid-request; this makes the fallback a reviewed decision that records itself, so a missing flag pauses the experiment where everyone can see it instead of failing checkout.

→ PR #2213 (causal/fix-PD-8890), +6/−2, merged and shipped in storefront-2026.08.11.

TL;DR: Rollout guard references a feature flag deleted to keep a diff small. Fixing services/checkout/flags.py removes this failure class entirely.

Demo: scripted from this incident's datalive: claude-sonnet-5-5