Skip to content

docs(capture-ai): specify the capture v1 AI lane and wrapper routing - #147

Open
eli-r-ph wants to merge 6 commits into
mainfrom
eli/capture-ai-v1-specs
Open

eli-r-ph wants to merge 6 commits into
mainfrom
eli/capture-ai-v1-specs

Conversation

@eli-r-ph

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

Copy link
Copy Markdown

⚠️ DO NOT MERGE prior to v1 SDK public release! ⚠️

Problem

  • An SDK adding AI capture today has a spec that names only posthog-python and posthog-node, lists /i/v0/ai/batch/ as the route, and ties the routing of PostHog's own AI wrappers to the enable_full_ai_capture flag.

  • posthog-python 8.0, posthog-node 6.0, posthog-go v2 and posthog-rs 1.0 ship AI capture on capture v1 (/i/v1/ai/events), and their wrappers always use the AI method.

  • The harness has no capture_ai_v1 capability, so an SDK on the v1 AI endpoint cannot be selected for any AI parity case.

  • Depends on docs(capture): specify capture v1 delivery for server SDKs #146: the capture and retry-queue rules this spec delegates to land there, so docs(capture): specify capture v1 delivery for server SDKs #146 merges first.

Changes

  • capture-ai names all four implementations and adds the Go and Rust method shapes.
  • capture-ai gains the capture v1 AI lane: the endpoint, the shared body, headers and per-event results from capture, misrouted_event for a non-AI event on that endpoint, lane isolation, and the analytics endpoint's temporary acceptance of $ai_* events.
  • PostHog's AI wrappers always send through the AI method; the full-capture flag now controls only truncation and media redaction, and a wrapper given a client without the AI method turns its own capture off instead of falling back to capture.
    • Breaking for the wrapper contract as written; every v1 wrapper already behaves this way.
  • capture-ai gains the lane configuration surface (compression, queue capacity, request timeout, an optional lower-only per-event cap) with its defaults; this supersedes draft docs(capture-ai): specify the AI lane's configuration surface #118.
  • capture-ai gains the size rules: an 8 MiB ceiling on properties, a 5 MiB request target, size-aware batching that keeps order, and a content-free oversize log line.
  • migration/yaml-parity-v1/capture-ai-v1.feature adds the v1 AI cases under a new capture_ai_v1 capability, reusing the registered step phrases of the v0 feature; the README documents the capability.

Note

posthog-node 6 defaults the AI lane's compression to gzip and the other three SDKs to none. The requirement records the default as the SDK's documented choice rather than picking one.

How did you test this code?

  • openspec validate add-capture-ai-v1 --type change --strict passed before archiving.
  • openspec validate --specs --strict --no-interactive after archiving: 67 passed, 0 failed, the same totals as main.
  • Every rule was checked against capture on PostHog/posthog master (rust/capture/src/v1/analytics/router.rs, constants.rs, process.rs) and the four SDK v1 branches; sources are listed in the archived design.md.
  • Not run: the harness. No adapter declares capture_ai_v1 yet, so the new feature is discoverable but unselected.

🤖 Agent context

  • Written by Claude Code (Claude Fable 5.1) with the SDK owner directing scope and decisions.
  • Skills invoked: writing-pr-descriptions.
  • The session surveyed capture-rs, the four SDK branches and the production ingress config, drafted the change with the OpenSpec CLI, archived it, and synced the narrative notes by hand.

🤖 Generated with Claude Code

@eli-r-ph eli-r-ph self-assigned this Oct 25, 2026
@eli-r-ph
eli-r-ph marked this pull request as ready for review October 25, 2026 18:24
@eli-r-ph
eli-r-ph requested a review from a team as a code owner October 25, 2026 18:24
Comment thread openspec/changes/archive/2026-10-25-add-capture-ai-v1/tasks.md Outdated
@marandaneto
marandaneto requested a review from a team October 27, 2026 14:01

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Automated advisory code review. Four findings revalidated against the unchanged reviewed patch. Runtime/control reproductions and the static-only limitation are identified in the individual comments.

Comment thread migration/yaml-parity-v1/capture-ai-v1.feature
Comment thread migration/yaml-parity-v1/capture-ai-v1.feature
Comment thread openspec/specs/capture-ai/spec.md Outdated
Comment thread openspec/specs/capture-ai/spec.md
@marandaneto
marandaneto requested a review from a team October 27, 2026 14:03
Comment thread openspec/specs/capture-ai/spec.md Outdated
Comment thread openspec/specs/capture-ai/spec.md Outdated
Comment thread openspec/specs/capture-ai/spec.md Outdated
Comment thread openspec/specs/capture-ai/spec.md
Comment thread migration/yaml-parity-v1/capture-ai-v1.feature
Comment thread openspec/specs/capture-ai/spec.md Outdated
Comment thread openspec/specs/capture-ai/spec.md
Comment thread openspec/specs/capture-ai/spec.md
Comment thread openspec/specs/capture-ai/spec.md
Comment thread migration/yaml-parity-v1/capture-ai-v1.feature
@turnipdabeets
turnipdabeets requested a review from a team October 27, 2026 16:03
@eli-r-ph
eli-r-ph force-pushed the eli/capture-ai-v1-specs branch from 70e393c to 83d9bb1 Compare October 27, 2026 16:05
eli-r-ph and others added 3 commits October 27, 2026 10:35
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…andling and settings scope

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…he delivery feature

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

3 participants