Skip to content

chore(api): drop the abort-during-backoff handling from retryTransient - #1562

Open
Silthus wants to merge 3 commits into
mainfrom
chore/trim-1506-retry-abort
Open

Silthus wants to merge 3 commits into
mainfrom
chore/trim-1506-retry-abort

Conversation

@Silthus

@Silthus Silthus commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Follow-up trim of #1506, which went through several review rounds. One of them taught retryTransient to watch an abort signal during its backoff, for the signup user read's 10 s deadline. The read already ends at that deadline without it: fetchUserData passes the signal to axios, the abort cancels the in-flight request, and isTransient treats a cancelled request as final, so the retries stop. The extra plumbing only cut a backoff of at most 1.5 s short and threw the earlier failure instead of the cancel, for the one caller (readSignedUpUser) that swallows both.

Changes

Deletion only.

  • src/shared/api.ts: retryTransient loses its signal parameter, the abort-aware sleep, and the two signal?.aborted checks. Its default sleep goes back to the plain timer it had before feat(analytics): report detected email providers and identify signup runs #1506. fetchUserData keeps its signal and still passes it to axios.
  • src/shared/__tests__/api-errors.test.ts: keeps the one test of a deadline that passes during a backoff, now named "stops after a backoff that outlasts the deadline, without another request". It now expects the read to reject once that backoff ends, still with two requests, instead of the earlier 503 at the deadline.

Kept from #1506, each with its reason:

  • The signup identify path (readSignedUpUser, analytics.identifyUser): shipped in v2.94.0 and runs on every --signup. $identify and $create_alias have already merged persons for real signups, so removing it would change product analytics going forward. It is not unused.
  • The 10 s signup read timeout and the signal passed to axios: without them a stalled /api/users/@me/ read would hang signup with no limit, since axios sets no default timeout.
  • ERR_CANCELED as not transient: this is what now ends the retries at the deadline.
  • The two remaining deadline tests ("gives up on a local server that…never answers", "gives up after one deadline, retries included") and signup.test.ts: they cover the deadline that a signup run can observe.
  • The email-provider event (email-providers.ts, report.ts and its test): this is the core ask of feat(analytics): report detected email providers and identify signup runs #1506.

Note

🔵 Merge risk: low · two-way door

  • Changes: a wizard --signup whose user read hits its 10 s deadline during a retry backoff now waits out that backoff (at most 1.5 s more). It then fails with the cancel instead of the earlier 5xx. readSignedUpUser swallows either and signs in unidentified, as before.
  • Unchanged: every other login-path request (fetchProjectData, API-key login, OAuth user read). None of them passes a signal. Their backoff sleeps on a plain timer again, as before feat(analytics): report detected email providers and identify signup runs #1506, and sleeps the same 500 and 1500 ms. The kept test "gives up after one deadline, retries included" runs that real backoff and the retry after it. The retryTransient tests cover which failures retry.
  • Uncovered row: the exception fetchUserData reports for a signup read past its deadline during a backoff now carries network_code: ERR_CANCELED rather than the 5xx status_code.
  • Switch-off: none: live on release, revert to undo.
  • Tier: non-critical

Test plan

Lane gate on this branch: node scripts/generate-version.cjs && pnpm typecheck exit 0, pnpm lint exit 0 (warnings only, as on main), pnpm vitest run src/shared src/tui/auth passes, and api-errors.test.ts passes at the final head. A run of fetchUserData against a local stub (503, then a 503 after 2 s, 3 s deadline) on main and on this branch shows the delta in the callout: main rejects with the 503 at about 3.0 s, this branch rejects with the cancel at about 4.0 s, and both send two requests. Full pnpm test is covered by CI. Locally, unrelated tests timed out at 5 s under machine load, and a different set failed on each run.

🤖 Generated with Claude Code

How did you test this code?

Proof What ran Result Commit
live-run fetchUserData at HEAD 649ad17 run for real (axios, timers, HTTP through a local proxy stub that answers 503, then 503 after 2 s) with a 3 s AbortSignal deadline, from a scratch vitest file that is not committed Rejects with ERR_CANCELED about 4.0 s in, when the 1.5 s backoff ends; two requests, no third; signup's readSignedUpUser catches any rejection 073ad93 (reused from 649ad17)
shadow-diff diff -u of the scratch deadline-during-backoff run on base 73efc24 and HEAD Only the elapsed time, the commit and the rejection change: 503 at the deadline on base, ERR_CANCELED when the backoff ends on HEAD, two requests on both 073ad93 (reused from 649ad17)
Review 7-lens panel (claude-opus-5-5, gpt-6.1-sol), round 1 8 findings: 0 fixed, 3 rejected, 5 other 649ad17
Proof judge an independent model reads the evidence against the diff ✅ passed at 073ad93

