core-agent-ide/codex-rs/app-server/tests/common
Michael Bolin 4fa304306b
tests: centralize in-flight turn cleanup helper (#12271)
## Why

Several tests intentionally exercise behavior while a turn is still
active. The cleanup sequence for those tests (`turn/interrupt` + waiting
for `codex/event/turn_aborted`) was duplicated across files, which made
the rationale easy to lose and the pattern easy to apply inconsistently.

This change centralizes that cleanup in one place with a single
explanatory doc comment.

## What Changed

### Added shared helper

In `codex-rs/app-server/tests/common/mcp_process.rs`:

- Added `McpProcess::interrupt_turn_and_wait_for_aborted(...)`.
- Added a doc comment explaining why explicit interrupt + terminal wait
is required for tests that intentionally leave a turn in-flight.

### Migrated call sites

Replaced duplicated interrupt/aborted blocks with the helper in:

- `codex-rs/app-server/tests/suite/v2/thread_resume.rs`
  - `thread_resume_rejects_history_when_thread_is_running`
  - `thread_resume_rejects_mismatched_path_when_thread_is_running`
- `codex-rs/app-server/tests/suite/v2/turn_start_zsh_fork.rs`
  - `turn_start_shell_zsh_fork_executes_command_v2`
-
`turn_start_shell_zsh_fork_subcommand_decline_marks_parent_declined_v2`
- `codex-rs/app-server/tests/suite/v2/turn_steer.rs`
  - `turn_steer_returns_active_turn_id`

### Existing cleanup retained

In `codex-rs/app-server/tests/suite/v2/turn_start.rs`:

- `turn_start_accepts_local_image_input` continues to explicitly wait
for `turn/completed` so the turn lifecycle is fully drained before test
exit.

## Verification

- `cargo test -p codex-app-server`
2026-02-20 01:47:34 +00:00
..
auth_fixtures.rs fix(app-server): for external auth, replace id_token with chatgpt_acc… (#11240) 2026-02-09 20:48:58 -08:00
BUILD.bazel feat: add support for building with Bazel (#8875) 2026-01-09 11:09:43 -08:00
Cargo.toml Remove test-support feature from codex-core and replace it with explicit test toggles (#11405) 2026-02-10 22:44:02 -08:00
config.rs chore: rm remote models fflag (#11699) 2026-02-17 11:43:16 -08:00
lib.rs Add app-server compaction item notifications tests (#10123) 2026-01-29 01:00:38 +00:00
mcp_process.rs tests: centralize in-flight turn cleanup helper (#12271) 2026-02-20 01:47:34 +00:00
mock_model_server.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
models_cache.rs fix: show user warning when using default fallback metadata (#11690) 2026-02-15 18:46:05 -08:00
responses.rs Chore: plan mode do not include free form question and always include isOther (#10210) 2026-01-30 01:19:24 -08:00
rollout.rs [feat] persist dynamic tools in session rollout file (#10130) 2026-01-30 01:10:00 +00:00