Preserve terminal turn errors in replayed history - #35524
Conversation
## Why When rebuilding a thread from rollout events, errors embedded in turn completion events were ignored. Failed retries could therefore be restored as completed turns, causing warnings such as model-overload errors to disappear from the TUI transcript. ## What changed - Mark turns with terminal completion errors as failed and retain their message and structured error information. - Apply late completion errors to their matching historical turn without interrupting the active turn. ## Testing Added history-builder coverage for current and late completion errors, plus a TUI replay snapshot covering repeated overload failures. GitOrigin-RevId: 5c474baa0fd5c73368b444d79fb850cbd4c8023a
6fae034 to
9ca6df6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fae034471
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let terminal_error = payload.error.as_ref().map(|error| V2TurnError { | ||
| message: error.message.clone(), | ||
| codex_error_info: error.codex_error_info.clone().map(Into::into), | ||
| additional_details: None, | ||
| }); |
There was a problem hiding this comment.
Exercise failed completion replay through the public RPC
When a persisted rollout containing TurnCompleteEvent { error: Some(...) } is loaded through thread/read or thread/turns/list, the new protocol test only invokes the reducer directly, while the TUI snapshot starts with an already-failed AppServerTurn. Neither test verifies that the request-processing and serialization path returns the reconstructed failed status and error, so add an app-server integration test that seeds this rollout and asserts the JSON-RPC response.
AGENTS.md reference: AGENTS.md:L252-L257
Useful? React with 👍 / 👎.
Preserve terminal turn errors in replayed history
Why
When rebuilding a thread from rollout events, errors embedded in turn completion
events were ignored. Failed retries could therefore be restored as completed
turns, causing warnings such as model-overload errors to disappear from the TUI
transcript.
What changed
and structured error information.
interrupting the active turn.
Testing
Added history-builder coverage for current and late completion errors, plus a
TUI replay snapshot covering repeated overload failures.