Conversation
pi sends the system prompt as a developer message on a reasoning model, and the gateway refuses a caller message at that rank while an operator prompt applies. The gateway model spec now declares supportsDeveloperRole: false, so both transports send `system` and the wizard keeps its instructions one rank below the operator prompt. Generated-By: PostHog Desktop Task-Id: 3cd2649f-0bee-4b78-a698-9309de41961c
Generated-By: PostHog Desktop Task-Id: 3cd2649f-0bee-4b78-a698-9309de41961c
🧙 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
Test against a Context Mill branch:
Add 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.
Must merge with PostHog/ai-gateway#455
This PR and ai-gateway#455 are one change in two repositories. Neither is complete alone.
developerrole while an operator prompt applies.Order: this PR merges and ships in a released wizard before
AI_GATEWAY_PROMPT_POLICY_ENABLEDis turned on for a deploy that serves wizard tokens. The policy is off by default, so merging #455 alone changes nothing in the field. Enabling it while an older wizard is in use would answer 400 to every OpenAI-model run.Why
On reasoning models the
developerrole supersedes an earliersystemmessage. A caller message at that rank therefore outranks the gateway's spliced operator prompt, which is the bypass the gateway now refuses.pi picks the role from the model spec: the Responses provider sends the system prompt as
developerwhenevermodel.reasoningis true and the spec does not say otherwise. Everyopenai/*wizard model is a reasoning model and runs over the Responses transport, so today the wizard sends exactly the message the gateway is about to refuse.The denial is deliberately indistinguishable from a malformed body: a bare 400, no reason, nothing that names a policy. The wizard therefore cannot classify it after the fact, and cannot give the user a useful message. The defence has to be preventive.
What is here
buildGatewayModeldeclarescompat: { supportsDeveloperRole: false }, so pi sends the wizard's instructions assystemon both the Responses and Messages transports. The wizard keeps its instructions; they sit one rank below the operator prompt, which is the intended hierarchy.wizard-developmentskill records the rule: the operator rank belongs to the gateway, and the guard is the model spec plus its test rather than error handling.Still planned in this draft
developerrole, instead of asserting the spec field. That survives a pi refactor which renames the compat key; the current test does not.triage-provider.ts, which builds a model throughbuildGatewayModeland callscompleteSimple.supportsDeveloperRoleis pi's contract, not ours, and a rename there is silent.Verification
vitest run src/lib/agent/runner/harness/pi/__tests__/gateway.test.ts: 18 passed.X-PostHog-Prompt-Policyset and no 400 at admission.Created with PostHog Desktop