Skip to content

Detach retired session views before asynchronous cleanup - #1171

Merged
trissim merged 3 commits into
mainfrom
fix/detach-retired-views
Oct 23, 2026
Merged

trissim merged 3 commits into
mainfrom
fix/detach-retired-views

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown

A retired DM view remained reachable while close_many awaited tab persistence and return navigation. Sidebar paint could resolve its deleted peer through the new registry references.

SessionNavigation.detach (src/toad/session_navigation.py:442) now forgets observations, removes entries and detaches workspace views synchronously before publishing. views_retired (:236) calls detach directly and schedules only finish; close_many (:439) uses the same path. WorkspaceSessions.detach (src/toad/workspace_sessions.py:252) owns the pop and source reset.

Send-back corrections at 1c1f443:

  • Detached.returning_view (session_navigation.py:52) retains the actual member/view pairing when the view is popped (:466-469). finish retires it directly (:478-479); no view.id/mode comparison or search remains.
  • WorkspaceSessions.finish (workspace_sessions.py:263) owns close_presentation followed by remove. Both WorkspaceSessions.close (:261) and SessionNavigation.finish (session_navigation.py:484) call that one procedure.
  • The retire_presentation call before return_to is NEW behavior relative to main. It is necessary because the selected view is popped and the workspace source is reset before return_to switches away; that switch can therefore no longer retire the departing view. Explicitly retiring returning_view releases the old native pane before the surviving owner is activated. It preserves that required retirement after the synchronous detach changed the ordering.

Merged current main, including #1173's agent-comms lock bump at 05e7c1f.

Paired Core PR: OpenHCSDev/agent-comms#2933 publishes view retirement before presentation for each revision. Its branch is unchanged by this send-back.

Live scenario for review: open a DM, unregister or rebind its peer, then repaint the sidebar. The sidebar must not raise KeyError and the DM tab must close cleanly.

Validation: both changed Python files parse; git diff --check is clean; the pushed head matches ls-remote. No tests or live scenario run.

Assumed: the paired Core change ships with this fix; Detached retains ownership of removed views until finish; the review fork exercises DM retirement and ordinary native-tab closure.

@trissim
trissim marked this pull request as ready for review October 23, 2026 22:02
Copilot AI balanced review requested due to automatic review settings October 23, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 84f90c5 into main Oct 23, 2026
2 of 3 checks passed
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.

2 participants