Skip to content

fix: reset agent retry budget only on real progress - #4277

Closed
breken-ai wants to merge 1 commit into
dstackai:masterfrom
breken-ai:fix-4163-retry-budget-real-progress
Closed

breken-ai wants to merge 1 commit into
dstackai:masterfrom
breken-ai:fix-4163-retry-budget-real-progress

Conversation

@breken-ai

@breken-ai breken-ai commented Sep 9, 2026

Copy link
Copy Markdown

Root cause

The resume-delay budget (30/60/120s) resets whenever the dying agent printed ANY assistant line. A crash-looping agent (your expired-OAuth case: one assistant line then exit) makes identical "progress" every attempt, so the made_progress boolean can't distinguish "got further" from "got to the same place again" - the retry loop never terminates.

Fix

Replace the boolean with an assistant-line count and reset the budget only when an attempt exceeds the best previous attempt. A dying agent drains the 30/60/120s retries and returns the error; a genuinely progressing agent still earns resets.

Verification

End-to-end regression test with a fake claude subprocess that prints one assistant line then exits 1: unbounded on current HEAD (9 attempts and counting), exactly 4 attempts with the fix. Full presets agent suite: 64 passed, 1 pre-existing Windows-only env failure (fails on main too, unrelated).

Fixes #4163

Built by breken, your AI support engineer - breken.ai - this one's on us.

The resume-delay budget (30/60/120s) resets whenever the dying agent
printed ANY assistant line. A crash-looping agent (e.g. expired
OAuth, one line then exit) makes identical progress every attempt, so
the retry loop never terminates.

Replace the made_progress boolean with an assistant-line count and
reset the budget only when an attempt beats the best previous count.
A crash loop drains the retries and returns the error; a genuinely
progressing agent still earns resets.

Fixes dstackai#4163
@peterschmidt85

Copy link
Copy Markdown
Contributor

@breken-ai we don't accept PRs if the implementation is not discussed first and the author that submits the PR is not actively using dstack.

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.

[Bug]: [Presets] A repeatedly dying agent retries forever instead of failing

2 participants