Skip to content

Fix ChannelPrompt pruning race, PanelMenu eviction leak, and stale PanelMenu tests - #2337

Merged
trissim merged 1 commit into
mainfrom
fix/textual-panel-menu-tests
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/textual-panel-menu-tests

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown

Summary

Fixes two real lifecycle races exposed when updating the stale pre-#2250 SideBarCollapsible and pre-served_tools Textual tests on main:

  1. Prompt.sync_session / watch_agent_info teardown race (src/toad/widgets/prompt.py:1075-1084, :1323-1325):
    • AwaitRemove.prune sets _pruning = True while removing child widgets (PromptTextArea) before the parent ChannelPrompt finishes unmounting. Guarding sync_session and watch_agent_info on not self._pruning stops _observed_activity_changed from raising NoMatches: No nodes match 'PromptTextArea' on ChannelPrompt() during removal.
  2. PanelMenu eviction worker & panel retention (src/toad/widgets/side_bar.py:1342-1357, src/toad/widgets/session_thread_sidebar.py:105-107):
    • PanelMenu.open_selection launches a "configuration-panels" worker holding self.entries / self.pages / self.picker options (all 5 panel widgets). PanelMenu.stop_configuration_load cancels it on unmount and PanelMenu.release() (called from SessionThreadSidebar.evict) cancels, awaits, and clears entries, pages, and picker options so evicted panel graphs are deterministically garbage-collected.
  3. Updated stale Textual tests to PanelMenu / served_tools / current ActionMenu & ActiveSidebarPlacement contracts:
    • Added one shared select_thread_panel(ui, sidebar, widget_type) helper in tests/support/textual_steps.py and migrated reveal_project_tree, test_prompt_completion.py, test_sidebar_retirement.py, test_context_tree_keeps_overlapping_annotations.py, test_hint_input_and_filters.py, test_sidebar_pointer_focus.py, and test_thread_relationship_sidebar.py off the removed ThreadSidebar SideBarCollapsible layout.
    • Updated agent_comms.transport.tools.served -> agent_comms.transport.served_tools.served in test_thread_relationship_sidebar.py, test_message_file_chips.py, and test_older_bus.py.

Verification

  • All 8 updated Textual test files (test_prompt_completion.py, test_sidebar_retirement.py, test_context_tree_keeps_overlapping_annotations.py, test_hint_input_and_filters.py, test_sidebar_pointer_focus.py, test_thread_relationship_sidebar.py, test_message_file_chips.py, test_older_bus.py): 21/21 passed.
  • Repo guards: REL_IMPORTS=0, qt_inherit_ratchet 0/0/0/0/0, shadow_check 0, guarded_imports 0.

@trissim
trissim merged commit 3a9c727 into main Nov 27, 2026
1 of 2 checks passed
@trissim
trissim deleted the fix/textual-panel-menu-tests branch November 27, 2026 21:42
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