Repository navigation
test(core): drive session wall time and deadlines from one clock - #521
Conversation
Under test, now_ms() derives wall time from tokio's Instant, so tokio::time::advance moves both clocks. Store jobs hold paused auto-advance while the store thread works. Tests drop the Epoch/advance pairing and keep-clock busy loops; the real-duration deadlines tests use paused time.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d89021f54
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Change
Test-only. Session wall time and run deadlines now follow one clock under test.
#[cfg(test)],now_ms()derives wall time from tokio'sInstantplus a fixed base.tokio::time::advancenow moves the calendar, the goal deadlines and the run deadlines together. The productionnow_ms()is stillSystemTime::now(). There is no new public API and noSessionRuntimeOptionsfield.spawn_blockingplaceholder until it settles. This keeps tokio from auto-advancing paused time while the real store thread commits. Everycfg(test)addition is instore.rsandstore/worker.rs.goal_driver_soak::Epochis gone. The few tests that need a calendar held still while monotonic time moves now usePinnedCalendarinsessions/tests.rs: the multi-day soak child process, the goal-check and audit calendar-expiry tests, and thewall_clock_lagsrow.Epoch+advancepairing (approvals ~1910, ~2549, ~2583;goal_admissiontwenty-minute wait).goal_admission.rs:38(D20).start_paused.duration_expires_during_shell_execution…used to poll for the shell's marker file in a yield loop on the runtime thread. It now waits in a boundedspawn_blockingtask, which also keeps paused time from auto-advancing during the wait.a_childs_timed_out_hold_pauses_the_goal…(fix(core): pause the goal when a held approval times out after its expired owner cancelled the run #515) failed 30/100 under load. The cause was not the clock: the scheduler claimed the child run on the depth-1 pool before the test could. The test now holdschild_permits[0]too.xtask/src/legacy-sleeps.txt: line numbers moved, entries otherwise unchanged (11/11 sleeps).Verification
Stress: 100 iterations per test, pinned to one core with three busy loops (findings A1 recipe), via
cargo nextest run --archive-file … --stress-count 100.On this host the two-clock tests did not reproduce a flake before the change. Their gain is that they no longer depend on scheduling: there are no busy loops and no clock pairing.
Times, warm local runs,
cargo nextest run -p qq-core:Whole qq-core suite: 21.0 s before, 20.5 s after.
cargo xtask check: passed (fmt, lint, clippy, nextest over qq, qq-client, qq-core, qq-host, qq-server, qq-tui, xtask).Known impact
None for users. Two tests stay on real time:
duration_waits_for_blocking_attachment_guidance_and_skill_cleanup(2.4 s). It asserts that nothing finishes within 750 ms while a blocking task is held, which is an A6-style negative wait.duration_stops_shell_while_output_persistence_is_blocked(1.0 s). It runs a real shell.duration_cancels_read_only_and_mutating_external_callskeeps a shortpause/advance/resumewindow. Its mutating case takes an undo snapshot with real git, which cannot run understart_paused. Neither file pairs the two clocks any more. No tests deleted.