Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add Pi coding-agent provider #3818

Closedahmadaccino(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/3818/headopened View on GitHub

Summary

  • Adds Pi (@earendil-works/pi-coding-agent) as a selectable coding-agent provider, alongside Codex / Claude / Cursor / Grok / OpenCode.
  • Integrates via Pi's native pi --mode rpc JSONL protocol over the shared Effect ChildProcessSpawner. The Pi package is a types-only devDependency — the user's installed pi binary is the runtime, so nothing heavy is bundled.
  • Disabled by default and gated behind the normal provider settings — no behavior change for anyone who doesn't enable Pi.
  • Mirrors the existing providers' structure end-to-end (driver / adapter / provider snapshot / text generation / web settings) so Pi stays consistent and low-surprise — it is not a special case.

What's included

Server (apps/server)

  • PiRpcClient — typed JSONL transport over ChildProcessSpawner (stdin-writer + stdout-reader fibers, request/response correlation, scoped teardown) plus pure, unit-tested parse/extract helpers.
  • PiAdapter — per-thread sessions, text_delta streaming, tool lifecycle, finalize on agent_end, mid-turn steer, image attachments, in-session model switch + thinking level, and fork-based rollback. Emits the same canonical runtime events as the other adapters (including thread.started for projection parity, and exitKind: "error" on unexpected exit).
  • Tool-approval gate driven by runtimeMode (like Claude/Cursor): a bundled, default-deny Pi extension is injected via --extension and verified with a get_commands load handshake (fail-closed), bridging Pi's extension_ui requests to the canonical approval / user-input events.
  • PiProvider — pi --version probe, live model discovery (get_available_models), and a models-based auth verdict (mirrors OpenCode).
  • PiTextGeneration — stateless RPC + get_last_assistant_text, reusing the shared JSON extractor.

Contracts & web

  • PiSettings + driver-kind wiring; pi.rpc.* runtime raw sources.
  • Pi surfaced in provider settings, the model picker, and icons — identical wiring to the other drivers.

Docs

  • Adds docs/providers/pi.md; lists Pi (and Grok) in the README.

Testing

  • Rebased onto current main (6154b46cb) and revalidated with vp check and vp run typecheck.
  • 87 focused Pi/provider contract tests pass after the rebase.
  • Original full validation: vp test across server, contracts, and web, including the new Pi unit and integration suites.
  • Live-validated against a real pi install: session lifecycle, mid-turn steer, model/thinking switch, fork rollback, and the tool-approval round-trip (default-deny gate blocking bash).
  • Not run: vp run lint:mobile (no native mobile changes).

Notes

  • Early Access; disabled by default. Written in idiomatic effect-smol style (named Effect.fn, scoped fibers, Schema.TaggedErrorClass, no escape hatches) and reviewed for consistency with the existing providers.
  • Updated for the current provider-model settings and background-policy APIs after rebasing onto the latest upstream architecture.
  • Consolidates the earlier community attempts (#2748, #2800, #2831, #2856, #2812) into a single consistency-first implementation.

Note

Medium Risk Large new subprocess and tool-approval path, but it mirrors existing providers, defaults off, and fails closed when the approval gate cannot load.

Overview Adds Pi as a first-class, disabled-by-default coding-agent provider wired like Codex/Claude/Cursor: driver, adapter, health/model snapshot, text generation, contracts, settings UI, and docs.

The server talks to the user’s pi --mode rpc process over a new JSONL RPC transport, mapping Pi events into the shared runtime model (streaming, tools, approvals, user prompts, model/thinking switches, fork-based rollback). Tool approval loads a bundled Pi extension at build time and refuses to start gated sessions unless the extension registers its sentinel command. Pi is removed from the “coming soon” add-provider list and promoted to the live picker (Early Access).

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ab7cefab2eae180d0ef88963561ec65d04a4388a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add Pi coding-agent as a provider with RPC adapter, text generation, and tool approval gate

  • Adds a full Pi provider integration: settings schema, driver registration, UI icons, and model discovery via a short-lived pi --mode rpc session.
  • Introduces PiAdapter that manages per-thread RPC sessions, streams assistant/reasoning events, and bridges tool approval and user-input requests via Pi's extension-ui protocol.
  • Introduces PiTextGeneration that prompts the Pi CLI in RPC mode and returns schema-validated, sanitized commit messages, PR content, branch names, and thread titles.
  • Bundles a t3-approvals Pi extension that blocks tool calls by default and requires explicit user confirmation unless T3_PI_APPROVAL_MODE=auto-accept-edits.
  • For the pi provider, resolveModelSlug returns an empty string instead of falling back to a default model, since available models are discovered live per account.
  • Risk: the Pi CLI binary must be installed and accessible; missing binary reports a distinct "not installed" status rather than a generic error.
Macroscope summarized ab7cefa.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: a613f2cf-319d-4d4a-bd8d-c4c7e409b6a4

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      4 blocking correctness issues found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Effect service conventions: two issues in the new PiTextGeneration.ts. Both have a canonical precedent in the same directory (OpenCodeTextGeneration.ts).

      Posted via Macroscope — Effect Service Conventions

Sign in to join this conversation.