Skip to content

fix: immediate AI size check and new retry defaults - #286

Open
eli-r-ph wants to merge 3 commits into
v1from
v1-immediate-ai-size-and-retries
Open

eli-r-ph wants to merge 3 commits into
v1from
v1-immediate-ai-size-and-retries

Conversation

@eli-r-ph

@eli-r-ph eli-r-ph commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

The immediate AI methods sent events over the 8 MiB limit and let PostHog refuse them, while the background lane already dropped them locally. Retry defaults also differed from the other PostHog SDKs.

Changes

  • capture_ai_immediate and capture_ai_batch_immediate no longer send an event whose properties exceed 8 MiB.
    • The returned CaptureSummary reports it as a drop with detail ai_event_too_big, counted in submitted().
  • Capture makes 4 attempts (was 3), and the first retry waits 100 ms (was 200 ms).
  • Remote /flags retries get their own backoff: 300 ms, doubling up to 30 s.
  • The migration guide and a changeset cover the retry defaults; the AI drop text is in docs: finish the 1.0 migration guide and changesets #280.

💚 How did you test it?

  • An event at exactly 8 MiB is sent, one byte over is dropped, and an all-oversize call sends nothing.
  • Breaking the size check, the retry defaults, or the /flags backoff each fails a test.
  • fmt, clippy and tests pass in every feature set.

🤖 Generated with Claude Code

@eli-r-ph eli-r-ph self-assigned this Oct 10, 2026
@eli-r-ph
eli-r-ph marked this pull request as ready for review October 10, 2026 21:51
@eli-r-ph
eli-r-ph requested a review from a team as a code owner October 10, 2026 21:51
capture_ai_immediate and capture_ai_batch_immediate now apply the 8 MiB per-event limit before sending, like the background AI lane. An event over the limit is not sent and gets a local drop verdict with the detail ai_event_too_big in the returned CaptureSummary.
… its own backoff

max_capture_attempts now defaults to 4 and retry_initial_backoff_ms to 100. Remote /flags retries use a fixed backoff of 300 ms, doubling up to 30 s, instead of the capture retry options.
@eli-r-ph
eli-r-ph force-pushed the v1-immediate-ai-size-and-retries branch from 5adc870 to c68bee5 Compare October 12, 2026 17:34
The test read each event's uuid before capture; setting it explicitly keeps
the test independent of when the SDK assigns uuids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eli-r-ph eli-r-ph changed the title fix: drop oversize AI events locally on the immediate path and align retry defaults fix: immediate AI size check and new retry defaults Oct 13, 2026

This branch has not been deployed

No deployments
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