fix(agent): pin SDK background model to stop retired-snapshot 404s#757
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(agent): pin SDK background model to stop retired-snapshot 404s#757posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The main query() pins the primary model (claude-sonnet-4-6), but never pins the Claude Agent SDK's separate small/fast background model. For background work (topic detection, summarization, quota probes) the SDK falls back to its built-in default — a retired claude-3-5-haiku snapshot the PostHog LLM gateway doesn't serve — so every such call 404s with not_found_error. It's silent: those rows carry no $ai_http_status. Pin ANTHROPIC_DEFAULT_HAIKU_MODEL / ANTHROPIC_SMALL_FAST_MODEL (legacy) and ANTHROPIC_DEFAULT_SONNET_MODEL in the SDK env block to gateway-supported bare aliases so the SDK can't reach for a retired id. Generated-By: PostHog Code Task-Id: fbe62d08-5ad3-45c2-b9e5-fdc735a3d728
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The wizard's Claude Agent SDK kept calling Anthropic's retired
claude-3-5-haiku-20241022for background work, which the PostHog LLM gateway doesn't serve — 203 failed generations across 17 users since 06-15, 100%not_found_error, still failing. The main query pins the primary model (claude-sonnet-4-6), but never pins the SDK's separate small/fast background model, so background operations (topic detection, summarization, quota probes) fell back to the SDK's built-in default snapshot. The failure is silent — those rows carry no$ai_http_status, so it only surfaces in AI observability. The core integration flow keeps working (the main model succeeds); only background features degrade. (Same gap explains the smallerclaude-sonnet-4-20250514andclaude-3-7-sonnet-20250219buckets.)Changes
Pin the SDK's background/default model env vars in the same
env:block that already dropsANTHROPIC_API_KEY—ANTHROPIC_DEFAULT_HAIKU_MODEL(+ legacyANTHROPIC_SMALL_FAST_MODEL) andANTHROPIC_DEFAULT_SONNET_MODEL— to gateway-supported bare aliases (claude-haiku-4-5,claude-sonnet-4-6). Added aDEFAULT_HAIKU_MODELconstant (bare alias, matching the existingDEFAULT_AGENT_MODELconvention) so the gateway's strict Bedrock lookup matches and the SDK can never reach for a retired snapshot.Test plan
pnpm build && pnpm test && pnpm fix— all 1027 unit tests pass, lint clean.LLM context
Authored by PostHog Code (Claude). Root-caused from the AI-observability error buckets and fixed by pinning the SDK background model env vars.
Created with PostHog Code from an inbox report.