#11174: Fix/fried chicken error
docs
agents
stale
Cluster:
Model Fallback and Error Handling
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adjusts the error-classification path for embedded Pi runs so that ambiguous auth-based provider rate-limit messages don’t get handled as “context overflow” ahead of failover detection. It adds an explicit guard in `src/agents/pi-embedded-runner/run.ts` and mirrors that guard in user-facing formatting/sanitization in `src/agents/pi-embedded-helpers/errors.ts`. The PR also adds internal documentation describing the “fried chicken” misclassification and suggested fallback configuration, and updates `.gitignore` to ignore a `dist.backup/` directory.
These changes fit into the existing failover architecture by ensuring `classifyFailoverReason()` is consulted before the context-overflow compaction/return path, allowing the existing `FailoverError`/model fallback machinery to execute for rate-limit/overload/auth/billing/timeouts rather than being short-circuited by the context overflow handler.
<h3>Confidence Score: 3/5</h3>
- This PR is mostly safe to merge, but the new guard can misroute some true context-overflow messages if they contain rate-limit tokens like "429".
- Core logic change is localized and consistent across runner + formatting helpers, but the guard relies on broad substring-based failover detection (notably matching "429" anywhere), which can suppress intended context overflow handling for certain error texts. Minor cleanup needed for unused variable in run.ts; docs heading style may affect published anchors.
- src/agents/pi-embedded-helpers/errors.ts; src/agents/pi-embedded-runner/run.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#12314: fix: treat HTTP 5xx server errors as failover-worthy
by hsssgdtc · 2026-02-09
81.8%
#10178: fix: trigger fallback when model resolution fails with unknown model
by Yida-Dev · 2026-02-06
79.2%
#13191: pi-embedded: enable failover when per-agent fallbacks are configured
by zesty-clawd · 2026-02-10
78.9%
#15815: Fallback LLM doesn't trigger if primary model is local
by shihanqu · 2026-02-13
78.6%
#7229: fix: add network error resilience to agentic loop failover
by ai-fanatic · 2026-02-02
77.6%
#8661: fix: display rate limit errors correctly instead of as context over...
by dbottme · 2026-02-04
77.6%
#11821: fix(auth): trigger failover on 401 status code from expired OAuth t...
by AnonO6 · 2026-02-08
77.4%
#8175: fix: suppress raw API errors for non-owners
by Rakshi2609 · 2026-02-03
77.0%
#16307: fix: surface billing/auth FailoverErrors as user-friendly messages
by petter-b · 2026-02-14
76.9%
#14368: fix: skip auth profile cooldown on format errors to prevent provide...
by koatora20 · 2026-02-12
76.7%