fix(llm-gateway): say a gated model is unavailable, not an auth failure - #2
Draft
evanmarshall wants to merge 1 commit into
Draft
fix(llm-gateway): say a gated model is unavailable, not an auth failure#2evanmarshall wants to merge 1 commit into
evanmarshall wants to merge 1 commit into
Conversation
A model behind a rollout flag was denied with the free-tier gate's wording and its "(rate_limit)" compat suffix, so Desktop could not tell the denial apart from a generic failure and offered a payment method for something no payment unlocks. - The flag denial now carries reason="model_not_available" and drops the "(rate_limit)" suffix, which only ever belonged to the free-tier shim. - The Desktop classifier reads the structured code and reason instead of matching free-tier wording, and routes a rollout gate to its own prompt. - The model listing drops models whose access flag the caller does not hold, so a picker no longer offers a model every request will reject. Generated-By: PostHog Desktop Task-Id: 68fea8bf-f61a-4194-a8ef-b022767ecb29
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.
This is an Ito QA mirror of PostHog#93611.
Original author: @PostHog[bot]
Pinned upstream head: e1cb533
This draft is for QA and build-environment experimentation and will not be merged.
Problem
code: "model_gate"(rate_limit)allowed: true(rate_limit)suffix is a documented compat shim for the free-tier gate. The rollout gate copied it, and a rollout flag never clears on a retry.Changes
reason, and no longer wears the free-tier shim:code: "model_gate"stays on that body, so builds that read only the code keep reaching a model prompt rather than session teardown.model_unavailablecause threads through the limit copy, the failure title, and the analytics cause union.Why drop the model from the listing instead of marking it
allowed: falseallowed: falsealready exists for the free-tier gate, and a marked model renders as a locked upsell row. That is right when a payment method unlocks it. A rollout flag has no user action behind it, so the row would be a dead end.How did you test this code?
Automated only — the agent did not run the desktop app or reproduce the banner.
services/llm-gateway: full suite passes. New cases pin that the rollout denial carriesreasonand no(rate_limit)suffix, and that a flag-gated model is listed only when its flag returns true (off and unavailable both drop it).@posthog/shared,@posthog/core,@posthog/ui: suites pass. New cases pin classification from the structuredcode/reason, and that the wrapped "Internal error: … 403" body is not treated as a fatal session error.@posthog/agentfails 312 tests on this branch and the same 312 onmaster— pre-existing, unrelated.shared,core,ui,agent.ruff checkandruff formatclean.Automatic notifications
Docs update
None — error-body shape and in-app copy.
🤖 Agent context
Autonomy: Fully autonomous
AGENTS.mddirectly.model_gatecause on the client. That was rejected once the copy behind it turned out to be a billing upsell: routing a rollout gate there would tell users to add a payment method for a model no payment unlocks. Hence the separatemodel_unavailablecause, withcode: "model_gate"retained on the wire for older builds.Created with PostHog Desktop from this inbox report.