Skip to content

Preserve terminal turn errors in replayed history - #35524

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/5c474baa0fd5c73368b444d79fb850cbd4c8023a
Jul 26, 2026
Merged

Preserve terminal turn errors in replayed history#35524
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/5c474baa0fd5c73368b444d79fb850cbd4c8023a

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 26, 2026

Copy link
Copy Markdown

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

  • 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.

## 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
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/5c474baa0fd5c73368b444d79fb850cbd4c8023a branch from 6fae034 to 9ca6df6 Compare July 26, 2026 22:16
@copyberry
copyberry Bot merged commit 9ca6df6 into main Jul 26, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/5c474baa0fd5c73368b444d79fb850cbd4c8023a branch July 26, 2026 22:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1248 to +1252
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,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant