Skip to content

chore(aio): flush Convex telemetry before action return - #71433

Merged
willwearing merged 2 commits into
masterfrom
docs/convex-force-flush
Jul 16, 2026
Merged

chore(aio): flush Convex telemetry before action return#71433
willwearing merged 2 commits into
masterfrom
docs/convex-force-flush

Conversation

@willwearing

Copy link
Copy Markdown
Contributor

Problem

Convex actions can finish while OpenTelemetry exports are still pending, which can drop AI observability spans.

Changes

Flush both Convex action examples before returning.

How did you test this code?

  • pnpm exec oxfmt --check docs/onboarding/ai-observability/convex.tsx
  • pnpm exec oxlint --quiet docs/onboarding/ai-observability/convex.tsx
  • git diff --check

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

Updates the Convex AI observability installation guide.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Codex prepared and published this docs-only change using /posthog-support-answer, /slack, and /yeet.

@willwearing willwearing added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Jul 16, 2026
@willwearing willwearing self-assigned this Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

ℹ️ Docs preview — preview build triggered

Docs from this PR will be published at posthog.com.

Project Preview Updated (UTC)
posthog.com Open preview Jul 16, 2026, 8:43 AM

The preview should be ready in about 10 minutes. Open the preview at /handbook/engineering/.

@willwearing
willwearing marked this pull request as ready for review July 16, 2026 08:42
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 16, 2026 08:42
@willwearing
willwearing enabled auto-merge (squash) July 16, 2026 08:43
@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "Merge branch 'master' into docs/convex-f..." | Re-trigger Greptile

},
})

await provider.forceFlush()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Telemetry Failure Rejects Action

When the OTLP exporter fails or times out, the awaited forceFlush() can reject after the model has already produced a valid result. That rejection makes the Convex action fail instead of returning the generated response. Isolate this best-effort telemetry failure from the action result; the second example has the same failure path.

Rule Used: Always wrap asynchronous calls that may fail, such... (source)

Learned From
PostHog/posthog#32098

@willwearing
willwearing merged commit f7b4bb4 into master Jul 16, 2026
177 checks passed
@willwearing
willwearing deleted the docs/convex-force-flush branch July 16, 2026 08:53
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-16 09:18 UTC Run
prod-us ✅ Deployed 2026-07-16 09:33 UTC Run
prod-eu ✅ Deployed 2026-07-16 09:33 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants