microsoft / microsoft/tui-test

Named session close blocks behind pending waits

Open
#207 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
267
Forks
24
Avg merge
3d 19h
Merged PRs (30d)
50

Description

Closing a named in-process session blocks behind a pending wait instead of interrupting it. `close_all()` interrupts the same wait promptly.

Observed on Windows at commit `2d5f8020ba6eb77b9c4da38892c2f6f200311b90`, while testing a new language binding against the existing Rust runtime.

### Reproduction

1. Start a named session with a program that stays alive.
2. Start a text-locator wait for text that will never appear, with a 5-second timeout.
3. While that wait is pending, close the same named session from another thread.
4. Check whether close completes within 2 seconds.

The close operation misses the 2-second deadline and remains blocked behind the wait. Repeating the scenario with `close_all()` completes promptly.

### Expected behavior

Closing one session should interrupt its pending wait and complete cleanup without waiting for the operation’s timeout, consistently with `close_all()`.

### Cause

[`SessionRegistry::execute`](https://github.com/microsoft/tui-test/blob/2d5f8020ba6eb77b9c4da38892c2f6f200311b90/crates/tui-test/src/runtime.rs#L459) holds the per-session generation mutex throughout operation execution, including waits.

Both `SessionRegistry::close()` and `execute(Operation::Close)` acquire that same mutex before reaching cleanup. They therefore cannot interrupt the operation holding it.

`close_all()` takes a different path: it calls `session.interrupt()` before closing sessions.

### Regression coverage

A regression test should establish that the wait has entered the runtime before invoking close, then verify:

- both named-close entrypoints interrupt the wait promptly
- the session is removed and its retained recording remains accessible
- an existing handle can reopen the named session
- unrelated sessions remain open

This is in the shared Rust runtime. JavaScript and Python use the same named-session path, although the reproduction above was exercised through the new binding.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in crates/tui-test/src/runtime.rs at SessionRegistry::execute and compare the named close paths with close_all(). Reproduce the pending text-locator wait on Windows, then add regression coverage for both named-close entrypoints, retained recordings, reopening, and unrelated sessions. Done means close interrupts promptly and all listed session behaviors remain intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.