feat: pi (pi.dev) as an officially supported session backend - #132
Conversation
One codeoid session = one warm `pi --mode rpc` subprocess (strict-LF
JSONL). pi's own session file is the backing id — daemon restarts resume
the same pi conversation via switch_session.
- PiProvider (SessionProvider): prompt/steer/follow_up mapping, streaming
text+thinking translation, per-turn usage deltas from session stats,
model switching (provider/model-id), rotation via new_session, model +
command catalogs (get_available_models / get_commands)
- Bridge extension: pi has NO native permission system, so codeoid
injects a pi extension (-e) that routes every pi tool_call through
canUseTool — modes, budgets, session.approve, audit, and patchableKeys
input patches all apply. Missing bridge = turns fail CLOSED; ungated
executions are flagged loudly
- pi extension dialogs (select/confirm/input/editor) route through
requestUserInput → session.ui_request; notify becomes transcript rows
- User exposure: session.create.providerId (fail-closed on unknown ids),
auth.ok advertises registered providers (default first), web
new-session modal grows a backend picker; config providers.pi.{enabled,command}
- Tests run offline against a protocol-faithful fake-pi fixture: text
turns, approval allow/deny + input patching, dialogs, notifications,
catalogs, usage deltas, ungated-tool detection, bridge fail-closed,
missing-binary errors; plus pure translation units and manager/schema
coverage. docs/providers-pi.md documents setup + limitations
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #132 +/- ##
==========================================
+ Coverage 80.15% 80.60% +0.44%
==========================================
Files 90 94 +4
Lines 15587 16215 +628
==========================================
+ Hits 12494 13070 +576
- Misses 3093 3145 +52
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
What
pi becomes codeoid's second first-class backend, riding entirely on the provider extension surface from #131. One codeoid session = one warm
pi --mode rpcsubprocess (strict-LF JSONL); pi keeps its own durable session tree and codeoid resumes it across daemon restarts viaswitch_session. User docs:docs/providers-pi.md.The provider (
src/daemon/providers/pi/)rpc.ts— subprocess + LF-only framing + request correlation (pi explicitly warns against Unicode-separator line splitting), stderr-tail diagnostics, ENOENT and crash surfaced through one failure channeltranslate.ts— pure pi-event →ProviderEventmapping (unit-tested): streaming text/thinking deltas, assistant commits (tool-only rounds skipped), tool completion, retries, extension errors, compaction noticesindex.ts— theSessionProvider: lazy spawn per workdir, model switching (provider/model-idvalues reported through the per-provider catalog), per-turn usage as a delta of pi's cumulative session stats,now/next→ pi steering andlater→ follow-up, rotation vianew_session,listCommands/listModelsfeedingsession.commandsandmodels.listThe approval bridge (
bridge.ts)pi ships no built-in permission system — gating is delegated to extensions by design. codeoid injects its own pi extension (
-e, regenerated per session) that hooks pi'stool_calland routes every tool throughcanUseTool, so modes, autonomous budgets,session.approve, audit logging, andpatchableKeysinput patches all apply to pi sessions identically to Claude ones. Safety posture:pi extensions work end-to-end
Hooks run inside pi unchanged. Extension dialogs (
ctx.ui.select/confirm/input/editor) route throughTurnOpts.requestUserInput→session.ui_request(answered from any attached client);ctx.ui.notifybecomes an info/system row; extension/prompt/skill slash commands surface in the/palette viasession.commands.User exposure
session.creategainsproviderId— fail-closed: an unknown id isinvalid_request, never a silent claude fallback (resume keeps the warn-and-fall-back path)auth.okadvertises the daemon's registeredproviders(default first)providers.pi.{enabled, command}Tests
All offline — a protocol-faithful
fake-pifixture (spawned through a wrapper script) exercises the full pipeline: text turns, approval allow/deny including the input-patch round-trip proven from pi's side, extension dialogs, notifications, catalogs, second-turn usage deltas, ungated-tool detection, bridge fail-closed, and missing-binary errors. Plus pure translation units, registry catalog/disable tests, manager fail-closed +providerIds()ordering, schema fidelity, and web modal picker tests. Suites: 1170 daemon/protocol/core tests + 130 web tests green; tsc, biome, eslint clean.Follow-ups (called out in docs)
codeoid-ui, in-repo Ink) — web-first herectx.ui.custom()TUI components don't cross RPC (pi degrades them itself)🤖 Generated with Claude Code