Repository navigation
Route Pi models to compatible inference APIs - #65877
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Lean already. Ship.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills... |
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
@copilot add logging |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed for PR #65877: no 'implementation' label and 0 new lines in business logic directories (2 files changed, threshold 100, no custom .design-gate.yml).
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Preflight incorrectly rejects valid model aliases and skips Google/Gemini endpoint validation.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds Pi preflight model validation and model-specific API routing using AWF reflection and catalog metadata.
Changes:
- Rejects unavailable models before Pi starts.
- Routes Responses-only models correctly and rejects incompatible overrides.
- Adds focused unit and integration tests.
| File | Description |
|---|---|
actions/setup/js/pi_models_json.cjs |
Implements availability validation and API selection. |
actions/setup/js/pi_models_json.test.cjs |
Tests routing and preflight failures. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| const normalizedProvider = normalizeReflectProviderName(provider); | ||
| const aliases = REFLECT_PROVIDER_ALIASES[normalizedProvider] || new Set([normalizedProvider]); | ||
| const endpoint = reflectData.endpoints?.find(endpoint => endpoint?.configured === true && aliases.has(normalizeReflectProviderName(endpoint.provider))); | ||
| if (!endpoint || !Array.isArray(endpoint.models)) return; |
There was a problem hiding this comment.
Added the canonical google/gemini aliases and a preflight test for Google models advertised by a Gemini endpoint. Committed as 9044112.
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Request changes
The new preflight checks are headed in the right direction, but the API-selection fallback still regresses stale-catalog cases: a new Copilot GPT/Responses-only model will silently drop back to openai-completions whenever models.json has not caught up yet.
Blocking theme
resolvePiApiForModel()now treats the local catalog as the only source of Responses-vs-Completions truth for GitHub models.- This repo already has code paths that operate with a missing or stale merged catalog, and those paths need the same GPT-5+ wire-API heuristic the rest of the harness uses.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 56.5 AIC · ⌖ 8.47 AIC · ⊞ 19.2K
Comment /review to run again
| throw new Error(`Pi model "${modelId}" requires the OpenAI Responses API, but engine.config.model.api is "${overrideApi}"`); | ||
| } | ||
| if (requiresResponses) return "openai-responses"; | ||
| return overrideApi || model?.api || resolvePiApiForProvider(provider); |
There was a problem hiding this comment.
This fallback regresses Copilot GPT-5+ models to openai-completions whenever models.json is missing or stale, so new Responses-only models will still boot Pi against the wrong endpoint and fail before safe outputs.
💡 Why this blocks merge
loadModelsJson() is explicitly allowed to return the bundled catalog or null when the merged catalog artifact is absent, and runtime.getModel() does not guarantee an api field for Copilot entries. In that common stale-catalog path, wireApi is empty here and line 199 falls back to resolvePiApiForProvider("github"), which hard-codes openai-completions.
That means the first newly-added GPT-5+/Responses-only Copilot model will still be misrouted unless the local catalog has already been updated, which is exactly the failure mode this PR is trying to eliminate. Please reuse the existing GPT heuristic/shared wire-API inference (inferWireApiForModel / applyCopilotWireAPI) instead of defaulting GitHub models straight to completions when the catalog lookup misses.
Suggested shape:
const inferredWireApi = inferWireApiForModel("openai", modelId, catalogEntry);
if (inferredWireApi === "responses") return "openai-responses";
if (inferredWireApi === "completions") return "openai-completions";There was a problem hiding this comment.
Pi now uses the shared wire-API inference helper for Copilot models, so GPT-5+ still selects Responses when the catalog is missing or stale; added coverage for both cases. Committed as 9044112.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added secret-safe diagnostics for reflected model availability checks and API selection, with tests. Committed as |
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 2ec0610
|
|
🎉 This pull request is included in a new release. Release: |

Pi workflows can fail before producing safe outputs when a selected model is unavailable through the configured proxy endpoint or requires the Responses API instead of chat completions.
engine.config.model.apioverrides.For example, a reflected Copilot model with
wire_api: "responses"is registered in Pi’s generatedmodels.jsonas:{ "api": "openai-responses", "models": [{ "id": "gpt-5.5" }] }