Fail send on settled Pi provider errors - #570
Conversation
- Add settled-error, retry, cancel, and tool-budget cases - Add fallback classifier cases for auth and availability
- Raise provider.request_failed after the SDK settles - Keep retry, cancel, timeout, and tool-budget outcomes - Document the send outcome boundary
PR Agent ReviewCaution Review did not finish. Run |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Keep the send outcome note outside the layout table - Wrap a long session test line
Greptile SummaryThis PR makes the shared Pi session boundary reject sends that settle on an unrecovered assistant provider-error turn while preserving successful SDK retries and the existing cancellation, idle-timeout, and tool-budget outcomes.
Confidence Score: 5/5The PR appears safe to merge; no actionable correctness, security, or repository-rule violation remains. The implementation scopes provider-error state to each send, deliberately clears it after a successful SDK retry, and preserves the documented higher-priority cancellation, timeout, and tool-budget outcomes with focused regression coverage.
|
| Filename | Overview |
|---|---|
| src/agent/runtime/piSessionImpl.ts | Adds per-send terminal provider-error tracking and explicit precedence among public cancellation, idle timeout, tool-budget termination, and provider failure. |
| test/createPiSession.test.ts | Extensively exercises settled provider errors, SDK recovery, direct rejection, cancellation, usage preservation, cleanup, and state reset. |
| test/fallbackClassification.test.ts | Locks rate-limit eligibility and auth, timeout, and cancellation ineligibility for fallback. |
| test/piSession.seam.test.ts | Adds seam-level verification that a resolved SDK prompt ending in an assistant error rejects without emitting completion. |
| docs/operations.md | Documents provider failure, retry, cancellation, tool-budget, and fallback behavior at the operational boundary. |
| docs/development.md | Records the updated createPiSession.send contract for contributors. |
| .pr-agent/pi-session-seam.mdc | Extends the binding Pi session seam rule with the distinct terminal-outcome contract. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Send prompt] --> B[Observe Pi turn events]
B --> C{Latest assistant outcome}
C -->|Provider error| D[Retain provider error]
C -->|Successful retry| E[Clear retained error and keep response]
B -->|Tool budget reached| F[Abort internally and preserve budget-stop outcome]
B -->|Idle timeout| G[Abort internally and report idle timeout]
A -->|Public abort| H[Report session aborted]
D --> I{Prompt settled without higher-priority outcome?}
I -->|Yes| J[Throw provider.request_failed]
E --> K[Return assistant text]
Reviews (1): Last reviewed commit: "chore: format tests and clarify send doc..." | Re-trigger Greptile
|
/review |
1 similar comment
|
/review |
Summary
createPiSession.sendfails after a settled unrecovered Pi provider error.abort()staysagent.session_abortedwhen an earlier error turn remains.Details
piSessionImpl.tskeeps the latest assistantstopReasonfor each send. Aftersession.promptsettles, an unrecoverederrorturn throwsprovider.request_failedbefore completion. A later non-error assistant turn clears that state.Public abort wins over a retained error turn. A tool-budget abort does not become a provider outage. An idle timeout still throws
pi.prompt_idle_timeout.test/createPiSession.test.tsandtest/piSession.seam.test.tscover settled errors, retries, rejected prompts, cancel, successive sends, usage, and cleanup.test/fallbackClassification.test.tskeeps auth ineligible and rate-limit eligible.Closes #558
PR Agent Description
PR Type
Bug fix, Tests, Documentation
Description
sendwithprovider.request_failedwhen the SDK settles on an assistant error turn.provider.request_failedand preserves prior usage events.Changes Diagram
Review map
src/agent/runtime/piSessionImpl.ts: Core send contract decides failure versus silent successtest/createPiSession.test.ts: Terminal error cases lock the new send behaviortest/fallbackClassification.test.ts: Fallback mapping controls retry versus no-retry paths