Repository navigation
test(codex): de-flake attempt turn-watch timing tests - #115258
Merged
Merged
Conversation
steipete
marked this pull request as ready for review
July 28, 2026 15:16
steipete
force-pushed
the
steipete/festive-gould-dceb42
branch
from
July 28, 2026 15:27
9a60d67 to
7e35d0d
Compare
Contributor
Author
|
Merged via squash.
|
vincentkoc
added a commit
that referenced
this pull request
Jul 28, 2026
* origin/main: test(codex): de-flake attempt turn-watch timing tests (#115258) fix: preserve retryable ACPX lease ownership (#115247) fix: serialize ACPX lease ownership transitions fix: retain ACPX leases across wrapper reconnects refactor: parse ACPX lease command identity fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752) refactor(config): retire compaction truncateAfterCompaction gate (#115206) improve(ui): reduce duplicate chat startup work (#114743) fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221) perf(pr): cache complete small file lists (#115199) perf(sqlite): skip no-op automatic schema repair (#115193) docs(browser): correct Docker sandbox setup (#115254) fix(ui): avoid duplicate session refreshes during startup (#114764) # Conflicts: # ui/src/pages/agents/panels-tools-skills.browser.test.ts
vincentkoc
added a commit
that referenced
this pull request
Jul 28, 2026
* origin/main: test(codex): de-flake attempt turn-watch timing tests (#115258) fix: preserve retryable ACPX lease ownership (#115247) fix: serialize ACPX lease ownership transitions fix: retain ACPX leases across wrapper reconnects refactor: parse ACPX lease command identity fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752) refactor(config): retire compaction truncateAfterCompaction gate (#115206) improve(ui): reduce duplicate chat startup work (#114743) fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221) perf(pr): cache complete small file lists (#115199) perf(sqlite): skip no-op automatic schema repair (#115193) docs(browser): correct Docker sandbox setup (#115254) fix(ui): avoid duplicate session refreshes during startup (#114764)
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Three timing tests in
extensions/codex/src/app-server/run-attempt.turn-watches.test.tsrace a real wall-clock progress source against a short watchdog budget. This is the same flake class fixed for the OpenAI transport in #115196.The headline case is
"keeps a progressing active turn alive beyond the original attempt timeout". It setparams.timeoutMs = 100— which is the attempt idle watchdog, floored at 100ms byrun-attempt-turn-state.ts:99— and paced tworawResponseItem/completednotifications with real 60ms sleeps.The static margin looks like 40ms per gap, but it is much thinner than that. The attempt watch is armed at
turn:startinside the attempt (run-attempt-active-turn.ts:117-118), tens of ms beforeawait harness.waitForMethod("turn/start")returns, so the test's 60ms sleep is measured from a point the watchdog clock has already passed. Instrumenting the test showed the first gap consuming 66-77ms of the 100ms budget as measured by the test, while the controller reportedidleMsof 101-130 againsttimeoutMs: 100.Why This Change Was Made
The behavior under test is worth keeping, so all three tests are hardened rather than deleted or loosened.
:764progressing turn —attemptIdleTimeoutMs100 -> 1000 and the progress interval 60ms -> 50ms, moving the gap/budget ratio from ~1.7x to 20x. The fixedreasoningChunkCount-style pair of notifications becomes a wall-clock loop that emits progress until the phase exceeds the watchdog, so "the turn outlived the original attempt timeout" holds by construction on a slow runner instead of being an implicit product of two constants. The exact-count assertion is preserved astoHaveLength(sentProgressNotifications)— still one progress reason per notification, just no longer pinned to a hardcoded2.:1164pending user input — this one was both fragile and nearly vacuous: it asserted no interrupt at roughly t=200ms against a 250ms budget, so a correct-but-slow run failed while a broken one could pass. Readingrun-attempt-server-requests.tsshowed a pendingitem/tool/requestUserInputrecords attempt progress but never suppresses the attempt watch, so the provable property is that the turn outlives the deadlineturn:startalone would have set. That needspreRequestIdleMs + pendingHoldMs > attemptIdleTimeoutMs > pendingHoldMs, and both bounds are now asserted explicitly, so load cannot silently make it vacuous in either direction.:168reschedule-on-shortened-timeout — this one drivescreateCodexAttemptTurnWatchControllerdirectly with no attempt runtime, sovi.useFakeTimers()transfers cleanly from the siblingattempt-turn-watches.test.ts. Thevi.waitFor(..., { timeout: 120 })race against a 40ms deadline is replaced withadvanceTimersByTimeAsync, making it fully deterministic.Evaluated and deliberately left alone:
:1016(timeoutMs = 500vs a 60ms sleep, ~8x margin) and:1096(turnCompletionIdleTimeoutMs: 15exceeded by design, which is already the robust construction). Neither showed risk, and churning them would add diff without removing a failure mode.User Impact
None. Test-only change; no production code is touched.
Evidence
Codex protocol gate. Verified the surfaces these tests exercise against sibling
../codexat899539c03a(harness pinned to@openai/codex0.145.0):rawResponseItem/completednotification —codex-rs/app-server-protocol/src/protocol/common.rs:1682item/tool/requestUserInputserver->client request (has bothparamsandresponse, so the app-server blocks on our answer) —codex-rs/app-server-protocol/src/protocol/common.rs:1513-1516, sent atcodex-rs/app-server-client/src/lib.rs:1866isSecretquestion field —codex-rs/protocol/src/request_user_input.rs:23-26turn/interruptclient->server request —codex-rs/app-server-protocol/src/protocol/common.rs:843Reproduction. Clean on an idle machine (5/5 green), so the flake was provoked with 2x CPU saturation (32 busy loops on 16 cores). Before the fix,
-t "keeps a progressing active turn alive"failed 5 of 6 runs, every failure identical:After the fix, the same filter under the same 2x saturation: 6 of 6 green.
Mutation proofs that each test still catches the regression it guards:
:764attemptProgress: true->falseatattempt-notification-state.ts:114:1164run-attempt-server-requests.ts:81and:339:168scheduleAttemptIdleWatch()fromrecordAttemptProgressOne honest limitation, recorded in an inline comment rather than glossed over: mutating
:startor:responsealone for:1164still passes. The two resets land ~20ms apart becausefinallyruns whenreturnis evaluated, not when the bridge promise settles, so this test guards the pair rather than attributing survival to the pending-request reset specifically. That was true before this change too; it is now written down.Other proof:
node scripts/run-vitest.mjs extensions/codex/src/app-server/run-attempt.turn-watches.test.ts-> 94 passednode scripts/run-vitest.mjs extensions/codex/src/app-server/attempt-turn-watches.test.ts-> 29 passednode scripts/check-changed.mjs-> exit 0 (lint + typecheck, delegated to Blacksmith Testboxtbx_01kymk7fersgkvx3dvq73e7p14)oxfmt --checkclean,git diff --checkcleanautoreview --mode uncommitted(codex / gpt-5.6-sol / xhigh) ->autoreview clean: no accepted/actionable findings reported