Skip to content

fix(agent-sdk): retry environment clones once after git auth failures - #16563

Open
warp-agent-staging[bot] wants to merge 4 commits into
masterfrom
factory/retry-environment-clone-auth
Open

warp-agent-staging[bot] wants to merge 4 commits into
masterfrom
factory/retry-environment-clone-auth

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • The linked issue is labeled ready-to-spec or ready-to-implement. — Scope and test requirements were explicitly supplied; aggregate issue status is shared.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). — Not applicable to non-rendered checkout/credential logic.

Testing

  • Passed: 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.
  • Passed: cargo clippy -p warp --all-targets --tests -- -D warnings.
  • Passed: ./script/format and git 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.

  • I have manually tested my changes locally with ./script/run — No rendered UI changes; exercised the helper with real Git and the retry orchestration through fixtures.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-OZ: Cloud-agent environment clones retry once after Git authentication failures instead of failing immediately.

@warp-agent-staging warp-agent-staging Bot added the factory:eng-factory-slim Label associated to the "eng-factory-slim" factory label Oct 20, 2026
@cla-bot cla-bot Bot added the cla-signed label Oct 20, 2026
@warp-agent-staging

Copy link
Copy Markdown
Contributor Author

This PR was generated with Warp.

Comment @warp-staging-factory on this PR to send it follow-up work.

View run View conversation

@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review October 20, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed factory:eng-factory-slim Label associated to the "eng-factory-slim" factory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants