[fix] Keep Pi retries silent and report failed turns - #6953
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughPi turns now settle at ChangesPi turn lifecycle and configuration
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant Runner
participant PiAdapter
participant Transcript
participant OTel
Runner->>PiAdapter: start prompt
PiAdapter-->>Runner: partial messages and retry events
PiAdapter-->>Runner: agent_settled
Runner->>Transcript: inspect latest assistant record
Transcript-->>Runner: success or provider error
Runner->>OTel: close settled turn span
Possibly related PRs
Merge Risk: ⚪ Minimal · up to No actionable risk remains from the reviewed changes; the reported error-classification regression is not reachable. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Railway Preview Environment
Updated at 2026-09-18T15:29:54.532Z |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Advanced
Run ID: 861ee753-1456-44cb-b2e0-56015e08e66b
⛔ Files ignored due to path filters (1)
services/runner/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
services/runner/patches/pi-acp@0.0.29.patchservices/runner/src/engines/sandbox_agent/environment.tsservices/runner/src/engines/sandbox_agent/errors.tsservices/runner/src/engines/sandbox_agent/pi-error.tsservices/runner/src/engines/sandbox_agent/run-turn.tsservices/runner/src/engines/sandbox_agent/usage.tsservices/runner/src/extensions/agenta.tsservices/runner/src/tracing/otel.tsservices/runner/tests/unit/daytona-transcript-recovery.test.tsservices/runner/tests/unit/extension-tools.test.tsservices/runner/tests/unit/otel-trace-serialization.test.tsservices/runner/tests/unit/pi-acp-retry.test.tsservices/runner/tests/unit/sandbox-agent-pi-error.test.tsservices/runner/tests/unit/silent-turn-contract.test.ts
💤 Files with no reviewable changes (1)
- services/runner/tests/unit/sandbox-agent-pi-error.test.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Pi sessions could stop after displaying “Retrying (attempt 1/3...)” and be recorded as completed, even though the model request failed midway through work. The adapter treated
agent_end, which ends one attempt, as completion of the user turn. The runner also skipped transcript error recovery whenever the agent had already produced text or used tools.This change waits for Pi 0.85.1's
agent_settledevent before completing the prompt, publishing usage, or closing the root trace. Retry events produce no assistant text. Successful recovery continues the same prompt; exhausted recovery rejects it and records an error ending, including after partial work. Existing conversation and tool records remain available. A terminal WebSocket failure displays: “The agent lost its connection while working and could not recover. You can continue from here.”Transport diagnostics that Pi supplies now reach trace events through a bounded allowlist, without provider request bodies, headers, or stacks. This does not establish or fix the original socket disconnect. Pi's loss of close metadata after an opaque socket error remains an upstream limitation. This change also does not add a new Continue button or deduplicate text that the model regenerates after a partially streamed response.
Validation
Live QA on Hetzner with real Pi, pi-acp, sandbox-agent and OpenAI Codex requests found and fixed an error that the initial unit tests missed: a plain Error became a generic internal error at the ACP RPC boundary. The follow-up uses the SDK's RequestError and covers the actual RPC boundary.
On final head
78935f35e3ef027ef88ada5da069e9cf5bf2f813, in an isolated runner:stopReason=errorandok=false.All 3,181 runner unit tests, typecheck, and diff checks pass. The extension build passed before the RPC follow-up; its source was unchanged by that follow-up. Relevant deployed source and dependency files were checked byte-for-byte against the final PR head. The shared oss-team containers were never replaced or restarted; isolated test containers were removed.
This is live backend coverage, not a completed browser acceptance pass. Authenticated UI rendering and application database ingestion remain unverified. The physical cause of the original disconnect also remains unknown.
What to QA
The dependency patch relies on Pi's pinned
agent_settledcontract. Reviewpi-acp@0.0.29.patchtogether with the adapter lifecycle tests when upgrading either package.