Repository navigation
fix(pi): keep status hooks off the Pi turn critical path - #8355
Conversation
Pi awaits its extension event handlers, so an awaited loopback status post that stalls (Orca restarting / receiver unavailable) blocked the running Pi turn and disconnected it. Make post() fire-and-forget with a latest-only pending slot drained by a single active request and a 1s AbortController timeout, so a stalled receiver can never hold the turn. Also stop treating session_shutdown as turn completion: Pi emits it on reload/new/resume/fork while the PTY stays alive, so only agent_end proves done (real exit is cleared by PTY teardown). Split the generated handler registrations into agent-status-handler-source.ts. Co-authored-by: Orca <[email protected]>
|
Warning Review limit reached
Next review available in: 17 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: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
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 |
Pi awaits its extension event handlers, so an awaited loopback status post that stalls (Orca restarting / receiver unavailable) blocked the running Pi turn and disconnected it. Make post() fire-and-forget with a latest-only pending slot drained by a single active request and a 1s AbortController timeout, so a stalled receiver can never hold the turn. Also stop treating session_shutdown as turn completion: Pi emits it on reload/new/resume/fork while the PTY stays alive, so only agent_end proves done (real exit is cleared by PTY teardown). Split the generated handler registrations into agent-status-handler-source.ts. Co-authored-by: Orca <[email protected]>
Problem
Orca keeps disconnecting from a running Pi agent. Pi awaits its extension event handlers, and Orca's installed status extension
awaited each loopback statuspost(). When the Orca receiver stalled (app restarting, loopback briefly unavailable), that awaited post hung the Pi event handler — stalling or disconnecting the running turn.A second cause:
session_shutdownwas mapped todone. Pi emitssession_shutdownon reload / new / resume / fork while the PTY stays alive, so a live turn could be marked complete prematurely.Fix
post()is now fire-and-forget (returnsvoid). It stores the latest pending snapshot and drains through a single active request (drainPosts). A stalled receiver can no longer hold the turn.AbortControllertimeout so a hung request is abandoned and the newest status still proceeds. WSL curl fallback preserved.agent_endproves completion. Dropped thesession_shutdownhandler and stopped normalizingsession_shutdown→done. Real process exit is still cleared by PTY teardown.agent-status-handler-source.ts(keeps both transport and handler source under the max-lines limit).Tests
session_shutdownhandler is not registered.session_shutdown→ no status;agent_endremains authoritativedone.agent-status.pi-hook-liveness.→ 2 files, 238 tests passed.
pnpm typecheckpasses.Made with Orca 🐋