mirror of
https://github.com/hanzoai/insights.git
synced 2026-11-03 00:52:32 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
6.7 KiB
6.7 KiB
Migration examples
These PRs show different migration shapes. Read the relevant diff before implementing a similar change because gateway contracts have continued to evolve. Use them for implementation decisions, not as an inventory of current rollout state.
Django and direct-provider callers
- #64448: make cluster labeling routable through the AI gateway introduces an environment-gated OpenAI client, validates paired settings, preserves direct-provider fallback, checks model availability before rollout, and tests both routes.
- #65043: route the eval-report agent through the AI gateway moves the AI observability eval-report agent after the shared route exists and tests the selected client path.
- #65044: route OpenAI summarization through the AI gateway extracts shared sync and async builders, uses the slugless Go URL and project secret, keeps
trust_env=False, retains the Python fallback, and prevents duplicate$ai_generationcapture.
Incremental product rollout
- #71947: add the Signals AI gateway client and per-call opt-in adds the Anthropic builder and an opt-in seam without moving traffic. It converts per-key metadata to
X-Insights-Properties, strips/v1for the Anthropic SDK, and preserves Python behavior for callers that have not opted in. - #71948: route Signals grouping through the AI gateway uses that seam to move one workload at a time. Reverting the small opt-in returns only grouping to Python.
- #71949: route Signals emission stages through the AI gateway handles batch and per-call metadata explicitly. Its tests cover both the Go JSON properties blob and Python per-key fallback headers.
- #71950: route Signals safety through the AI gateway opts the safety filter and report safety judge into the shared Go-capable client.
- #71951: route Signals eval summarization through the AI gateway applies the same narrow per-call rollout to eval summaries.
- #72769: tag eval-fixture generation as
signals_evalpreserves workload attribution for Signals eval generation.
Sandbox and deployment wiring
- #72770: route selected sandbox products to the AI gateway treats migration as more than a client change. It pairs URL and product rollout settings, reserves them against user overrides, updates both egress enforcement layers, validates configured hostnames, extends startup diagnostics, and keeps rollback to clearing either setting.
Cross-repository patterns
Standalone TypeScript service
- Insights/SherlockHog #104: route the agent through the slugless AI gateway adds the paired Go settings, base URL translation, project-secret auth, Python fallback, and route-selection tests for a TypeScript Claude Agent SDK service.
- Insights/SherlockHog #111: boot with either complete gateway pair fixes the transitional startup contract so an AI-gateway-only deployment can boot while preserving the Python rollback route.
- Insights/SherlockHog #112: tag the AI product through
X-Insights-Propertiescorrects attribution after the initial cutover reused Python's per-property headers. It keeps each gateway's metadata format separate and verifies that the Go route no longer emits the legacy form. - Insights/charts #12919: cut development over to the slugless AI gateway wires the development URL and secret first, with explicit deployment rendering and rollback checks.
- Insights/charts #12920: cut production over to the slugless AI gateway applies the regional production configuration after the development stage.
Together these show the client, transitional boot contract, attribution correction, staged deployment, and rollback boundaries.
Per-product sandbox routing
- Insights/code #3659: route selected products to the AI gateway selects a gateway per sandbox request. It requires both the Go URL and an allowlist, keeps unlisted products on Python, converts attribution to one bounded ASCII-safe JSON header, and gives each workload a distinct product tag.
- Insights/insights #72770: route selected sandbox products to the AI gateway passes the settings into sandboxes, reserves them against user overrides, updates both egress enforcement layers, validates configured hostnames, and extends startup diagnostics.
- Insights/charts #13358: route Signals sandbox stages in development activates the client and Django support for four workloads in development.
These show how to select Go per request, pass configuration through a sandbox boundary, enforce egress, and activate a narrow set of workloads.
Standalone PR-review agent
- Insights/insights #68329: route the PR-approval agent through the AI gateway and Insights/code #3354: route PR review through the AI gateway validate paired settings, strip
/v1before the SDK restores its messages path, set both Anthropic auth variables, avoid duplicate capture by bypassing the traced wrapper in gateway mode, and retain an explicit fallback.
Deployment activation
- Insights/charts #13131: repoint worker deployments to the AI gateway demonstrates that merged client support does not move traffic by itself. It wires the regional URL and app-specific secret into every deployment that runs an already-migrated caller, with removal of either setting as rollback. Use it as deployment guidance, not as a standalone caller migration.
Post-migration parity checks
- #74249: send a stable team trace ID to the Go gateway fixes trace fragmentation found after a migration. It matches Python's existing trace derivation, sends the dedicated Go header, and pins cross-gateway compatibility with fixed expected IDs.
Use these examples for their decisions and verification boundaries. Re-check services/llm-gateway/PARITY.md before adopting an older pattern.