Skip to content

feat(pi): add T3 MCP, native children, and Extra High advertise - #34

Merged
StiensWout merged 3 commits into
StiensWout:t3code/pi-providerfrom
mwolson:feat/pi-t3-mcp
Aug 17, 2026
Merged

feat(pi): add T3 MCP, native children, and Extra High advertise#34
StiensWout merged 3 commits into
StiensWout:t3code/pi-providerfrom
mwolson:feat/pi-t3-mcp

Conversation

@mwolson

@mwolson mwolson commented Aug 17, 2026

Copy link
Copy Markdown

What Changed

Stacked follow-up to pingdotgg#7211 pi-provider. Three commits, one concern each:

  1. Inject T3's per-session HTTP MCP server into parent Pi RPC sessions through a T3-owned --extension (T3_MCP_URL, T3_MCP_BEARER_TOKEN, mcp-protocol-version: 2025-06-18). delegate_task and t3_thread_* register under their original names.
  2. Replace official subagent (--no-session) with a T3 override that persists --session, reports sessionFile, and binds each task as a resumeable child thread. Follow-up sends open a new RPC and switch_session. Duplicate subagent registrations abort Pi, so spawn uses --no-extensions and strips the official tool.
  3. Advertise thinking levels per model from get_available_models.thinkingLevelMap. Extra High (xhigh) and Max appear only when the map has a non-null entry. get_available_thinking_levels is session-scoped; hopping set_model during catalog discovery is the wrong path.

Why

pingdotgg#7211 pi-provider can drive Pi and project official subagent cards, but it cannot give Pi the T3 orchestration tools, cannot open those cards as child threads, and caps every reasoning model at High. Claude, Codex, and Grok already have those three pieces.

UI Changes

Thinking picker for Pi models that opt into Extra High / Max. No other visual change.

Problem and Fix

Problem and Why it Happened Fix
V2 already minted a scoped t3-code bearer, but Pi core has no MCP client. Write a T3-owned extension and spawn pi --mode rpc --extension with the bearer env.
Official subagent uses --no-session, so T3 could project cards but not open the child. Persist --session, report sessionFile, bind childThreadId, resume on a new RPC.
One High-capped picker made Extra High unselectable even when the model map has xhigh. Derive capabilities from each model's thinkingLevelMap.

Validation

  • Unit: piT3McpInjection.test.ts, Pi adapter spawn/capability tests, piThinkingCapabilities.test.ts (7 tests)
  • Isolated live: pi-t3-mcp PASS (20260816-175131); pi-subagent PASS (20260816-210210) with a bound child and PI_CHILD_FOLLOWUP_OK
  • Nightly AppImage on this stack: Extra High appears on Pi xai/grok-4.6 after reload; picker persist of thinking: xhigh confirmed on later turns

Remaining work to do

Priority order. None of this blocks merging these three commits.

  1. Child first-turn T3 MCP. Parent sessions get delegate_task / t3_thread_*. Child pi --mode json still does not get --extension or T3_MCP_*, so a native child cannot nest T3 tools the way Codex, Claude, and Grok children can.
  2. Re-add non-conflicting discovered Pi extensions after --no-extensions. Still strip official .../extensions/subagent/index.ts. Today plan-mode and similar user extensions disappear unless they are already in launchArgs. Discover via Effect FileSystem; raw node:fs failed the Effect gate.
  3. Overflow then compaction should not fail a recovered turn. On a long S0 implementation turn, xAI returned 400 at 520785 / 500000 tokens. Pi compacted 513444 -> ~3413 and the turn finished (commit, typecheck, review). T3 still terminalized the run as provider_error because message_end stopReason: error set turn.failure and nothing cleared it after a successful compaction. #7211 already clears that flag on auto_retry_end success; compaction recovery needs the same treatment. The red banner above a later user bubble is this leftover failed item, not a failure of that later send.
  4. Mid-flight send into a live child while the parent RPC still hosts the spawn. Pi cannot host two threads on one process. Cards without sessionFile stay childThreadId: null.
  5. Per-child abort, then flip canWaitForSubagents / canCloseSubagents only after a real path exists.
  6. Fork of a child (pi --fork exists; adapter and CommandPolicy refuse today).
  7. T3 system / developer instruction channels. Same shape as Grok: synthetic user only.
  8. Parked: native command/file/apply-patch approval, plan/todo emission, native turn ids, thread snapshots, summary generation, dynamic tool callbacks, pending-request restart.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Pi core has no MCP client. V2 already minted a scoped t3-code bearer
before openSession. This writes a T3-owned extension into the server
cache and spawns pi --mode rpc --extension <that file> with T3_MCP_URL
and T3_MCP_BEARER_TOKEN. Each MCP tool is registered under its original
name. User launchArgs are preserved. The first turn receives the shared
orchestration instructions.
Official subagent uses --no-session, so T3 could project cards but could
not open the child. Inject a T3-owned override that persists --session,
reports sessionFile, and binds each result as a child thread. Follow-up
sends allocate a new RPC and resume with switch_session.

Duplicate subagent registrations abort Pi, so spawn disables extension
discovery and drops the official tool from launchArgs.
Pi discovery used one High-capped picker for every reasoning model.
get_available_thinking_levels is session-scoped, so catalog discovery
now reads each get_available_models thinkingLevelMap instead. Extra
High and Max appear only when the map has a non-null entry.
@github-actions github-actions Bot added size:XXL vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 17, 2026
@StiensWout
StiensWout merged commit fffc779 into StiensWout:t3code/pi-provider Aug 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants