Skip to content

fix(pi): Stop skill runs after 10 minutes - #584

Open
s1gr1d wants to merge 6 commits into
mainfrom
s1gr1d/fix/pi-skill-request-deadline
Open

s1gr1d wants to merge 6 commits into
mainfrom
s1gr1d/fix/pi-skill-request-deadline

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Some Pi skill runs take 45+ minutes, and one such run stalls the whole Warden run. This sets the existing Pi run timeout to 10 minutes for skill runs, so the hunk fails without a retry. Over 30 days, p99 was 2.5 minutes, and 92% of the runs that passed 10 minutes also passed 20 minutes.

Long requests in Sentry: OpenRouter requests over 20 min, last 30 days

Some OpenRouter streams stay open for 45+ minutes. The provider timeout
stops at the response headers, and Pi's idle timeout resets on every
streamed byte, so one hung request can stall a whole Warden run.

Bound each skill model request to 180s and end it with a retryable
error, so Pi resubmits the turn (2 retries). Retried turns no longer
count toward maxTurns or skew the telemetry transcript.
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
warden-prod Ready Ready Preview Nov 27, 2026 2:55pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – warden-prod November 26, 2026 09:57 Inactive
@s1gr1d s1gr1d changed the title fix(pi): Retry skill model requests that exceed a deadline fix(pi): Retry skill model requests that exceed a timeout Nov 26, 2026

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The wall-clock deadline goes after the actual gap: the provider timeout stops at headers and Pi's idle timeout keeps resetting while a stream trickles. Ending the turn with a "timed out" error lands cleanly on Pi's isRetryableAssistantError path.

I traced the retry bookkeeping against pi-agent-core/pi-coding-agent 0.86.1. An error turn emits turn_end and then agent_end, and only after that does _prepareRetry emit auto_retry_start and drop the failed message from agent state. So discardRetriedTurn popping exactly one transcript entry and decrementing numTurns lines up with what Pi resubmits. Since the failed turn has stopReason: 'error', it can't trip the maxTurns abort before the decrement. Relying on EventStream.push ignoring events after a terminal one is also safe, so the trailing relay.fail in pipeTurn and the late abort event from the source are both no-ops.

s1gr1d added a commit to getsentry/sentry-javascript that referenced this pull request Nov 26, 2026
Sets `[runner] concurrency = 12` in the repo `warden.toml`.

Warden sends the diff chunks of every skill (org and repo) through one
shared queue. Without this setting, the queue size is the action default
of 5. On large PRs, this makes Warden review the diff in many waves, one
after the other. A larger queue lets more chunks run in parallel.

The org config in
[getsentry/.github](https://github.com/getsentry/.github/blob/main/warden.toml)
does not set `[runner] concurrency` today, so this repo value applies.
If the org config sets it later, the org value wins.

12 is a starting value, we can still tweak it.

This does not fix the longest Warden runs (45+ minutes). Those come from
single model requests that hang, is fixed in Warden:
getsentry/warden#584
A 3 minute limit also stops slow requests that finish on their own. Over
30 days, about 250 OpenRouter requests ended between 3 and 10 minutes.
Of the 970 requests that ran past 10 minutes, 93% ran past 20 minutes.
Skill runs now use the timeout that runPiPrompt already supports, set to
10 minutes. A run that passes the limit fails its hunk and is not
retried. This removes the stream wrapper and the Pi retry bookkeeping.
@vercel
vercel Bot temporarily deployed to Preview – warden-prod November 27, 2026 14:52 Inactive
@s1gr1d s1gr1d changed the title fix(pi): Retry skill model requests that exceed a timeout fix(pi): Stop skill runs after 10 minutes Nov 27, 2026

This branch was successfully deployed

2 active deployments
Preview – warden-prod — 37531f07 Deployed Nov 27, 2026 by vercel[bot]
Preview – warden — 37531f07 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant