pi: auto-retry stalled requests
β’ 208 words β’ 1 min β’ updated
Problem statement: sometimes a prompt in pi
just hangs, as if the network dropped. It never recovers on its own β I have to
hit Esc and re-prompt.
It’s 2026, this symptom should be self-recoverable.
Pi already has agent-level retry on transient errors (retry.enabled defaults
to true). The catch is when it fires: a stalled connection isn’t an error
until the HTTP idle timeout trips, and that defaults to five minutes:
httpIdleTimeoutMs| number |300000| HTTP header/body idle timeout in milliseconds […] Set to0to disable.
So pi would have eventually recovered. I was just quitting long before the five-minute clock ran out. Who has patience to wait for 5 minutes?!
:β΄ Lower the idle timeout to O(seconds) instead:
{
"httpIdleTimeoutMs": 30000,
"retry": {
"enabled": true,
"maxRetries": 5,
"baseDelayMs": 2000
}
}Dropped into ~/.pi/agent/settings.json, documented in
docs/settings.md.
Now a stall errors out after 30s and pi retries automatically with exponential
backoff (2s, 4s, 8sβ¦), up to five attempts. There’s no need for Esc nor
re-prompting.
The idle timer resets on every byte received, so long thinking or a slow stream
won’t trip it β only a genuinely dead connection will. Restart pi for the
change to take effect.
π€ Drafted with /bloggify.
Backlinks
- pi: /btw side-chat (Jul 22, 2026)