Skip to content

fix(ci): auth warlock triage with the CI gateway token file - #395

Merged
gewenyu99 merged 1 commit into
mainfrom
posthog/warlock-ci-gateway-token
Sep 15, 2026
Merged

gewenyu99 merged 1 commit into
mainfrom
posthog/warlock-ci-gateway-token

Conversation

@gewenyu99

Copy link
Copy Markdown
Collaborator

Problem

Warlock's LLM triage stopped authenticating against the gateway (e.g. this run): every YARA match logged LLM provider call failed — defaulting to true positive, so 401 routine false positives failed the build. The gateway retired personal-API-key auth for CI callers: PostHog/wizard#1240 moved CI to a pre-issued gateway bearer supplied through a token file against https://ai-gateway.<region>.posthog.com, and PostHog/wizard-workbench#3875 established the CI-side pattern.

#393 hot-patched the script onto the gateway's ci product with the personal key; this PR replaces that with the sanctioned token-file mechanism.

Changes

  • scripts/scan-warlock.js: read the bearer from the file named by CONTEXT_MILL_WARLOCK_GATEWAY_TOKEN_FILE (with ANTHROPIC_AUTH_TOKEN / ANTHROPIC_BASE_URL as local overrides), target ai-gateway.<region>.posthog.com, and send it as Authorization: Bearer via the SDK's authToken instead of apiKey (x-api-key). Missing or empty token keeps the existing no-triage fallback.
  • build.yml / build-release.yml: write GH_APP_POSTHOG_WIZARD_CI_BOT_POSTHOG_GATEWAY_TOKEN (org secret, already visible to this repo) to $RUNNER_TEMP/gateway-token and point the scan at it. Fork PRs still get an empty token → annotate-only via the existing continue-on-error.

Test plan

  • npm test: 207 tests pass.
  • Local smoke: no token → "LLM triage disabled"; token file present → "LLM triage enabled"; empty token file → disabled.
  • This PR's build run is the live proof: the warlock step must show LLM triage enabled with real triage verdicts (no "LLM provider call failed").

Created with PostHog Desktop

🤖 Generated with Claude Code

The wizard gateway moved CI callers to a pre-issued bearer supplied
through a token file against ai-gateway.<region>.posthog.com (see
PostHog/wizard#1240). Write the shared CI bot gateway secret to a file
and pass it via CONTEXT_MILL_WARLOCK_GATEWAY_TOKEN_FILE, sent as
Authorization: Bearer, replacing the personal-API-key auth.

Generated-By: PostHog Desktop
Task-Id: 5f9d544a-ef47-488d-bd47-a8e7c61a6583

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gewenyu99
gewenyu99 requested a review from a team as a code owner September 15, 2026 16:28
@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 replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /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/flutter
  • /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 replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /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
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a wizard branch:

  • /wizard-ci all wizard:my-branch

Add wizard:<branch> to any command above to pin the wizard branch. It defaults to main.

Results will be posted here when complete.

@gewenyu99
gewenyu99 merged commit fc795b5 into main Sep 15, 2026
18 checks passed
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.

2 participants