Skip to content

Fix Connect-created Spaces on the server, undeletable dead threads, and invisible server windows - #42

Open
Mirr0ch1 wants to merge 3 commits into
RoversX:mainfrom
Mirr0ch1:fix/remote-connect-workspaces
Open

Mirr0ch1 wants to merge 3 commits into
RoversX:mainfrom
Mirr0ch1:fix/remote-connect-workspaces

Conversation

@Mirr0ch1

Copy link
Copy Markdown
Contributor

Four bugs reported while connecting from one ThinkTerm to another over Connect, in three commits.

1. A first connect left a Space named after the server's own address on every screen attached to it

A first connect invents a stand-in Space for the server, named after the address it was reached by (ensure_mux_domain_space), because a window has to sit somewhere before the server can be asked anything. Today that stand-in survives the first tree ingest (it is held), is published ahead of the server's word (reconcile_ops_for_scope), and lands in the authoritative tree -- so the server's own GUI shows a new Space named after its own IP, while the connect's own thread never lands in the Spaces the server actually described, unlike every later connect.

  • ingest_remote_tree_with now takes retire_stand_in from note_server_tree_arrived (the first tree after an invention): the stand-in's projects move into the tree's first Space, the stand-in is dropped, and windows parked on it rehome through the existing orphaned_window_spaces machinery.
  • reconcile_ops_for_scope no longer publishes a domain's stand-in while it is still invented. An uninitialized (empty) tree keeps the designed seeding path: the mark is already cleared when seeding runs.

2. Dead local threads could not be deleted, and the refusal was silent

A thread with no live workspace -- stale after a session-server handoff, blocked on a deleted project folder, never opened -- was refused by the keep-at-least-one guard (delete_thread), and the local-project fallback that remote projects have (end_workspace_thread_record) was missing entirely, so the delete button did nothing at all.

  • The guard now protects only a live thread (its workspace is in the mux); a dead last thread takes the same seeded-removal path a remote project's last thread has, so the Space never ends up empty.
  • The Noop branch shows the archive-failure-style toast instead of a dead click.
  • kill_workspace_windows also clears a dead-session:<window>:<workspace> parked window, so deleting a stale thread takes its zombie with it.

3. A server's plain-workspace windows were invisible on every attached client

Windows the server keeps in workspaces no ThinkTerm thread owns -- its own default, a CLI spawn, an older version's names -- are mirrored for the protocol, then refused a GUI window (should_spawn_reconciled_gui_window) and refused a sidebar row (adopt_orphan_remote_thread_windows skips unparsable workspace names), leaving the server's working terminals unreachable.

  • Each such workspace (is_server_plain_workspace: any name outside the thinkterm:/thinkterm-/dead-session: namespaces) now gets a row in the Space's mux-domain project, named after the workspace; clicking opens the mirror and the overview previews its tabs.
  • Those rows are this device's bookkeeping only: reconcile_ops_for_scope skips publishing a thread (or a project holding nothing else) whose materialized workspace is plain, so nothing describes the server's own windows back to the server.

Tests

cargo test -p wezterm-gui --bin thinkterm-gui: 1551 passed, 0 failed (1552 with the previously-ignored one). New cases: stand-in retirement into the tree's first Space, stand-in never published before the tree arrives, plain-workspace predicate matrix, plain rows not published, dead/never-opened last local threads removed with a seeded default project, live last thread still refused.

A first connect invents a stand-in Space for the server, named after the
address it was reached by, because a window has to sit somewhere before
the server can be asked anything. Once the server's tree describes its
own Spaces, the stand-in's rows now move into its first one -- exactly
where every later connect lands -- and the stand-in is dropped. Nothing
publishes a stand-in ahead of the server's word any more, so no screen
attached to a server ever shows a Space named after its own address.
A thread with no live workspace -- stale after a session-server handoff,
blocked on a deleted project folder, never opened -- could not be deleted
when it was the last one of a local project: the keep-one guard refused
it, the local fallback that remote projects have was missing, and the
refusal was silent. The guard now protects only live terminals, dead
last threads take the same seeded-removal path remote projects have, the
refusal toast says why, and killing a workspace's windows also clears
the dead-session window a handoff may have parked under its name.
…debar

Windows a server keeps in workspaces no ThinkTerm thread owns -- its own
default, a CLI spawn, an older version's names -- were mirrored for the
protocol and then refused a row, which left the server's working
terminals invisible on every device attached to it. Each such workspace
now gets a row in the Space's mux-domain project, named after the
workspace; clicking it opens the mirror, and the overview previews its
tabs. These rows stay this device's bookkeeping: nothing describes the
server's own windows back to the server.

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.

1 participant