Files
Ali Khokhar 7bf094147f Make stream recovery a pure commit policy (#1507)
## Problem

Stream recovery classified provider SDK and HTTP failures even though
provider failure policy already owned that decision. The split ownership
allowed transport retry paths to diverge.

## Changes

| Before | After |
| --- | --- |
| Stream recovery inspected provider exceptions and optionally overrode
its result. | Provider failure policy classifies opened-stream failures
and passes one explicit decision. |
| Chat and Codex reached recovery through different classification
paths. | Chat and Codex use the same phase-specific classification
boundary. |
| Recovery policy mixed transport semantics with commit-state decisions.
| Recovery policy owns only holdback, attempt availability, and
commit-safe actions. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This change centralizes opened-stream retry classification in provider
failure policy and passes explicit retryability decisions into stream
recovery.

The exercised retry paths behaved correctly: a Chat provider-specific
admission override replayed once without emitting failed-attempt output;
a retryable Codex stream disconnect replayed once; and a non-retryable
Codex stream failure returned a final error without replay. Focused
provider policy, recovery, and Codex tests also passed (59 tests).
</details>


<h3>Confidence Score: 5/5</h3>

The exercised stream-retry behavior preserves retry boundaries and
avoids replaying permanent failures.

No defects remain from the reviewed stream-policy changes. Deterministic
execution covered the provider-specific retry override, retryable
opened-stream recovery, and non-retryable opened-stream final-error
path, with focused tests passing.

**Files Needing Attention:** No files require follow-up from this
review.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- Ran the deterministic stream-retry harness against
trex-artifacts/ownership-split-validation.py and verified a clean run
with EXIT\_CODE 0, with Chat's degraded-function admission override
replaying once and emitting only replacement output, Codex replaying an
opened-stream httpx.ReadError once and emitting only replacement output,
and Codex raising a final ExecutionFailure for an opened-stream
ValueError after one request without replay.
- Inspected trex-artifacts/ownership-split-02-after.log and confirmed a
successful deterministic run (EXIT\_CODE: 0) with the same observed
outcomes, and noted that provider tests passed (59 passed).

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<sub>Reviews (1): Last reviewed commit: ["Refine stream retry policy
ownership"](https://github.com/alishahryar1/free-claude-code/commit/cf73456fd7230c1c6a5be8f1ec6ef2456c9649c6)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=55786221)</sub>

<!-- /greptile_comment -->
2026-08-21 20:02:27 -07:00
..