Skip to content

fix: limit server recovery checks to the current login session - #1958

Open
yanmuq wants to merge 1 commit into
rime:masterfrom
yanmuq:codex/current-bug-fixes
Open

yanmuq wants to merge 1 commit into
rime:masterfrom
yanmuq:codex/current-bug-fixes

Conversation

@yanmuq

@yanmuq yanmuq commented Oct 20, 2026

Copy link
Copy Markdown

When a second Windows user needs to start or recover Weasel, _EnsureServerConnected() counts every WeaselServer.exe on the machine. A server left running in another login session therefore prevents the current session from launching its own server, even though it cannot serve that user's IPC connection.

Restrict the process count to the TSF client's Windows login session using ProcessIdToSessionId. A server in the current session still prevents a duplicate launch. The change stays inside the existing process enumeration lambda.

Related to #1533. This is a partial fix for the recovery blocker, not a resolution of the whole multi-user report. It does not change user data directory selection or establish complete multi-user support.

Validation

Based on upstream master at 82b50c9e9b9ee0bd31357db6f25ddc804546c7f7.

  • Compiled the exact process-count lambda from the source with MSVC 14.44 and Windows SDK 10.0.26100.0 in a standalone local harness. The cross-session cases use stubbed Win32 APIs: the original lambda counts the other session's server, while the patched lambda excludes it.
  • Eight targeted cases passed: no server, unrelated process, same-session server, other-session server, servers in both sessions, case-insensitive executable name, a process disappearing before session lookup, and snapshot creation failure. Snapshot handles were also checked for release.
  • With the real Win32 APIs, a temporary dummy WeaselServer.exe in the current session was detected while running and no longer counted after exit.
  • Whitespace check passed. The local harness is not included in the repository's test suite.

Remaining verification

  • Chinese input after switching between two real Windows user accounts has not been tested. The cross-session evidence above is a targeted simulation, not an end-to-end reproduction of the entire issue.
  • A full TSF/IME build was not run locally because ATL is not installed. The standalone test does not substitute for the project build or integration testing.

Only count WeaselServer processes in the TSF client login session so another signed-in user does not prevent local service recovery. Related to rime#1533; this does not change user data directory handling.
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