Skip to content

Plan mode marks run as completed on auth error, wiping progress on retry #288

@denysshnurenko

Description

@denysshnurenko

Summary

When ralphex plan mode hits an authorization error mid-run, it writes a terminal Completed... line to the progress file and exits. Restarting the same prompt
then treats the run as already finished and overwrites the progress file from scratch, losing all accumulated progress.

Steps to reproduce

  1. Start ralphex plan mode with a non-trivial prompt.
  2. Let it run until an authorization error occurs (e.g. token expiry / 401 from the model provider).
  3. Observe that the progress file now ends with a Completed... line, even though the run did not actually finish.
  4. Restart ralphex with the same prompt.
  5. Observe that the progress file is reset to empty — prior iterations are gone.

Expected behavior

An authorization error should be treated as a recoverable failure, not a successful completion. On restart with the same prompt, ralphex should resume from
the last real iteration, preserving progress.

Actual behavior

  • Auth errors are recorded as Completed..., indistinguishable from a real successful finish.
  • Restart wipes the progress file and starts over from zero.

Workaround

Before restarting, manually remove the trailing Completed... line from the progress file:

  Iteration 4: ...
  Iteration 5: ...
- Completed...

ralphex then correctly resumes and appends new iterations instead of rewriting the file.

Suggested fix

  • Don't emit Completed... on error exits. Use a distinct terminal marker (e.g. Failed: <reason>) or no terminal marker at all, so restart logic can detect an
    incomplete run.
  • On restart, detect failure / incomplete states and resume rather than overwrite.
  • Optionally, retry transient auth errors with backoff before giving up.

Impact

Any long-running plan that encounters a transient auth error loses all prior work unless the user knows the file-surgery workaround.

Screenshot

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions