Repository navigation
fix(server): Pi turns start while an extension run is streaming - #15444
pedrozimmermannsoares wants to merge 1 commit into
Conversation
The turn-start prompt was sent without streamingBehavior. When a Pi extension continuation was already streaming, Pi rejected it with "Agent is already processing" and the turn failed. Send it with streamingBehavior: "steer", as the steer path already does. Pi ignores the field when idle, so recorded replay frames only gain the field. Fixes pingdotgg#15221
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused server bug fix that adds Pi’s existing steering mode only to turn-start prompts, allowing prompts to queue during an extension stream while leaving idle behavior unchanged. The accompanying regression test and replay-fixture updates are limited in scope, with no schema, deployment, security, billing, or static-analysis implications. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe Pi adapter now sends initial prompts with ChangesPi prompt steering
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Initial prompts can now join active extension work while idle starts retain normal prompt handling. The inspected Pi contract supports this change, so no material merge-readiness risk remains. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Heads-up: Would you be able to rebase and push? A push also puts a new head in front of Macroscope, whose approval was recorded against |
Problem
When a Pi extension continuation is already streaming as a T3 turn starts, Pi rejects the turn-start prompt with "Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message." The turn fails, and each retry fails the same way while the extension run continues. Reported and triaged in #15221.
Change
PiAdapterV2now sends the turn-startpromptwithstreamingBehavior: "steer", as the steer path already does. Pi'sAgentSession.prompt()reads the field only whileisStreamingis true (v1.0.1, L1950 and L1965-L1977). An idle session starts a run exactly as before. A streaming session queues the message into the active run instead of throwing.The Pi replay transcripts compare outbound frames exactly, so their 18 turn-start
promptframes gain"streamingBehavior":"steer". Only frames the adapter writes change. Pi's recorded output stays the same, which matches Pi ignoring the field when idle. Themessage_steeringassertion expected the initial prompt to omit the field and now expectssteer.Scope and approval
Fixes #15221. Maintainer triage confirmed the bug on
mainand named this option as the one that matches the existing steer path, including themessage_steeringfixture change.It does not change how the adapter handles agent work that starts before any T3 turn exists (
PI_UNSOLICITED_ACTIVITY_ERROR).Verification
starts a turn while an extension run is already streaminginPiAdapterV2.test.ts. The fake answers the prompt as Pi does during a run: with Pi's exact rejection whenstreamingBehavioris missing. Onmainthe turn endsfailedwithprovider_error"Agent is already processing. Specify streamingBehavior ('steer' or 'followUp') to queue the message.". With the fix it endscompleted.vp test run apps/server/src/orchestration-v2/Adapters/PiAdapterV2.test.ts: 50 passed.vp test run apps/server/src/orchestration-v2/testkit/OrchestratorReplayFixtures.integration.test.ts -t "/pi through": 8 passed. Onmainthe same 8 pass. With the adapter change and the old transcripts, all 8 fail.vp test runonOrchestratorReplayFixtures.contract.test.ts,UserFacingErrors.test.ts, andpiT3McpInjection.test.ts: 10 passed.main. The only difference in each is the added"streamingBehavior":"steer".vp linton the changed TypeScript files: no new findings. The one warning (layerunused inPiAdapterV2.ts) is already onmain.vp run --filter t3 typecheck: exit 0.Not checked: a live Pi 1.0.x session with a streaming extension. The transcripts were edited, not re-recorded against a live Pi.