Skip to content

Conversation

@sayan-oai
Copy link
Contributor

Introduces an EventBroker between the crossterm EventStream source and the consumers in the TUI. This enables dropping + recreating the crossterm_events without invalidating the consumer.

Dropping and recreating the crossterm event stream enables us to fully relinquish stdin while the app keeps running. If the stream is not dropped, it will continue to read from stdin even when it is not actively being polled, potentially stealing input from other processes. See here and here for details.

Tests

Added tests for new EventBroker setup, existing tests pass, tested locally.

@sayan-oai
Copy link
Contributor Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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".

Copy link
Collaborator

@joshka-oai joshka-oai left a comment

Choose a reason for hiding this comment

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

General approach LGTM - would suggest having @nornagon-openai also weigh in on this.

Doc suggestions are the main things I'd fix on this. The other suggestions are less important. Async (or adjacently async) code is often difficult to maintain. Capturing the context for why it's there / intended behavior in various situations is pretty important.

Comment on lines 79 to 81
/// Per-call event stream wrapper. Each handle has its own draw subscription but
/// pulls crossterm events from the shared broker so nested/sequential streams
/// can coexist (only one should be polled at a time to avoid stealing).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I understand this comment at all as it assumes that the reader has a lot of context into a bunch of concepts that aren't explained / anchored.

  • what's a call?
  • what's a handle?
  • why is a draw subscription relevant?
  • why would there multiple copies of this?
  • what is stealing and why is it bad?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair. I tried to clarify, let me know if it's still unclear.

Copy link
Contributor

@LIHUA919 LIHUA919 left a comment

Choose a reason for hiding this comment

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

LGTM

@sayan-oai
Copy link
Contributor Author

@codex review this

Copy link
Contributor

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

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.

ℹ️ 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".

@sayan-oai
Copy link
Contributor Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

@sayan-oai sayan-oai merged commit cf44511 into main Dec 16, 2025
46 of 48 checks passed
@sayan-oai sayan-oai deleted the dev/sayan/pause-crossterm-events branch December 16, 2025 09:14
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2025
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.

5 participants