Skip to content

fix: honor HTTP-date Retry-After in async requests - #931

Merged
marandaneto merged 1 commit into
PostHog:mainfrom
Bortlesboat:fix/async-retry-after-http-date
Sep 8, 2026
Merged

fix: honor HTTP-date Retry-After in async requests#931
marandaneto merged 1 commit into
PostHog:mainfrom
Bortlesboat:fix/async-retry-after-http-date

Conversation

@Bortlesboat

@Bortlesboat Bortlesboat commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Async requests now honor Retry-After when the server supplies an HTTP date. Previously, a 503 asking the legacy async consumer to wait ten seconds retried after one second because only numeric headers were parsed. Reusing the existing v1 parser keeps the consumer's backoff and 30-second cap intact.

💚 How did you test it?

  • 130 focused tests pass across test_async_consumer.py, test_async_request.py and test_capture_v1.py. Two new date cases fail before the fix. The regression uses real httpx.MockTransport responses, frozen time and mocked sleeps.
  • Ruff format/lint, mypy baseline, strict import and public API snapshot checks pass.
  • Full native Windows run: 2,412 passed, 24 skipped, three failures and eight temporary-directory errors. All 11 reproduce on unchanged 6b0c98f. The eight fixture errors pass with an isolated --basetemp; the remaining failures depend on POSIX path separators or os.register_at_fork.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed. No public API documentation change is needed.
  • No breaking change or entry added to the changelog. A patch changeset is included.

If releasing new changes

  • Ran sampo add to generate a changeset file. The equivalent pypi/posthog: patch changeset was written directly in .sampo/changesets/.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

The author requested additional open-source contributions. Codex (GPT-6) selected this defect, implemented the fix, ran the tests and performed the code review with Git, GitHub CLI, uv, pytest, Ruff and mypy. The implementation reuses the existing parser; the regression exercises the transport-to-consumer path. No shareable session link is available. Maintainer human review is still required.

The human driver/DRI is Bortlesboat. GitHub rejected self-assignment for this external contributor (403); a maintainer needs to set the PR assignee.

Post-Deploy Monitoring & Validation

No additional operational monitoring required; the existing retry limits are preserved and the changed header behavior is covered by deterministic regression tests.


Compound Engineering

@Bortlesboat
Bortlesboat requested a review from a team as a code owner September 8, 2026 11:38
@marandaneto

Copy link
Copy Markdown
Member

thanks @Bortlesboat

@marandaneto
marandaneto enabled auto-merge (squash) September 8, 2026 11:53
@marandaneto
marandaneto merged commit 80c541d into PostHog:main Sep 8, 2026
42 of 43 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.

2 participants