Skip to content

fix(mobile-web): leave a deleted open session for its nearest neighbor - #3692

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/mobile-web-switch-after-delete
Nov 2, 2026
Merged

bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/mobile-web-switch-after-delete

Conversation

@bobleer

@bobleer bobleer commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

When the session open in the mobile web chat pane is deleted from the session list, switch to the nearest surviving session in the same list. If there is none, show the empty home panel. The chat page no longer stays on the deleted session and shows an error.

Fixes #3679

Type and Areas

Type: bug fix

Areas: mobile web

Motivation / Impact

The screenshot in #3679 is the mobile web host queue panel ("待发送 0 项" / "刷新"), showing Error: Session workspace is unavailable on this host. The host raises that from CoreRemoteDialogRuntimeHost::manage_dialog_queue when the session no longer exists and has no workspace binding.

Root cause: SessionListPage.handleDelete removed the session from the store, the workspace groups, and the cache, but never told App that the open session was gone. App kept activeSessionId, so ChatPage stayed mounted and its queue panel kept reading the deleted session.

Fix:

  • New pure helper services/sessionDeletionNavigation.ts (nearestSurvivingSession). It finds the list that contains the deleted row and returns the next row, or the previous row when the deleted row was last. It does not jump to another workspace.
  • SessionListPage takes a new optional prop, onActiveSessionDeleted(next | null). It calls the prop after a successful delete of the open session, before cleaning up local state. The list order matches the compact sidebar: the loaded workspace pages or the projected rows, then the flat list.
  • App.handleActiveSessionDeleted swaps the detail pane in place. It adds no history entry and leaves the sidebar as it was. If there is no next session, it clears the active session so the RemoteHomePanel renders.

This matches the desktop Web UI, which also leaves a removed active session rather than keeping it open (nextActiveSessionId: null). Mobile web goes one step further and picks a neighbor, as the issue requests.

Verification

  • pnpm --dir src/mobile-web run test:session-deletion: 5 passed. The new test covers the next row, the previous row, no cross-workspace jump, the flat-list fallback, and the deletion handoff from the list to the shell.
  • pnpm --dir src/mobile-web run type-check: passes.
  • pnpm --dir src/mobile-web run test:workspace-identity: 36 passed.
  • pnpm run check:repo-hygiene: passes.
  • Manual browser verification was not done. No live relay or device pairing was available in this environment.

Reviewer Notes

  • Remote scenarios: this is Remote Control (mobile web through the relay). Only the client-side navigation changed. The delete_session wire command, the relay, and the host are unchanged. The fix was not exercised against a live paired desktop. Remote workspace, Peer Device Mode, and Detached Dispatch are unaffected.
  • Upgrade compatibility: client-only, with no persisted or wire shape change. The saved navigation record simply stores the replacement session.
  • Out of scope: a session deleted by another surface (for example on the desktop) while it is open on mobile web.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable (no new strings; src/mobile-web/AGENTS.md lists the new focused test).

Deleting the session that the chat pane shows kept ChatPage mounted on it.
Its host reads then failed, and the queue panel showed "Session workspace
is unavailable on this host" until the user picked another session.

After a successful delete of the open session, the session list now hands
the app shell the nearest surviving row in the same list (next, else
previous). With no neighbor the detail pane falls back to the empty home
panel. The swap does not add a navigation entry.
@bobleer
bobleer merged commit ce878d6 into GCWing:main Nov 2, 2026
9 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.

[Bug]: 在浏览器使用remote时,删除会话不会自动切换到最近的存活会话

1 participant