Skip to content

Double Esc backtrack causes stack overflow #4977

Closed

Description

@alexx-ftw

Summary

  • double-pressing Esc in the main chat view (with an empty composer) triggers the backtrack preview
  • subsequent Esc events recurse through open_backtrack_preview → step_backtrack_and_highlight without advancing selection when there are no user messages to highlight
  • the loop never terminates, and the process crashes with hread 'main' has overflowed its stack

Reproduction Steps

  1. Start the TUI in a project with an existing conversation history (e.g., run codex resume --dangerously-bypass-approvals-and-sandbox)
  2. Ensure the composer is empty, then press Esc twice in quick succession
  3. Observe the stack overflow crash (STATUS_STACK_OVERFLOW on Windows)

Expected Behavior

  • the transcript overlay should highlight the latest user message or stop at the beginning of history without crashing

Actual Behavior

  • Esc triggers an infinite loop in backtrack preview, causing a stack overflow

Additional Context

  • Windows 11 (build 26100), PowerShell terminal
  • codex commit: b0e4fc2 (fix/paste-burst-newline branch)
  • running codex.exe resume --dangerously-bypass-approvals-and-sandbox
  • no prompt text in the composer; crash occurs even without interacting further.

Activity

  1. added
    bug
    windows-os
    on Oct 8, 2025
  2. alexx-ftw commented on Oct 8, 2025

    @alexx-ftw
    Author

    Proposed fix in PR #4975: ignore repeat Esc events so backtrack only steps once per keypress and close the overlay early when there are no user messages left. That prevents the Esc loop from recursing until the stack blows up.

  3. added
    TUI
    on Nov 15, 2025
  4. etraut-openai commented on Jan 10, 2026

    @etraut-openai
    Contributor

    Closing old issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

TUIbugwindows-os

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions