Skip to content

test(codex): give the blocked-replacement handshake a workable deadline - #126

Open
AlexanderKugel wants to merge 1 commit into
raine:mainfrom
AlexanderKugel:fix/codex-cancellation-deadline
Open

test(codex): give the blocked-replacement handshake a workable deadline#126
AlexanderKugel wants to merge 1 commit into
raine:mainfrom
AlexanderKugel:fix/codex-cancellation-deadline

Conversation

@AlexanderKugel

Copy link
Copy Markdown
Contributor

Fixes #124.

Problem

cancellation_while_replacement_startup_is_blocked_aborts_request_state waits for the replacement WebSocket handshake before it asserts anything. That wait had a two-second deadline:

tokio::time::timeout(std::time::Duration::from_secs(2), replacement_accepted_rx)
    .await
    .expect("replacement startup did not reach the blocked handshake")

The handshake takes about 2.5 seconds here, so the wait expired every time and the test failed before reaching its assertions:

panicked at src/providers/codex/mod.rs:2532:14:
replacement startup did not reach the blocked handshake: Elapsed(())

Change

Raise that one deadline to five seconds.

The assertion under test is cancellation cleanup, not handshake latency, so the deadline only needs enough headroom to stop deciding the result.

Verification

  • The test passes 5 runs out of 5, each completing in about 2.6 seconds.
  • cargo test --lib: 861 passed, 0 failed.
  • cargo fmt --check clean.

Tested on Linux 6.18 (WSL2), rustc 1.97.1. The margin is now roughly double the observed handshake time, so a slower machine has room as well.

cancellation_while_replacement_startup_is_blocked_aborts_request_state waits
for the replacement WebSocket handshake before asserting anything. That wait
had a two-second deadline, and the handshake takes about 2.5 seconds, so the
test failed on every run here.

The assertion is about cancellation cleanup, not about latency, so the deadline
only needs enough headroom to stop deciding the result. Five seconds passes
5 runs out of 5, each finishing in about 2.6 seconds.
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.

Test cancellation_while_replacement_startup_is_blocked_aborts_request_state fails: replacement startup never reaches the blocked handshake

1 participant