Skip to content

Preserve TUI event ordering during active-thread draining - #39991

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/41080d3df13ca308eec1ea0fbb0ba067a4640c4c
Aug 21, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/41080d3df13ca308eec1ea0fbb0ba067a4640c4c

Conversation

@copyberry

@copyberry copyberry Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Preserve TUI event ordering during active-thread draining

Why

Draining every queued active-thread event in one foreground pass can overrun the
frame budget. Buffered thread events can also race ahead of queued replay and
startup app events, causing the TUI to switch views before the corresponding
history and operations have been applied.

What changed

  • Bound active-thread draining to one target frame interval and leave remaining
    notifications queued for a later frame.
  • Prioritize queued app events over active-thread events so replay state is
    applied before buffered closures or other thread notifications.
  • Block startup input only for pending requests, rather than ordinary queued
    notifications whose draining yielded at the frame deadline.
  • Leave selected side-thread closure handling to the foreground event loop.

Testing

Added tests covering deadline-limited notification draining and foreground
handling of a selected side thread closing.

## Why

Draining every queued active-thread event in one foreground pass can overrun the
frame budget. Buffered thread events can also race ahead of queued replay and
startup app events, causing the TUI to switch views before the corresponding
history and operations have been applied.

## What changed

- Bound active-thread draining to one target frame interval and leave remaining
  notifications queued for a later frame.
- Prioritize queued app events over active-thread events so replay state is
  applied before buffered closures or other thread notifications.
- Block startup input only for pending requests, rather than ordinary queued
  notifications whose draining yielded at the frame deadline.
- Leave selected side-thread closure handling to the foreground event loop.

## Testing

Added tests covering deadline-limited notification draining and foreground
handling of a selected side thread closing.

GitOrigin-RevId: 41080d3df13ca308eec1ea0fbb0ba067a4640c4c
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/41080d3df13ca308eec1ea0fbb0ba067a4640c4c branch from 607d640 to f6519a3 Compare August 21, 2026 18:44
@copyberry
copyberry Bot merged commit f6519a3 into main Aug 21, 2026
27 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/41080d3df13ca308eec1ea0fbb0ba067a4640c4c branch August 21, 2026 18:45
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 21, 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