Repository navigation
fix(agent-sdk): retry environment clones once after git auth failures - #16563
Open
warp-agent-staging[bot] wants to merge 4 commits into
Open
warp-agent-staging[bot] wants to merge 4 commits into
warp-agent-staging[bot] wants to merge 4 commits into
Conversation
Contributor
Author
|
This PR was generated with Warp. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Retry environment repository clones once when Git reports an authentication rejection, so a transient 401 does not fail the run immediately. Refresh credentials once, wait three seconds, and send only auth-failed requests through a second helper pass. Keep successful checkouts and their resolved HEADs, including successes in the initially failed batch.
Do not retry missing repositories, 403/404 responses, ref checkout or HEAD verification failures, origin-removal failures, or unclassified errors. A refresh failure still permits the one retry with existing credentials. Local runs skip refresh when no task ID or workload token exists. Persistent authentication failures name the repositories and explain the exhausted retry; identity diagnostics remain attached.
A failed new clone can leave an empty directory that looks like an existing checkout. Remove only that empty directory after a clone failure, never an existing checkout or nonempty target. Do not retry when target cleanup fails. Global-skill clones keep their existing one-pass behavior.
Prerequisite: #16559 is merged and included in this branch. This PR reuses its read-only managed helper and the existing credential refresh; it does not duplicate the credential-helper change. The initial 401 cause and agent-initiated clones remain out of scope.
Linked Issue
REMOTE-3497 — covers the conservative environment-clone recovery, not the separate credential-cascade fix.
ready-to-specorready-to-implement. — Scope and test requirements were explicitly supplied; aggregate issue status is shared.Testing
cargo nextest run -p warp --lib --no-fail-fast -E 'test(environment::tests::) | test(environment_checkout::tests::) | test(git_credentials::tests::)'— all 137 selected Linux tests.cargo clippy -p warp --all-targets --tests -- -D warnings../script/formatandgit diff --check.Coverage includes rejection classification, auth-only retry selection, refresh/attempt budgets, merging resolved HEADs, refresh failure, persistent authentication errors, and missing retry reports. Mixed-forge failures retain identity diagnostics for non-retried repositories. A real-Git fixture proves partial-batch HEAD capture, retry into the same target, and preservation of another checkout's local changes/configuration. Delay and refresh are injected; tests do not sleep or contact the credential server. Live GitLab token propagation was not exercised; cross-platform compilation/tests require marking this draft ready for review. The workflow intentionally skips its jobs on drafts; its aggregate check then fails because parameters were skipped, not because a test ran and failed.
./script/run— No rendered UI changes; exercised the helper with real Git and the retry orchestration through fixtures.Agent Mode
CHANGELOG-OZ: Cloud-agent environment clones retry once after Git authentication failures instead of failing immediately.