消除 PTY EOF 用例的终态竞态
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Failing after 7m45s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m38s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Failing after 9m58s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 55s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Failing after 10m40s
Project CI / Repository checks (pull_request) Failing after 14s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Failing after 11m0s
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled

- process_session_real_pty_eof_reaches_terminal 原先无条件要求 close stdin 成功,PTY 在高负载下先自然 EOF 并退出时会被误判为失败
- 改为仅在会话未终止时要求 close 成功;已进入终态时保留 exited 与 EOF 输出断言,不削弱验证目标
This commit is contained in:
2026-09-21 02:08:28 +08:00
parent ae0fc3322f
commit 8cf7db3dac
@@ -1399,10 +1399,21 @@ process.stdin.resume();
)
.expect("poll ready");
}
let eof = write_process_session_stdin_at(root, &identity, &poll.process_id, "", false, true)
.expect("close stdin");
assert!(eof.eof);
assert!(!eof.stdin_open);
// 自然 EOF 与本用例显式 close 存在竞态:PTY 在负载下可能先收到流 EOF,
// 子进程随即退出并把会话置为终态,此时 close 会以「已进入终态」拒绝。
// 该终态正是用例要验证的收敛结果,因此只在会话仍未终止时要求 close 成功。
match write_process_session_stdin_at(root, &identity, &poll.process_id, "", false, true) {
Ok(eof) => {
assert!(eof.eof);
assert!(!eof.stdin_open);
}
Err(error) => {
assert!(
error.contains("已进入终态"),
"closing stdin failed for a non-terminal session: {error}"
);
}
}
let mut tail = String::new();
for _ in 0..20 {
poll = poll_process_session_at(