Skip to content

feat(gateway): stop falling back to the legacy gateway - #1221

Open
brandonleung wants to merge 6 commits into
mainfrom
brandon/wizard-w1-1-drop-legacy-posture
Open

feat(gateway): stop falling back to the legacy gateway#1221
brandonleung wants to merge 6 commits into
mainfrom
brandon/wizard-w1-1-drop-legacy-posture

Conversation

@brandonleung

@brandonleung brandonleung commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

When the gateway-token mint answers 404 or 401 the CLI treats it as "this PostHog has no gateway" and quietly runs on the legacy one, caching that decision for ten minutes. That path enforces none of the mint's limits, and the user is never told the wizard changed how it is paying for the run.

Changes

The fallback goes, and a refusal ends the run with the server's reason.

  • Deletes GatewayEdition, legacyAuth, the retry cache, the gateway_edition tag and every legacy branch: the agent interface's per-key header build, the pi harness gateway module, the triage provider, bootstrap, MCP prompt streaming, and HostResolution.gatewayUrl.
  • isMintRefusal covers 400, 401, 403, 404 and 429, each with a message the user can act on, and the server's detail is preferred whenever it sends one.
  • The mint body carries reads_refusal_reason, which is how the server knows it may answer a refusal with its reason rather than the 404 an older build needs.
  • Server text is stripped of control characters before it reaches a terminal, and bounded.

Carries a cherry-pick of #1215, which is closed unmerged.

Test plan

pnpm test. Every deleted symbol is grepped for surviving readers, each refusal status is pinned to its message, and a detail made only of control characters falls back to the fixed copy.

pnpm typecheck fails on src/wizard.ts for a yargs alias inference issue that is present on main and untouched here.

gewenyu99 and others added 2 commits September 8, 2026 13:00
A refused mint carried a fixed message per status, so a blocklisted account read "Your access to this project has changed" instead of the server's detail naming the contact address. Prefer the response detail when it is a short string; keep the fixed message otherwise.

Generated-By: PostHog Desktop
Task-Id: ecbe6b2f-c266-41d5-be54-272f86314c88
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 8, 2026

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 Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

brandonleung and others added 4 commits September 8, 2026 15:23
…detail

Dropping the legacy fallback means a 404 is no longer useful here, but the
server still owes one to builds that do fall back. The mint now says which
this is, so the server can answer a refusal with its reason without
breaking every older client.

The detail it sends is printed to a terminal, so control characters and
the escapes an ANSI sequence is built from are stripped first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
401 and 404 come from layers with no wizard-specific message, so their
detail is DRF's "Invalid token." or "Not found.", which replaced the copy
naming the upgrade command. A detail that cleans to nothing also falls
back now, and a control-only detail pins both the C1 arm and the trim
running after the substitution.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Suppressing it on 401 and 404 assumed those carry DRF boilerplate, but the
mint answers 404 with the reason a client that does not declare itself
gets: the rollout is off, or the program is unrecognised. Dropping that
text left the user with generic copy on the refusals that explain
themselves best.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brandonleung
brandonleung force-pushed the brandon/wizard-w1-1-drop-legacy-posture branch from e57e7ef to 2aa1b63 Compare September 8, 2026 20:57
@brandonleung
brandonleung marked this pull request as ready for review September 8, 2026 21:14
@brandonleung
brandonleung requested a review from a team as a code owner September 8, 2026 21:14
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