mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-12-04 21:16:05 +00:00
TLDR: On chat-completions api, change the default instruction role from developer to system. Inspired by: #12101 by @qoli --- The trigger was #10741: Groq's qwen/qwen3.8-27b failed on the first message: `400: minijinja: rendering failed: raise_exception: Unexpected message role.` Problem: openai-completions sent the system messages of every reasoning model with the `developer` role unless the catalog turned it off. `developer` is OpenAI's role; many other hosts' chat templates reject it, as Groq's Qwen template does. Every new OpenAI-compatible provider or reasoning model hit the same bug until someone added `supportsDeveloperRole: false` to the catalog; about 20 provider files carried that line. Nothing in models.dev says which role a model accepts, so the catalog could not get this right on its own. Solution: detectCompat() now defaults supportsDeveloperRole to true only for api.openai.com. Every other host gets `system`. This applies to the initial system prompt and to mid-conversation system messages. Built-in models whose role changes from developer to system: - groq: 5 (gpt-oss and Qwen) - xiaomi, xiaomi-token-plan-*: 9 MiMo models - openrouter: 89 openai/* and anthropic/* models; 12 of them (newer GPT models) also support mid-conversation system messages (supportsMidConvoSystemMessages), which change role too All other built-in Chat Completions models already sent `system`. Why the default is only api.openai.com: - api.openai.com keeps `developer` because OpenAI documents it as the role for its reasoning models. In practice this rarely matters: the built-in OpenAI models all use the Responses API, so it only affects custom models that call OpenAI through openai-completions. - Azure is excluded. Its built-in OpenAI models also use the Responses API; its only built-in Chat Completions model is DeepSeek, which needs `system`. - OpenRouter is excluded: its Chat Completions reference accepts `system` ("System message for setting behavior") and `developer` with the same fields, and gives no reason to prefer `developer` for any model (https://openrouter.ai/docs/api/api-reference/chat/create-a-chat-completion). The openai/* and anthropic/* exception came in with #5309 without a reported need. - compat.supportsDeveloperRole still overrides the default. - The Responses API has its own setting and is unchanged. The now-redundant `supportsDeveloperRole: false` lines are removed from the catalog and the llama extension. How we checked it is safe: live requests to the affected hosts, each model given the same instruction once as `developer` and once as `system`: - Groq qwen/qwen3.8-27b: developer 400, system OK. Groq gpt-oss-20b: both OK. - Xiaomi mimo-v2.6-pro and mimo-v2.6-flash: both roles OK. - OpenRouter openai/gpt-5-mini, openai/gpt-oss-20b, anthropic/claude-haiku-4.5, moonshotai/kimi-k2.6, qwen/qwen3.6-plus, deepseek/deepseek-v4-pro: both roles OK. - OpenRouter openai/gpt-5.4-mini and openai/gpt-5.5 with an instruction added mid-conversation: both roles OK. Released clients: they fetch new catalogs from pi.dev and still default supportsDeveloperRole to true, so the removed `false` lines would make them send `developer` to hosts that reject it. MINIMUM_PI_VERSION is raised to 1.5.3 so they keep the last catalog published for them. closes #10741 #12101 |
||
|---|---|---|
| .. | ||
| biome | ||
| agent-treeshake-smoke-entry.ts | ||
| auto-pi.sh | ||
| biome-check.mjs | ||
| browser-smoke-entry.ts | ||
| build-binaries.sh | ||
| build-coding-agent-bundle.mjs | ||
| check-browser-smoke.mjs | ||
| check-entry-graphs.mjs | ||
| check-lockfile-commit.mjs | ||
| check-model-catalog-compat.mjs | ||
| check-package-install.mjs | ||
| check-pinned-deps.mjs | ||
| check-pinned-deps.test.mjs | ||
| check-released-changelogs.mjs | ||
| check-released-changelogs.test.mjs | ||
| check-runtime-deps.mjs | ||
| check-runtime-deps.test.mjs | ||
| check-ts-relative-imports.mjs | ||
| coding-agent-smoke.mjs | ||
| coding-agent-smoke.test.mjs | ||
| cost.ts | ||
| create-source-archive.sh | ||
| diff-model-catalog.mjs | ||
| durable-browser-smoke-entry.ts | ||
| edit-tool-stats.mjs | ||
| generate-coding-agent-install-lock.mjs | ||
| generate-thinking-capabilities.mjs | ||
| local-package-install.mjs | ||
| local-package-install.test.mjs | ||
| local-release.mjs | ||
| model-catalog-minimum-version.mjs | ||
| model-catalog-protocol.test.ts | ||
| model-catalog-protocol.ts | ||
| npm-audit.mjs | ||
| npm-command.mjs | ||
| pack-packages.mjs | ||
| package-artifact-cli.test.mjs | ||
| package-artifacts.mjs | ||
| package-artifacts.test.mjs | ||
| package-files.mjs | ||
| package-files.test.mjs | ||
| package-workspaces.mjs | ||
| preview-packages.mjs | ||
| preview-packages.test.mjs | ||
| profile-coding-agent-node.mjs | ||
| publish-model-catalog.mjs | ||
| publish-model-catalog.test.mjs | ||
| publish-release-announcement.mjs | ||
| publish-release-announcement.test.mjs | ||
| publish.mjs | ||
| read-tool-stats.mjs | ||
| release-notes.mjs | ||
| release-packages.mjs | ||
| release-packages.test.mjs | ||
| release.mjs | ||
| repro-5893-wsl-bash.mjs | ||
| session-context-stats.mjs | ||
| session-transcripts.ts | ||
| smoke-test-codemode-binary.mjs | ||
| stats.ts | ||
| sync-versions.js | ||
| sync-versions.test.mjs | ||
| tool-stats.ts | ||
| update-model-catalog-pin.mjs | ||
| update-model-catalog-pin.test.mjs | ||
| update-source-imports-to-ts.sh | ||
| use-local-packages.mjs | ||