Skip to content

fix(api): stop resending projects create on dropped connections (CLI-2471) - #6704

Merged
7ttp merged 2 commits into
developfrom
7ttp/cli-2471-projects-create-fails-misleadingly-on-flaky-networks
Sep 23, 2026
Merged

7ttp merged 2 commits into
developfrom
7ttp/cli-2471-projects-create-fails-misleadingly-on-flaky-networks

Conversation

@7ttp

@7ttp 7ttp commented Sep 22, 2026

Copy link
Copy Markdown
Member

TL;DR

stops projects create resending a POST after a dropped connection, which surfaced "already exists" for a project the server had just created.

whats broken?

transport errors (a connection reset or the 60s timeout) were retried for any method
while the 5xx retry was already gated on idempotency

when the server had already accepted the first projects create POST, the resend hit 409 and the new ref was never printed

now fixed by:

gating transport error retries in the @supabase/api client on the same idempotency check as the 5xx path,
so GET, PUT, DELETE and HEAD still retry while POST and PATCH thru the client are sent once...

ref:

@7ttp 7ttp self-assigned this Sep 22, 2026
@7ttp
7ttp requested a review from a team as a code owner September 22, 2026 09:48

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

The PR correctly prevents transport-error retries for non-idempotent HTTP methods. The alleged major response-retry bug is refuted because isRetryableResponse already checks method idempotency. The remaining confirmed findings are a minor resilience tradeoff and two test/readability nits; no major correctness issue remains.

Findings

Severity Location Category Sources Claim
🟡 MINOR packages/api/src/internal/client.ts:226 reliability claude The method-only transport retry gate cannot preserve retries for pre-dispatch failures or POST operations with an explicit idempotency guarantee, reducing resilience even where replay could be safe.
⚪ NIT packages/api/src/internal/client.ts:226 readability claude The request-method idempotency check is loop-invariant but is recomputed for every retry attempt.
⚪ NIT packages/api/src/internal/client.unit.test.ts:689 test-coverage claude Transport retry behavior is covered for POST but not PATCH; the new mock's 409 fallback is exercised only if an unintended retry occurs.
Refuted findings (kept for transparency, not posted as review comments)
  • packages/api/src/internal/client.ts:231 (retry-safety): Non-idempotent requests can still be retried after a retryable HTTP response, risking duplicate side effects.
    Refuted: Concrete counter-evidence appears at packages/api/src/internal/client.ts:195-198: isRetryableResponse returns true for 5xx responses only when isIdempotentMethod(response.request.method) is also true. Therefore POST and PATCH responses cannot enter the retry branch.

Stats

Claude findings: 3 · Codex findings: 1 · Confirmed: 3 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread packages/api/src/internal/client.ts Resolved
Comment thread packages/api/src/internal/client.ts Resolved

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-review completed with an independent reviewer; consensus is that there are no actionable defects introduced by this PR. The transport-error gate also covers converted request timeouts, applies to the executeRaw path used by projects create, and preserves the existing idempotent-method and 5xx retry behavior.

Verified locally at this commit: all 94 API unit tests passed, and the API type check passed. No inline findings to report.

@7ttp
7ttp added this pull request to the merge queue Sep 23, 2026
Merged via the queue into develop with commit ac68190 Sep 23, 2026
63 of 66 checks passed
@7ttp
7ttp deleted the 7ttp/cli-2471-projects-create-fails-misleadingly-on-flaky-networks branch September 23, 2026 09:07
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.

projects create fails misleadingly on flaky networks

2 participants