Skip to content

fix: resolve NoActiveWorker error in TUI workspace removal#34

Merged
ckrough merged 1 commit intomainfrom
practical-hawking
Jan 10, 2026
Merged

fix: resolve NoActiveWorker error in TUI workspace removal#34
ckrough merged 1 commit intomainfrom
practical-hawking

Conversation

@ckrough
Copy link
Owner

@ckrough ckrough commented Jan 10, 2026

Summary

Fixes the NoActiveWorker exception that occurred when attempting to remove workspaces via the TUI (pressing 'd' key).

Root Cause

The action_remove() method calls push_screen_wait() which requires running in a worker context. Action handlers triggered by keybindings run in the main event loop by default, not in a worker.

Solution

Added the @work() decorator to action_remove() to ensure it runs in a worker context, which is required by Textual's push_screen_wait() method.

Changes

  • Added import: from textual import work
  • Added @work() decorator to the action_remove method

Testing

  • ✅ All 288 tests pass
  • ✅ Code review approved by @Python-pro agent
  • ✅ Quality gates passed (ruff, mypy, bandit, pytest)
  • ✅ Manual import verification successful

Verification

To test the fix:

  1. ags tui
  2. Navigate to a workspace with arrow keys
  3. Press d to remove
  4. Confirm the modal appears and removal succeeds without error

Add @work() decorator to action_remove method to provide required
worker context for push_screen_wait() async operation.

The decorator enables Textual's message pump to properly suspend
and resume the async action when displaying the confirmation modal.

Fixes: NoActiveWorker exception when pressing 'd' key in TUI
Impact: Workspace removal via TUI now works correctly

Changes:
- Add 'from textual import work' import
- Add @work() decorator to action_remove method
@claude
Copy link

claude bot commented Jan 10, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


@ckrough ckrough merged commit c3406da into main Jan 10, 2026
6 checks passed
@ckrough ckrough deleted the practical-hawking branch January 10, 2026 00:40
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.

1 participant