Skip to content

Run the Ctrl+R thread picker in a worker so it stops freezing - #96

Open
khushpal-cipher wants to merge 2 commits into
CopperPilot:mainfrom
khushpal-cipher:fix-ctrl-r-picker-worker
Open

khushpal-cipher wants to merge 2 commits into
CopperPilot:mainfrom
khushpal-cipher:fix-ctrl-r-picker-worker

Conversation

@khushpal-cipher

Copy link
Copy Markdown

Summary

Fixes #87.

Ctrl+R is bound to action_resume_thread. Textual awaits an async action inside the app's message pump, and that action waited for the thread picker to close. The pump was stuck waiting, so it never delivered the keys (Down, Enter, Escape) that would close the picker, and the picker froze. /threads already worked because it runs from an input handler, not from a binding.

The action is now a plain method that starts the picker flow in a worker (_resume_thread). Pressing Ctrl+R while a modal is open does nothing, so pickers don't stack. /resume and /threads call _resume_thread directly, as before.

I could not run this on Windows. I reproduced the freeze on Linux with Python 3.11 by pressing Ctrl+R in the test harness: the old code hangs there, the new code passes.

Test plan

  • ruff format --check and ruff check (I did not run ty)
  • pytest -m "not live" (one failure, test_history_after_interrupted_turns_new_message_versus_continue, also fails on an untouched main)
  • Live test if this touches auth, the TUI, or the hosted stream (pytest -m live): not run, I have no account

Tests: the existing picker test now presses the real Ctrl+R binding and selects with the keyboard. A new test checks that a second press doesn't stack a picker, that Escape closes it, and that Ctrl+R opens it again.

Checklist

  • Tests added or updated
  • Docs updated when behavior changes (no user-visible behavior change beyond the fix)
  • No new server, model-picker, computer-use, MCP, sandbox, or LangSmith surface

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ctrl+R freezes the session selector due to a message-pump deadlock

1 participant