Skip to content

restore() gains retry argument for non-interactive recovery#2307

Merged
kevinushey merged 2 commits into
mainfrom
feature/restore-retry
Jun 8, 2026
Merged

restore() gains retry argument for non-interactive recovery#2307
kevinushey merged 2 commits into
mainfrom
feature/restore-retry

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Adds a retry argument to renv::restore(), addressing the non-interactive gap in #1893.

The retry-with-latest recovery added in #1893 (renv 1.2.1) was interactive-only: renv_restore_recover() calls ask(), which returns the default (FALSE) in non-interactive sessions, so the retry was silently skipped in CI, pre-commit, Rscript, etc. This was flagged by @froggleston.

Behavior

retry is tri-state, so the existing interactive prompt is preserved:

  • retry = NULL (default) -- prompt if interactive, leave failures unresolved otherwise (unchanged).
  • retry = TRUE -- retry failed packages with their latest available versions without prompting (the CI case).
  • retry = FALSE -- skip recovery entirely.

When retrying without a prompt, renv prints a short "Retrying with the latest available versions of: ..." line. The detailed per-package failure summary is already emitted by renv_graph_install_errors() beforehand.

Notes

  • This applies to the graph installer path only; the pak-delegated restore returns early and never had this recovery, so retry is a no-op there (matches the pre-existing limitation).
  • It retries with latest-available versions, not a minimal incremental version bump. The latter is a larger feature, best handled separately.

Testing

devtools::test(filter = "restore") -> FAIL 0, PASS 93. Added a test asserting retry = FALSE skips recovery and retry = TRUE installs the latest version.

@kevinushey kevinushey merged commit a7de292 into main Jun 8, 2026
11 checks passed
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