Skip to content

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

Description

@peterschmidt85

Steps to reproduce

  1. Make the agent process die at startup without submitting a report, in a way that still prints one assistant line. For example, with subscription auth supplied only by user-scope settings while the native OAuth session is expired: dstack spawns claude with --setting-sources project,local (agent.py:356-357), which excludes the user scope, so the agent starts and dies immediately.
  2. Start any preset creation: dstack apply -f preset.dstack.yml -y.

Actual behaviour

Agent process exited without a report; resuming in 30s.

repeats every 30 seconds, indefinitely, before any instance is provisioned. Never 60s or 120s: agent.py:551-552 sets made_progress on any assistant line without inspecting its content, and agent.py:238-239 resets the retry budget (agent.py:52) before the pop at agent.py:246, so the budget never drains and the while True at agent.py:216 has no attempt cap. The agent's own error is captured at agent.py:555-556 but the loop message omits it, so the cause is only visible in .agent-stdout.jsonl. A report-less death that prints no assistant line does bound correctly and exits after 30/60/120s.

Expected behaviour

The creation fails immediately, printing the agent's error:

Failed to authenticate: OAuth session expired and could not be refreshed

Retries stay only for a transient death after real progress, bounded, printing the error each attempt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions