Skip to content

fix(flags): retry flag requests on transient network errors#101

Open
marandaneto wants to merge 5 commits into
mainfrom
pi-flags-network-retry-20260624
Open

fix(flags): retry flag requests on transient network errors#101
marandaneto wants to merge 5 commits into
mainfrom
pi-flags-network-retry-20260624

Conversation

@marandaneto

@marandaneto marandaneto commented Jun 25, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

/flags/?v=2 evaluation should tolerate transient network failures, but should not retry HTTP/API responses such as 408, 429, or 5xx.

This PR adds bounded retry/backoff only for transient network failures (timeouts, connection resets/lost connections, and EOF-style failures) and keeps HTTP/API status errors terminal.

💚 How did you test it?

See the repo-specific command below.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented by pi after a maintainer-directed cross-SDK pass. The chosen policy is transient network-only retry/backoff for /flags/?v=2; HTTP/API statuses remain non-retryable by design. Connection-refused failures also fail fast where the platform exposes that distinction.

Tested with:

dotnet test tests/PostHog.Unity.Tests/PostHog.Unity.Tests.csproj --filter NetworkClientTests

@marandaneto marandaneto self-assigned this Jun 25, 2026
@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "fix: retry feature flag requests on netw..." | Re-trigger Greptile

Comment thread tests/PostHog.Unity.Tests/NetworkClientTests.cs
@marandaneto marandaneto changed the title fix: retry feature flag requests on network errors fix(flags): retry flag requests on transient network errors Jun 25, 2026
Comment thread com.posthog.unity/Runtime/Core/NetworkClient.cs
@marandaneto marandaneto marked this pull request as ready for review June 26, 2026 15:00
@marandaneto marandaneto requested a review from a team as a code owner June 26, 2026 15:00
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "Merge branch 'main' into pi-flags-networ..." | Re-trigger Greptile

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