Skip to content

feat(features): offer server-side HTTP log capture on Cloudflare Workers projects - #1114

Open
lricoy wants to merge 2 commits into
mainfrom
posthog/http-log-additional-feature
Open

lricoy wants to merge 2 commits into
mainfrom
posthog/http-log-additional-feature

Conversation

@lricoy

@lricoy lricoy commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

Problem

Bots, crawlers, and AI agents rarely run JavaScript, so a wizard-installed JS SDK never sees them. Bot analytics in web analytics needs server-side $http_log events, and the wizard has no way to set that up, even on projects where it is a one-file change.

Changes

Note

Ported to the integration-v2 task model. The first version used the AdditionalFeature opt-in queue, which main no longer has. The tips-card toggle is gone: the task now runs on its own where the project has a server hook.

  • A new optional http-logs task in posthog-integration loads the http-logs skill menu from context-mill, installs the variant for the project's hook (Cloudflare Worker, Next.js middleware or server middleware), and follows its workflow. It waits for capture, and review waits for it.
  • A new serverHttpHook trait gates it through skipWhen: [serverHttpHook:no]. The trait is yes for a Cloudflare package, a Wrangler config or a root middleware file, and no once the walk has read the run project and found none.
  • Feature discovery reads the Wrangler and middleware files with no package.json, so a Workers project without one is found.
  • The Cloudflare package list and Wrangler file names now come from cloudflare-detection.ts, the one place that already listed them.

Warning

The http-logs skill is not in context-mill yet. It is written and builds locally, but is unpublished, so until it ships the task finds no menu and completes without changes.

Test plan

  • features.test.ts: a Cloudflare package, and each Wrangler or middleware file with no package.json, marks the hook. It fails without the file scan.
  • traits.test.ts and trait-sources.test.ts: the trait is yes from the scan or a member's packages, and no on a walked run project without a hook.
  • flow-graphs.test.ts: http-logs is queued when the trait is yes and skipped when no. It fails without the skipWhen.
  • Full suite, pnpm typecheck and eslint pass. Not run: an end-to-end wizard session.

LLM context

First version authored with Claude Code in a PostHog Desktop cloud task. Ported to the task model by Claude Code (Claude Opus 5.5). Part of a wider $http_log adoption effort: source templates in PostHog/posthog#85969, docs in PostHog/posthog.com#19588.

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue
  • /wizard-ci self-driving

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/groq
  • /wizard-ci ai-observability/manual-capture
Show more apps
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit

Results will be posted here when complete.

@lricoy
lricoy marked this pull request as ready for review August 25, 2026 19:29
@lricoy
lricoy requested a review from a team as a code owner August 25, 2026 19:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af80cec8c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/wizard-session.ts Resolved
Comment thread src/ui/tui/components/TipsCard.tsx Resolved
Comment thread src/lib/detection/features.ts Resolved
Ports the HTTP log add-on to the integration-v2 task model: a serverHttpHook
trait from Cloudflare packages, Wrangler configs or root middleware (read
without a package.json), and an optional http-logs task that loads the
http-logs skill from context-mill and is skipped on projects without a hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lricoy
lricoy force-pushed the posthog/http-log-additional-feature branch from af80cec to eae685e Compare November 30, 2026 12:37
@veria-ai

veria-ai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Reviews

@sarahxsanders sarahxsanders left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

from Sarah's robot


## Goal

Send each server request to PostHog as an `$http_log` event, so bots, crawlers

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

once the skill ships, a general Wizard setup can add server request logging just because it found a hook, without the user choosing it.
ask before editing the hook, or keep HTTP log capture in an explicit opt-in flow.

… the default

The HTTP logs prompt no longer sets model_pi, effort_pi, model_sdk or
effort_sdk. The wizard is moving every task to one default model and effort
that the wizard-model-overrides flag can change (#1643, #1644). A prompt that
pins its own model skips both. Until #1644 lands, this task runs the
integration program's binding.

Co-Authored-By: Claude Opus 5.5 <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