Skip to content

fix(server): allow explicit Pi models before discovery - #37058

Open
chrisblaschke wants to merge 3 commits into
pingdotgg:mainfrom
chrisblaschke:fix/pi-model-validation-before-discovery
Open

chrisblaschke wants to merge 3 commits into
pingdotgg:mainfrom
chrisblaschke:fix/pi-model-validation-before-discovery

Conversation

@chrisblaschke

Copy link
Copy Markdown
Contributor

Problem

MCP rejects an explicit Pi model with model_unavailable while Pi's inventory is still unknown and contains only default and optional custom models. It should defer validation to Pi, as it already does for empty inventories.

Reproduce on main with a subprocess fixture:

  1. Use a Pi executable that prints pi 1.1.0 for --version and exits 1 for RPC discovery.
  2. Call checkPiProviderStatus. It returns ready, unknown auth, and only default.
  3. Pass that snapshot to requireAdvertisedModel with anthropic/claude-opus. It rejects the model before Pi can validate it.

Change

Treat Pi's placeholder inventory like an empty inventory only while auth is unknown and no discovered model exists. Keep strict validation after discovery or a known auth result, and leave other providers unchanged.

Scope

This is a two-file fix to the existing validator with six regression cases, so it uses the small, obvious bug-fix exception without a separate issue. #28557 fixes one discovery failure; this covers validation when discovery still fails.

Verification

On main 015eba4083974f8ed86694a8770a4311d8a4714b, the regression cases produced 3 failures and 3 passes. With the fix, all 6 passed. The subprocess fixture changed from model_unavailable to accepted with the same fallback snapshot.

Both focused files passed: 94 tests in OrchestratorMcpService.test.ts and 21 in Pi's status.test.ts. Server typecheck, lint and the two-file format check passed. check:changed also passed.

The previous full server-suite run on macOS had 15 failures outside the changed file: 14 also failed on unmodified main, and one timeout passed in isolation; I did not rerun the full suite. No real Pi login, UI flow, or paid turn was exercised.

Created with GPT-6.1 Sol in Pi via T3 Code.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T05:59:22.781197Z 19822fa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 15, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 19822fa

Macroscope's review found this PR approvable — Explicit Pi model requests can proceed before model discovery completes, while discovered inventories retain validation. Default model selection and provider availability checks remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

requireAdvertisedModel now accepts unadvertised slugs for empty inventories and for Pi providers with unknown authentication when no non-custom model has a subProvider. Tests cover these cases and rejection cases.

Changes: Pi model resolution

Layer / File(s) Summary
Pi provider acceptance rule
apps/server/src/mcp/OrchestratorMcpService.ts, apps/server/src/mcp/OrchestratorMcpService.test.ts
requireAdvertisedModel permits unadvertised slugs for qualifying Pi providers. Tests cover acceptance before discovery and rejection after discovery, for unauthenticated Pi, and for another provider.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, only21mil

Merge Risk: Minimal · up to 24daf

Explicit Pi models are now accepted before model discovery, and validation stays strict after discovery or once authentication is known. The change is narrow, other providers are unaffected, and it is covered by tests, so no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): allow explicit Pi models before discovery" names the main change: MCP now accepts explicit Pi model slugs while Pi's placeholder inventory is unknown. It matches the raw summar…
Description check Passed The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section gives the expected behavior and reproduction steps. The Change section explains the …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(server): allow explicit Pi models before discovery" names the main change: MCP now accepts explicit Pi model slugs while Pi's placeholder inventory is unknown. It matches the raw summary, which describes the requireAdvertisedModel change for Pi with unknown auth, and the PR objectives. It uses a conventional commit format and is 54 characters long.

Full details: Description check

Explanation

The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section gives the expected behavior and reproduction steps. The Change section explains the fix and limits it to Pi unknown-auth placeholder inventories. The Scope section explains why no issue is linked, and the Verification section gives focused test results and states what was not checked. The description does not link an issue, but it gives a reason for omitting one, as the template allows for small obvious bug fixes. The template's agent-model line is present as an attribution sentence ("Created with GPT-6.1 Sol in Pi via T3 Code."), so that item is covered too.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 19822fa and 24dafe0.

Files selected for processing: 1

  • apps/server/src/mcp/OrchestratorMcpService.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 15, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

With discovery failing and only Pi default advertised, submitted identical requests to delegate once to Pi using anthropic/claude-haiku-5-5. Base rejected the model before launch; head ran the child successfully and returned hello.

Environment: Linux, Chromium web client, dark theme, 1440×1000 CSS viewport, fresh isolated databases and synthetic project data. Real Pi agents; discovery failure induced by a wrapper, matching the triage caveat.

Before After
Before: model_unavailable against placeholder inventory After: explicit Pi model completed with hello
fbfebc8537 24dafe03db
Before recording · Raw tool result After recording · Raw tool result

Reproduction instructions · Seed script · Discovery wrapper · Exact prompt · Runtime extraction script

Recordings trim only idle footage after completion. Proof prepared by GPT-6.1 Sol through Codex.

Not shown:

  • A genuine interactive Pi startup prompt was not exercised; discovery failure was induced by the same kind of wrapper used during triage.
  • The scenario runner was not used because its documented exclusions include provider-specific behavior; this proof uses real Pi sessions.

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants