Skip to content

Use thread rollback for Esc backtrack - #9140

Merged
aibrahim-oai merged 2 commits into
mainfrom
esc-thread-rollback
Jan 13, 2026
Merged

aibrahim-oai merged 2 commits into
mainfrom
esc-thread-rollback

Conversation

@aibrahim-oai

@aibrahim-oai aibrahim-oai commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor
  • Swap Esc backtrack to roll back the current thread instead of forking

@aibrahim-oai aibrahim-oai changed the title esc thread rollback Use thread rollback for Esc backtrack Jan 13, 2026
@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

@codex review this

@jif-oai jif-oai 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.

way cleaner

@aibrahim-oai
aibrahim-oai enabled auto-merge (squash) January 13, 2026 09:05

@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: f7e4ee8b84

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +129
self.chat_widget.submit_op(Op::ThreadRollback { num_turns });
self.trim_transcript_for_backtrack(selection.nth_user_message);
if !selection.prefill.is_empty() {

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.

P2 Badge Delay transcript trim until rollback is confirmed

Core rejects ThreadRollback when a turn is in progress (see handlers::thread_rollback), but apply_backtrack_rollback trims the local transcript and pre-fills the composer immediately after sending the op. If a user hits Esc quickly after submitting (before TurnStarted/is_task_running flips) and the rollback fails, the UI now hides turns that still exist in server history, so subsequent inputs are sent with a different context than what the user sees. Consider waiting for ThreadRolledBack or reverting on ThreadRollbackFailed before mutating the transcript.

Useful? React with 👍 / 👎.

Comment on lines +126 to +128
self.chat_widget.submit_op(Op::ThreadRollback { num_turns });
self.trim_transcript_for_backtrack(selection.nth_user_message);
if !selection.prefill.is_empty() {

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.

P2 Badge Delay transcript trim until rollback is confirmed

Core rejects ThreadRollback when a turn is in progress (see handlers::thread_rollback), but apply_backtrack_rollback trims the local transcript and pre-fills the composer immediately after sending the op. If a user hits Esc quickly after submitting (before TurnStarted/is_task_running flips) and the rollback fails, the UI now hides turns that still exist in server history, so subsequent inputs are sent with a different context than what the user sees. Consider waiting for ThreadRolledBack or reverting on ThreadRollbackFailed before mutating the transcript.

Useful? React with 👍 / 👎.

@aibrahim-oai
aibrahim-oai merged commit 3a300d1 into main Jan 13, 2026
@aibrahim-oai
aibrahim-oai deleted the esc-thread-rollback branch January 13, 2026 09:17
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 13, 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.

2 participants