feat: capture_ai public beta - #869
Conversation
Generated-By: PostHog Code Task-Id: 4b5e5cda-81f1-41a2-8fcd-4f335d19217e
posthog-python Compliance ReportDate: 2026-08-13 09:41:54 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Prompt To Fix All With AI### Issue 1
posthog/client.py:1503
**AI events retain UUIDv4 fallback**
When `capture_ai` is called without a UUID, it delegates to the shared `_capture` and `_enqueue` path, which generates a UUIDv4. The returned and transmitted identifier therefore violates the new capture-ai UUIDv7 contract and lacks the intended time-ordering semantics.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat: capture ai public beta" | Re-trigger Greptile |
marandaneto
left a comment
There was a problem hiding this comment.
Automated review findings.
| Internal and experimental, with no stability guarantees: the signature | ||
| and lane behavior may change while the AI capture lane is validated on | ||
| PostHog's own traffic. | ||
| Takes the same arguments and returns the same value as `capture()`: |
There was a problem hiding this comment.
blocking: Returned UUID can differ from the transmitted UUID
This promises that capture_ai() returns the event UUID, but _enqueue() snapshots sent_uuid before invoking before_send. Because that supported callback can replace or remove msg["uuid"], the queued event can differ from the returned UUID, breaking the deduplication contract. Please normalize/generate the UUID after before_send, return the final queued UUID, and add regression coverage for callbacks that replace or remove it.
Generated-By: PostHog Code Task-Id: 4b5e5cda-81f1-41a2-8fcd-4f335d19217e
💡 Motivation and Context
Takes the AI capture lane public as a beta, per RFC 1198 and the cross-SDK contract in
sdk-specs(capture-aicapability, branchfeat(aio)/add-capture-ai). The private_capture_ai(shipped since 7.29.0) becomescapture_ai— public onClientand module level, returning the event UUID — and the two private flags collapse into one publicenable_full_ai_capture(wrapper routing + no truncation + media passthrough;privacy_modealways wins), with_use_ai_lane/_enable_multimodal_capturekept as silent deprecated aliases for the transition window.capture_aireturns the captured event's UUID (a client-generated one when the caller supplies none), which is what makes at-least-once delivery dedupe-safe. The compliance adapter opts into the newcapture_aiharness suite (capture_ai_v0).💚 How did you test it?
setup()sync), privacy-mode-wins, lane isolation both directions.posthog/test/test_ai_capture_lane.pygreen; fullmake testgreen (pre-existing env-only failures identical on base).make public_api_checkclean; snapshot regenerated.capture_aisuite 4/4 against this branch's compliance adapter.📝 Checklist
posthog.com, branchfeat(aio)/capture-ai-docs)If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Created with PostHog Code