Repository navigation
fix(core): remove the known test flakes and give command-tree teardown a 10 s confirmation budget - #520
Conversation
The goal stays active after the user run settles, so the scheduler may queue a goal-origin successor that close() cancels. Replaying the whole session then appends that successor's notices. Both reopen tests now replay through the user run's prompt ordinal.
retire_delivery_history deleted events through a second SQLite connection while the runtime could be mid-transaction, which made the store report DatabaseBusy. A test seam on SessionRuntime prunes the journal on the store worker instead.
The 2 s confirmation budgets failed on loaded runners with "could not confirm the command exit". Confirmation still returns as soon as every process is gone, so only the failure path waits longer. Test helpers now treat zombies as exited, since escaped processes are reaped by init or a subreaper on its own schedule, and escaped trees report their pids through a fifo instead of being found by polling ps.
|
@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: ac74ce26f2
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a874bee20
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 295a202273
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0edc3d415
ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 764847d36c
ℹ️ 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. Another round soon, please! 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
This removes the known test flakes (findings A1, A3 and A4). It also raises the command-tree exit-confirmation budget from 2 s to 10 s (owner decision 3).
close()then cancels that run, and replaying withu64::MAXappended 3 extra messages. Bothrevision_notices_across_reactive_checkpoint_overflow_reopen_in_orderandclient_revision_notice_reopens_as_the_exact_model_windownow replay only through the user run's prompt ordinal. The second test also now waits for its run to finish (finished_for(run)), not just anyRunFinished.retire_delivery_history. The helper deleted fromeventsthrough a second rusqlite connection while the store could be in the middle of a write. That made the runtime itself fail withsession persistence failed: sqlite reported DatabaseBusy. A#[doc(hidden)] SessionRuntime::expire_delivery_history_for_testnow prunes the journal on the store worker, using the productionevents::prune, which keeps the usage meter consistent. Two other live-store raw deletes insrc/headless.rsnow use the same seam. The one incanonical_reply_channel_order_survives_database_maintenancecloses the store first, so it stays as it is.EXIT_CONFIRMATION(10 s) now replaces the fixed 2 s budgets inreap_watcher,confirm_stoppedandnative_exit::confirm. Confirmation still finishes as soon as the exit is seen: on Linux it waits on pidfdpoll, elsewhere it polls every 10 ms. So only the failure path waits longer. With the change,cancel_and_timeout_kill_descendants_that_left_the_grouptakes 6.2 s → 6.1 s,a_yielded_escaped_tree_dies_when_the_run_ends2.1 s → 2.0 s, anda_killed_server_takes_its_commands_with_it0.04 s → 0.03 s.process_has_exitedreads the/proc/<pid>/statstate and treatsZ/Xas exited; non-Linux platforms keepkill(pid, 0).assert_process_exitsand the orphan test use it. Escaped processes get reparented to init or a subreaper, sokill(pid, 0)was measuring how late that process reaps them.$PPID $$to a fifo in the test workspace before theyexec sleep. That replaces spawningps -Ain ayield_nowbusy loop for up to 10 s, and probing fortimeout/setsidby running subprocesses (they are now looked up onPATH). All synchronous setup and/procreads run on the blocking pool.Verification
The loaded-core recipe is the one from the findings: 3 busy loops pinned to core 0,
taskset -c 0 cargo nextest run --profile ci --stress-count 100.goals::revision_notices_across_reactive_checkpoint_overflow_reopen_in_order--retries 0)goals::client_revision_notice_reopens_as_the_exact_model_window--retries 0)retire_delivery_historycallers, 8 busy loops on 2 cores,-j 8,--retries 0, 300 iterationsforeground_goal_reopen_replays_work_before_client_adoption: DatabaseBusy)prctl(PR_SET_CHILD_SUBREAPER)+waitpidon its own child only)a_killed_server_takes_its_commands_with_it(run 40810178056: 10.07 s, then "outlived").tools::shell::exit_tests::an_unreaped_zombie_counts_as_exitedanda_running_process_has_not_exited. The first makes a real zombie withwaitid(WNOWAIT)and asserts thatkill(pid, 0)still succeeds on it while the helper reports it as exited.cargo xtask check: passed one4321b4c.No tests were deleted or renamed. One sleep moved with its function, so its line number in
xtask/src/legacy-sleeps.txtchanged (4802 → 4796); the count stays at 11/11.Known impact
STOP_OBSERVERS(pid-keyed) andTEST_EXECUTIONS_STARTED(process-global). Neither appears in any recorded failure, and fixing them means changing the observer API for tests outside this scope. They are listed as follow-ups.a_detached_daemon_…"did not start serving within 30s"). It was seen once, and I could not reproduce it without Windows. Follow-up.