Not checked: none recorded
Full receipt (PostHog team): https://artifacts.posthog.com/a/xoxeTaonlWLNIs1IiCpSbO

The signup user read already ends at its deadline: the abort cancels the
in-flight request, and a cancelled request is not transient, so the
retries stop. The extra signal plumbing only cut a backoff of at most
1.5 s short and threw the earlier failure instead of the cancel, for a
caller that swallows both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci feature-flags
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci feature-flags/django
  • /wizard-ci feature-flags/next-js
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/go-sdk
  • /wizard-ci mcp-analytics/python-sdk
  • /wizard-ci mcp-analytics/ruby-sdk
  • /wizard-ci mcp-analytics/rust-sdk
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@posthog posthog 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.

PostHog Review · Standard · reviewed 649ad17: no findings.

The read now stops when the backoff that outlasts the deadline ends,
with no third request, instead of throwing the earlier 503 at the
deadline. Keep the only test of that case rather than deleting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@posthog posthog 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.

PostHog Review · Standard · reviewed 073ad93: no findings.

@Silthus
Silthus marked this pull request as ready for review November 14, 2026 11:24
@Silthus
Silthus requested a review from a team as a code owner November 14, 2026 11:24
@veria-ai

veria-ai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

PR overview

No security issues were found in this pull request.

Reviews

@posthog-security-review-bot posthog-security-review-bot Bot added the security-review Request a security review label Nov 14, 2026
@posthog-security-review-bot

posthog-security-review-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ Security review complete — 073ad935cba3

No findings above the confidence threshold, in 3 min.

Add the security-review label to run again on the latest commit.

@Silthus

Silthus commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

End-of-run report: #1562

Still yours

None.

Merged under the narrow grant

None.

Decisions

  • 🤖 Owe a prod read of the retrier queue before deleting the forwarders? Accept the prod-shape gap: retrier code bounds a queued job to minutes, the deploy was five days ago Rejected: Ask Michael to read the prod runs table first. (agent, proof-gap, thread thread:delegated-task:command%3Amcp%3A7ae35aeb-4fed-49f5-8d29-e943e53ef8b2%3Adelegate-task%3A8efe9faf-adb3-4db8-ab53-f8e2a9a9aaca) [d-8cf67294] voided: The judge showed the retrier heartbeat keeps a pending run alive with no expiry, so code alone can't bound queue age; the prod read goes to Michael
  • 🤖 Accept the post-deploy-watch gap on the wizard retry trim? Accept: no branch is left to test or watch; the kept deadline test and the saved live run cover the outcome Rejected: Add a new test or a post-release watch to a deletion-only PR. (agent, proof-gap, thread thread:delegated-task:command%3Amcp%3A7ae35aeb-4fed-49f5-8d29-e943e53ef8b2%3Adelegate-task%3A8efe9faf-adb3-4db8-ab53-f8e2a9a9aaca) [d-b2cab7f8]
  • 🤖 Accept the judge gap on the wizard retry trim? Accept: no branch is left to test or watch; the kept deadline test and the saved live run cover the outcome Rejected: Add a new test or a post-release watch to a deletion-only PR. (agent, proof-gap, thread thread:delegated-task:command%3Amcp%3A7ae35aeb-4fed-49f5-8d29-e943e53ef8b2%3Adelegate-task%3A8efe9faf-adb3-4db8-ab53-f8e2a9a9aaca) [d-dff68296] voided: Superseded: 073ad93 keeps the backoff-deadline test with the new outcome, and the quality judge passes at that head

Proofs

PR Ran Deferred Voided Receipt
#1562 live-run reused from 649ad17; shadow-diff reused from 649ad17 none d-dff68296 voided receipt

Side fixes started

None.

@posthog-security-review-bot posthog-security-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agent-driven security review - no findings.

@posthog-security-review-bot posthog-security-review-bot Bot removed the security-review Request a security review label Nov 14, 2026
@Silthus
Silthus marked this pull request as draft November 14, 2026 17:47
…-abort

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Silthus
Silthus marked this pull request as ready for review November 17, 2026 04:46
@posthog-security-review-bot posthog-security-review-bot Bot added the security-review Request a security review label Nov 17, 2026
@posthog-security-review-bot

posthog-security-review-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

✅ Security review complete — 9b7d13ea8597

No findings above the confidence threshold, in 3 min.

Add the security-review label to run again on the latest commit.

@posthog-security-review-bot posthog-security-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agent-driven security review - no findings.

@posthog-security-review-bot posthog-security-review-bot Bot removed the security-review Request a security review label Nov 17, 2026
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