feat(server): add Pi Agent provider - #9648
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces a large, cross-cutting Pi Agent capability with new production RPC/session behavior, runtime-mode reconciliation, usage metering, and user-facing web/mobile changes. It also changes product defaults and adds static-analysis diagnostic suppressions, so the scope and policy requirements call for human review. You can add or adjust custom eligibility rules. Learn more. |
|
Confirmed the actionable review findings on commit 8d40233:
I will add focused regression coverage for each change. I also checked the filtered relative-directory documentation finding: the driver already resolves configured relative Pi paths against the server working directory before creating sessions, and its focused test covers that invariant. Generated by GPT-5.6 Sol through the Codex harness. |
Generated by GPT-5.6 Sol through the Codex harness.
Address review findings around interruption settlement, runtime-mode reconciliation, lock cleanup, skill parsing, and catalog discovery failures. Add focused regressions across server, web, mobile, and shared runtime paths.\n\nGenerated by GPT-5.6 Sol through the Codex harness.
8d40233 to
e316d64
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e316d64. Configure here.
Remove the shadowed abort branch, validate RPC model state, keep cumulative tool output bounded, align empty runtime capabilities with their fallback, and make the process-exit fixture flush reliably.\n\nGenerated by GPT-5.6 Sol through the Codex harness.
|
Follow-up review fixes are pushed in Focused follow-up verification: 91 tests and targeted server, mobile, and client-runtime typechecks passed. Generated by GPT-5.6 Sol through the Codex harness. |

What Changed
piAgentprovider using Pi’s official RPC mode.$skill discovery and RPC-native extension dialogs across web and mobile.Intentional limitations
ctx.ui.customwidgets cannot render over RPC.Why
T3 Code already included a disabled Pi Agent entry, but users could not run their existing Pi installations through T3. Using Pi’s official RPC mode keeps the integration at the provider boundary and preserves the user’s existing Pi configuration without embedding the Pi SDK into the server.
The integration was exercised with real Pi models, custom skills, custom tools, web search, interruption, compaction, session resume, project generation, and usage reconciliation.
Review fixes
The first review round identified lifecycle and state-reconciliation edge cases. The follow-up commit:
A second review follow-up removes the shadowed abort arm, validates malformed Pi model state, keeps retained tool output bounded after truncation, makes the exit fixture flush reliably, and keeps an explicit empty runtime-capability fallback visible.
Post-rebase verification: 228 focused tests passed across Pi RPC, adapter, provider, skill dispatch, orchestration, shared runtime, web/mobile model state, and mobile outbox behavior. Targeted server, web, mobile, and client-runtime typechecks passed. An isolated browser pass confirmed that switching a Codex draft from Auto to Pi immediately reconciles it to Full access and leaves Full access as the only runtime choice.
UI Changes
Before, Pi Agent was unavailable as a usable provider. After this change, users can configure Pi Agent, select dynamically discovered models and thinking levels, invoke Pi skills with
$, inspect tool activity, and view Pi usage.Open screenshots and recordings
Provider models and reasoning controls
Pi Agent provider and model surface
Completed Pi/Sol project-generation turn
Progress narration and configured web search
Usage provider and model breakdown
Usage with Terra and Luna sessions
Manual skills discovered through
$Completed custom-skill audit
Pi/Sol web-search test — 5× speed
browser-recording-mtmrh0o3-5x.mp4
Pi Tool Lab interaction
browser-recording-mtmrrv7c.webm
Fishslop gameplay and restart
browser-recording-mtmrwn0z.webm
Custom
ask_userfallback and resumed turnbrowser-recording-mtmsbyqm.webm
Native manual-skill dispatch
browser-recording-mtmtp4ec.webm
$html-communicatoraudit — 5× speedbrowser-recording-mtmuakkn-5x.webm
Changed-files card — 5× speed
browser-recording-mtmujkay-5x.webm
Checklist
Generated by GPT-5.6 Sol through the Codex harness.
Note
High Risk
Introduces a large new provider driver/RPC path and changes orchestration turn-start/runtime-mode ordering; Pi is limited to full-access at the adapter boundary, but incorrect reconciliation could still send wrong modes to other providers.
Overview
Adds an Early Access Pi Agent provider that talks to a user-managed Pi binary over official RPC, including catalog discovery, session resume, streaming turns, steering/interrupts, extension UI dialogs, and composer
$skill→/skill:namedispatch.Runtime mode is now reconciled against each provider’s
supportedRuntimeModeson mobile (new-task flow, thread composer, settings sheet, outbox drain, and turn start) and at dispatch; the thread settings UI only offers filtered runtime choices. The orchestration decider persists a reconciledruntimeModeviathread.runtime-mode.setbeforethread.turn.startwhen it differs from the thread snapshot, and turn-start events use the command’s mode instead of the stale thread value.Mobile also gains a Pi Agent icon, usage chart series for
pi, and model options that carry provider runtime capabilities. Codex model picker labels re-attach reasoning effort from slugs when the backend strips it from display names.Reviewed by Cursor Bugbot for commit ac926b3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
PiAgentDriverand provider integration across web and mobilePiAgentDriver,PiAgentAdapter, andPiAgentProviderto manage Pi RPC sessions, catalog discovery, and status checks. Pi Agent is disabled by default.PiSettingsto server contracts, including binary path, agent directory, and session directory configuration.piprovider kind to the usage contract.supported-runtime-modestoServerProviderand introduces runtime-mode reconciliation across mobile, web, and server to filter unsupported modes and replace them with the safest supported mode.fallbackTextGenerationProviderin serverSettings.ts skips Pi Agent, so enabling Pi Agent alone no longer selects it as the text-generation fallback. Runtime-mode reconciliation writes corrected modes back to existing composer drafts.Macroscope summarized ac926b3.