feat(providers): add Pi coding agent - #7211
Open
StiensWout wants to merge 262 commits into
Open
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
- Document the target orchestration graph, IDs, lifecycles, and capability model - Add Codex app-server probe fixtures and update the probe test harness
- Introduce orchestration v2 service interfaces and error types - Add replay runtime, fixtures, and integration coverage - Update shared contracts and probe transcripts Co-authored-by: codex <codex@users.noreply.github.com>
- Add Codex adapter and replay harness wiring - Introduce in-memory orchestration projections and provider registry - Expand orchestration contracts for turn and runtime events
Co-authored-by: codex <codex@users.noreply.github.com>
- Add context transfer IDs, schemas, and projections - Support cheap fork creation and Codex native fork rollback - Cover fork idempotency and replay behavior in tests
- Track remaining projection, context transfer, rollback, capability, and subagent work - Clarify current V2 baseline and debugger-only follow-ups
- Map fork and merge-back turns into stored handoffs and transfer resolutions - Add shell snapshot projection support plus coverage tests - Update replay fixtures and web contracts for the new turn flow
Co-authored-by: codex <codex@users.noreply.github.com>
- Move Codex replay recording into `apps/server` - Add Claude Agent SDK replay fixtures and test harness - Update orchestration-v2 fixture scenarios and docs
- Move Claude provider runtime logic into its own module - Share the SDK query runner between live and replay paths - Add replay driver error wrapping for unexpected failures
- persist the selected model on run records - surface run model selection in the debug UI - update replay fixtures and contracts for the new field
- Record Claude SDK transcripts across multiple prompts and restart/query modes - Add approval and tool-call replay coverage for new orchestration fixtures - Update Claude adapter testkit to model open/prompt/permission frames
- Derive Claude SDK query options from runtime policy - Add read-only replay fixture and policy mapping tests - Reuse shared approval-policy fixtures across orchestrator tests Co-authored-by: codex <codex@users.noreply.github.com>
- add active steering and interrupt-restart replay fixtures - update Claude adapter/orchestrator turn handling for steering - refresh replay and integration test coverage
- add interrupt and mid-tool replay fixtures for Claude and Codex - log Claude Agent SDK protocol frames to native event traces - project Codex commandExecution start events into orchestration updates
- Map Cursor SDK agents and runs to V2 thread and turn lifecycles - Update MCP capability, tool, and testing guidance for SDK-based injection
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Record provider fixtures for continued forks and sibling merge-backs, exercise context survival end to end, and stop completed run listeners from consuming later provider events. Co-authored-by: codex <codex@users.noreply.github.com>
Allow a pending merge-back to be consumed while changing providers and deliver both the provider-switch history and fork delta to the selected provider. Co-authored-by: codex <codex@users.noreply.github.com>
Send full canonical target-thread context when a provider switch consumes a merge-back, and cover returning to an existing provider thread after a cross-provider fork. Co-authored-by: codex <codex@users.noreply.github.com>
- Require operate scope for v2 command dispatch - Allow read scope for v2 thread and shell subscriptions
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
- Register orchestration tools on the MCP HTTP server - Grant orchestration capability to MCP sessions - Add service and integration coverage for delegated tasks and thread creation
- Wire Cursor adapter and provider session handling into orchestration v2 - Add replay fixtures, recording script, and coverage for Cursor turn flows - Update docs and debug timeline mapping for Cursor events
- split streaming assistant and reasoning output into separate segments - filter hidden interruption artifacts from projections and replay fixtures - keep visible timeline positions stable when upserting streamed items
Stop aborts pi's in-flight tools, which pi reports as tool_execution_end with isError. Mapping every error end to failed painted a red failed command card under a correctly interrupted run. Error ends on an interrupted turn now close as interrupted, and aborted subagent tasks follow the same rule, matching how OpenCode presents the same path. Reported from the provider manual live-test pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Five spec-fidelity fixes against pi's rpc.md: - a session_before_switch extension veto now fails the resume instead of silently adopting whichever session stayed active - failed compactions surface as a failed compaction item with the error instead of disappearing - empty input/editor dialog answers deliver as values (the spec's 'extension receives ""'), no longer converted to cancels - editor dialogs show their prefill inside the question text so the user is not editing blind - text generation passes --no-extensions so an unanswerable extension dialog cannot stall commit-message generation until its timeout Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
StiensWout
force-pushed
the
t3code/pi-provider
branch
from
August 16, 2026 17:49
7c18cde to
f8c8600
Compare
Six review findings from the protocol-gap round: - A recovered auto-retry no longer terminalizes as failed. Pi emits the erroring `message_end` before retrying, and `auto_retry_end` success left that failure in place, so `agent_settled` failed the whole turn. - A failed `prompt` send finalizes the turn again. The fire-and-forget change moved the send off `request`, dropping the cleanup, so a send failure left `activeTurn` set and wedged every later turn. - `startTurn` now holds the session permit, so a new turn cannot start while the previous `finalizeTurn` is still awaiting `get_entries`. That race let the old finalizer capture the new turn's entry and publish idle after the new turn had already published active. - `switch_session` clears the model and thinking baselines too, so "Pi default"/"inherit" cannot replay the previous session's defaults. - Termination re-checks liveness before SIGTERM and before escalating to SIGKILL. Signalling a pid that already exited can hit an unrelated process once the OS recycles the pid or pgid. - Windows tears down the whole tree with `taskkill /T`, matching `AcpSessionRuntime`. `process.kill` reached only pi itself and left extension subprocesses holding inherited stdio handles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Capability rejections surfaced their internal diagnostic string, so a
checkpoint revert on a provider without rollback support showed 'pi
cannot satisfy rollback_snapshot for command <uuid>: rollback must
return a providerInstanceId thread snapshot'. userFacingDispatchErrorMessage
now renders known policy rejections as provider-named prose ('Pi did not
report its rewound conversation state, so the checkpoint was not
restored.') and keeps the diagnostic form for logs and unknown codes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
4 tasks
…3 tools The T3 subagent override spawns pi with --no-extensions, which silently cost users every other extension they had installed. Re-discover the user's extensions (agent dir, plus project .pi/extensions only under standing trust) and re-add them with explicit --extension flags. Child subagent spawns now also attach the T3 MCP extension so t3_thread_* tools survive the nested spawn. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closes the remaining coverage gaps against pi's RPC surface: - forkThread clones pi's session tree and switches the live process back to the source, so T3-side thread forks map to native clones. - readThreadSnapshot reconstructs the conversation from get_entries, giving handoff and preview surfaces a real transcript. - setStatus/setWidget extension calls project as keyed live work-log rows that update in place and close on settle. - Session-start extension dialogs (e.g. project trust) are buffered and attached to the next turn instead of being cancelled unseen. - Stop-with-restart aborts the turn and terminates the pi process, and transport death during an interrupt reads as interrupted, not failed. - A recovered auto-compaction clears the stashed model error so the turn completes instead of reporting the pre-compaction failure. - Opening a subagent's child thread while its task is still running is refused with a clear message instead of corrupting the child session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Prepending T3 orchestration instructions to the first user message meant the message no longer started with "/", so pi never expanded slash commands (extension commands, prompt templates, skills) on a thread's first turn. Found live: /t3-demo reached the model as plain text. The T3 MCP extension now delivers the same instructions through pi's real system-prompt channel (a before_agent_start hook), and the adapter sends the user's text untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high 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 7ab3f16. Configure here.
juliusmarminge
force-pushed
the
t3code/codex-turn-mapping
branch
from
August 17, 2026 10:28
519c42a to
4c55679
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Pi users depend on their existing models, auth, extensions, skills, context files, and native session history. T3 Code did not have a Pi provider, and a shallow CLI wrapper would lose the customization and session behavior that make Pi useful.
Solution
This adds Pi as an Early Access provider on Orchestrator V2:
subagentextension, deduplicates explicit extension arguments, and restores trusted user and project extensions.The MCP bridge, resumable subagent work, and per-model thinking support originated in @mwolson's stacked contribution and retain that authorship.
Related work
Closes #397.
Closes #402.
Addresses #6685.
This supersedes the Pi implementations in #2211, #2748, #2800, #2812, #2831, #2856, #3818, #3947, #4355, #4445, #5688, #5882, and #6319.
This incorporates StiensWout#34 by @mwolson.
Validation
Proof
Provider discovery
End-to-end Pi turn
Context meter persists across turns
The active context stays at 21k/272k while Pi's cumulative session total rises from 90k to 111k after the next completed turn.
Native resumable subagent
Native steering
Checkpoint and Pi session-tree rollback
Stacked on #2829 (
t3code/codex-turn-mapping) until that branch lands.Built by GPT-5.6 Sol in T3 Code through Codex.