Skip to content

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

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

chrisblaschke wants to merge 6 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 →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Pi provider status now marks model inventories as incomplete when discovery fails or times out. The server contract exposes this state, and model validation uses it to decide whether to accept an explicit model slug that is not listed.

Changes: Model inventory completeness

Layer / File(s) Summary
Report incomplete model inventories
packages/contracts/src/server.ts, packages/provider-pi/src/server/status.ts, packages/provider-pi/src/server/status.test.ts
ServerProvider adds the optional modelsIncomplete field. Pi fallback statuses set it to true after discovery failure or timeout. A test verifies the discovery-failure case.
Allow explicit slugs for incomplete inventories
apps/server/src/mcp/OrchestratorMcpService.ts, apps/server/src/mcp/OrchestratorMcpService.test.ts
requireAdvertisedModel accepts an unlisted slug when modelsIncomplete is true. A parameterized test checks acceptance for an incomplete inventory and rejection for a complete inventory.

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to be3e0

Pi now accepts an explicitly requested model when model discovery fails, and validation stays strict once discovery succeeds. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server now accepts explicit Pi models before discovery completes. It follows the conventional commit form and matches the raw summary and objectives, which describ…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a reproduction path. The Change section explains the narrow scope, and the Sco…
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 names the main change: the server now accepts explicit Pi models before discovery completes. It follows the conventional commit form and matches the raw summary and objectives, which describe the requireAdvertisedModel change for Pi placeholder inventories.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a reproduction path. The Change section explains the narrow scope, and the Scope section justifies the absence of an issue. Verification lists focused test counts, the before and after results, and what was not checked. The template asks for the model and harness used, and the author gives 'GPT-6.1 Sol in Pi via T3 Code'. The description does not fully match the template, but it is mostly complete.

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 d87da02 and be3e023.

Files selected for processing: 5

  • apps/server/src/mcp/OrchestratorMcpService.test.ts
  • apps/server/src/mcp/OrchestratorMcpService.ts
  • packages/contracts/src/server.ts
  • packages/provider-pi/src/server/status.test.ts
  • packages/provider-pi/src/server/status.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
@github-actions

Copy link
Copy Markdown
Contributor

This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

See the conflict window.

@github-actions github-actions Bot added the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Nov 16, 2026
@github-actions github-actions Bot removed the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Nov 17, 2026
@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:needs-julius Takeover done; route gate says Julius decides labels Nov 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

someone else pushed to fix/pi-model-validation-before-discovery (head is now fa65721); the pipeline does not build on commits it did not review

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:ready Takeover done; auto-lands when gates pass labels Nov 19, 2026
@chrisblaschke

Copy link
Copy Markdown
Contributor Author

The extra commit (fa65721) is mine. The bot flagged a conflict, so I merged main.

One conflict, in requireAdvertisedModel in apps/server/src/mcp/OrchestratorMcpService.ts. Main rewrote it with early returns and the update-required check, so I moved the Pi condition into the new shape. Same condition and same test file as 24dafe0, and CI passed on the merge.

If it's easier for your pipeline, reset to 24dafe0 and redo the merge. Thanks!

@juliusmarminge juliusmarminge added takeover:in-progress A takeover lead is working on this PR and removed takeover:blocked Takeover blocked; reason in the PR body labels Nov 23, 2026
…on-before-discovery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the fix/pi-model-validation-before-discovery branch from 95084ff to d87da02 Compare November 23, 2026 10:39
Pi marks its discovery-failure snapshots with modelsIncomplete, and the MCP
model validator reads that declaration rather than branching on the driver
name and the inventory's shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real Linux web app, Chrome 1440×1000, light theme, Pi 1.6.0, fresh synthetic state on each commit. Induce Pi discovery failure with the same wrapper; confirm Pi remains Available with only Pi default advertised. Ask a Pi/default parent to call orchestrator_capabilities, then delegate_task targeting pi / anthropic/claude-haiku-5-5 with task Reply with exactly hello, mode wait. Repeat through the composer while recording.

Before After
Before: explicit model rejected After: Pi child returns hello
977b7c7932: model_unavailable; no child launched. be3e023982: completed; executedModel matches the requested model; summary hello.
Before recording After recording

Reproduction script · Discovery wrapper · Base tool transcript · Head tool transcript.

Direct Pi CLI control also returned hello for the explicit model. Discovery failure was induced by the wrapper, matching the triage approach.

Not shown:

  • Natural interactive Pi discovery failures were not exercised; discovery failure was induced by the wrapper, matching triage.

@juliusmarminge juliusmarminge added the takeover:needs-julius Takeover done; route gate says Julius decides label Nov 23, 2026
@juliusmarminge juliusmarminge removed the takeover:in-progress A takeover lead is working on this PR label Nov 23, 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