Repository navigation
Description
Context
Static audit of 5,331 Rust test functions in crates/, tests/ and xtask/ on 2026-11-26. The full per-test inventory is test-wait-audit.md (section C, rows marked M).
327 tests carry at least one machine-sensitive time constraint: a real wall-clock upper bound, a real lower bound, an explicit timeout <= 5s, or a direct sleep >= 500ms.
Shape
| Marker | Tests |
|---|---|
real elapsed() upper bound |
20 |
real elapsed() lower bound |
11 |
explicit timeout <= 5s |
280 |
direct sleep >= 500ms |
22 |
The categories overlap; the total is 327. By area:
| Area | M tests |
|---|---|
| app-server | 174 |
| capabilities | 51 |
| integration | 32 |
| dimcode | 13 |
| goal | 11 |
| oauth | 9 |
| aimux | 7 |
| scheduler | 7 |
| cli-lib | 6 |
| acp | 6 |
| modality | 3 |
| runtime | 3 |
| session-title | 2 |
| event-hub | 2 |
| codemode | 1 |
Tightest explicit timeouts: 10 ms (4 tests), 20 ms (2), 25 ms (2), 30 ms (4), 50 ms (several). The 20 upper bounds range from 1 s to 60 s; examples:
crates/dim-app-server/src/methods/tests.rs:432— upper 1 scrates/dim-agent-capabilities/tests/hooks_flow.rs:1661— upper 1200 mscrates/dim-agent-capabilities/tests/hooks_flow.rs:3345— upper 4 scrates/dim-agent-capabilities/tests/hooks_flow.rs:1402,1815— upper 5 scrates/dim-agent-runtime/tests/lifecycle_review.rs:199— upper 5 stests/integration/tests/named_parts.rs:593— upper 5 scrates/dim-agent-capabilities/tests/host_platform_flow.rs:891,927— upper 5 scrates/dimcode/tests/cli_flow/daemon_startup_progress.rs:352,439— upper 60 s (debug-only)crates/dimcode/tests/cli_flow/daemon_startup_progress.rs:648,858— upper 30 s (debug-only)
Prior individual fixes: #1593, #2193, #1728, #836, #291, #807, #1935.
Acceptance criteria
- Classify each
Mrow as semantic timing or a hang guard; do not use one bound for both. - Semantic timing uses
start_paused,ManualClockorFixedClockwhere the delay is not the subject. The scheduler and settings tests already have these paths. - Only behavior whose subject is real time (process startup, network expiry, watchdog) remains wall-clock; it moves to a dedicated timing job with an explicit runner budget.
- A hang guard is derived from the operation it guards and names the predicate; an arbitrary 1 s/5 s is replaced by a completion event where one exists.
- Verify on a loaded runner: no test fails solely because the runner is slow, and a stalled test fails with what it waited for.
- Keep the ignored measurement harnesses out of ordinary CI.
Out of scope: merely relabeling a test to #[ignore] without a replacement path or a dedicated job.
Batching plan
The M label mixes three different things. Split by what the time is doing, not by the flag:
- Guard: a 5 s/10 s bound around a wait that is not the behavior under test. Give the file one shared guard or a helper; do not tune each number.
- Semantic bound: a short timeout or
elapsed()that the test asserts. Use a paused clock (advance) or an event gate; do not just raise the bound. - Poll loop:
sleepuntil a condition. Fix it with tests: convert in-process polling waits to event waits #2215 or tests: replace external process/file polling waits with exit or output events #2216; do not count it again here.
One PR = one file or one helper. Split a file when it contains guard rows and semantic rows.
| Batch | Scope | M rows |
Split |
|---|---|---|---|
| 1 | mcp_session_flow |
19 | 8 pure 5 s guards; 10 poll loops to #2215 |
| 2 | transport_flow/sessions |
17 | 5 s guards and poll loops |
| 3 | mcp_http_flow |
16 | 5 s guards and poll loops |
| 4 | session_typescript |
12 | 5 s guards |
| 5 | transport_flow/approval |
9 | 6 guards; 3 short semantic |
| 6 | transport_flow/reload |
12 | 6 guards; 6 polls |
| 7 | dim_oauth_flow |
9 | semantic; paused clock |
| 8 | goal_parts_flow + goal_evaluator_flow |
12 | 750 ms semantic; paused clock |
| 9 | branch_flow remaining |
9 | guards and short semantic |
| 10 | context_reads, context_flow, host_flows |
~20 | one file per PR |
| 11 | local_execution, tool_binding, prompt_lifecycle |
~21 | one file per PR |
| 12 | daemon_startup_progress |
7 | gated by #2218; lower priority |
Start with batch 1 after the shared until_events work in #2215, because most of its poll rows disappear there.
Activity
eric8810 commentedon Nov 26, 2026
Parent tracking issue: #2219. Full audit inventory: https://gist.github.com/eric8810/d47cf3c4441230360546a448d7809818
eric8810 commentedon Nov 26, 2026
Evidence from PR #2224 (
dim/2217-hooks-timing, run 45764743678): the Linux verify job failed on two App Server timeouts unrelated to the hook test in the patch:managed_oauth_flow::the_managed_grok_route_takes_only_the_native_xai_image_formats—the device login did not complete after the token response: Elapsed(())at the 3 s wait after the token response.storage_flow::a_cold_read_failure_preserves_the_record_and_other_session_progress—the read failure remained local to the operation: Elapsed(())from the test-level timeout.Both are in the
Minventory. The hook test itself passed on the same runner. The failed job was rerun; the patch was not changed for these failures.eric8810 commentedon Nov 26, 2026
Merged #2224 at
3edabc0b. The asyncPostToolUsetest no longer uses a 1.2 s upper bound, a fixed 2 s sleep, or a 1.5 s fixture sleep: the async handler is gated, its marker is published by atomic rename, and the test waits for markers. The remainingMinventory stays open in this issue.eric8810 commentedon Nov 26, 2026
PR #2223 Linux verify (job 139751447908) failed before the dedicated debug step on:
branch_flow::an_ended_line_wakes_the_wait_of_the_main_that_opened_it—the wait is still waitingatcrates/dim-agent-capabilities/tests/branch_flow.rs:8056.The test starts
tool:wait {"timeoutMs":3000}, waits for the ToolUse event, then asserts no later ToolResult. Under load the 3 s wait can finish before that assertion, so the failure measures runner progress, not the test’s behavior. The PR changes only CI routing/docs/test gating; the job was rerun and the new verify attempt is in progress.eric8810 commentedon Nov 26, 2026
PR #2229 Linux verify (job 139793876277) failed on unrelated startup/timeout tests after the branch-flow fix:
transport_flowtests (mcp_import::*,product_protocol::mcp_*) panicked attransport_flow.rs:405becauselaunch_withhit the default 10 sstartup_timeoutwhile the assembly rows were still Pending.managed_oauth_flow::the_managed_grok_route_takes_only_the_native_xai_image_formatshit the 3 s attempt-status wait again.The branch-flow tests this PR changes passed. The failed job was rerun.
eric8810 commentedon Nov 26, 2026
PR #2233 Linux verify (job 139860921466) failed on two unrelated tests after the managed-OAuth helper change:
storage_flow::a_cold_read_failure_preserves_the_record_and_other_session_progress—the read failure remained local to the operation: Elapsed(())from the test-level timeout again.model_startup::temporary_startup_rebinds_after_restart_and_preserves_parent_cut_connections—Framework(PluginFailed(Closed(...)))while waiting for the detached Session to unload.The managed-OAuth tests this PR changes passed; the failed job was rerun.
eric8810 commentedon Nov 27, 2026
PR #2255 Linux verify (job 140307014640) failed on
context_flow::product_summary::compaction_chunks_images_as_markers_and_legacy_screenshots_as_textatproduct_summary.rs:67:Storage("unknown session …")inside the 10 s compaction poll. The PR changes only the replacement-daemon accept wait; the failed job was rerun.eric8810 commentedon Nov 29, 2026
Closing after this session. Completed guard slices: #2224, #2233, #2314 and #2336. The remaining M file batches are not done; they are recorded in the audit gist. No active PR.
eric8810 commentedon Nov 29, 2026
Reopening: the M batches are not done. Closing as not planned was premature; guard slices #2314/#2336 advanced it, but the file batches remain.
eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A8 goal-parts/evaluator machine-sensitive time
Verdict: split
Current evidence
750msbounds, all negative assertions. Gate-arrival class (6):goal_parts_flow.rs:1022timeout(750ms, second.arrived())wheresecondis a secondhold_stage(Stage::Decision, first.sequence)(:982);goal_parts_flow.rs:1127,:1228,:1339timeout(750ms, again.arrived())onhold_stage(Stage::Record, interrupt.sequence)—:1325already states "The bound only keeps the case from waiting forever";goal_parts_flow.rs:1600andgoal_evaluator_flow.rs:1040timeout(750ms, pause.arrived())onhold_stage(Stage::Append, ..). Write-absence class (3):goal_parts_flow.rs:792,goal_evaluator_flow.rs:692,:1313runtimeout(750ms, loop { env.settled/writes + sleep(10ms) }), a bespoke copy ofEnv::settled(tests/support/parts.rs:1614, stable 10×10ms).Env::dispatched(support/parts.rs:1170),Stage::Donefired unconditionally afterdo_turn_end_innerreturns (src/branch.rs:1988-1999),Stage::Releasedat the end of everyrecord_innerincl. failure (src/branch.rs:1534-1541), and the failure path itself — a failed changerelease_settlement()s and leaves the deferred interrupt "for a later settlement that succeeds" (src/branch.rs:744-756), so its RPC reply is terminal.tokiodev-dependency hastest-util(Cargo.toml), but every case is#[tokio::test(flavor = "multi_thread", worker_threads = 2)](29 in parts, 18 in evaluator) andstart_pausedis current-thread only; more decisively, these waits bound absence, not a scheduled delay, so advancing time proves nothing.Proposed change
src/testing.rs: add one accessor per hold type,pub fn taken(&mut self) -> Option<u64>backed bympsc::UnboundedReceiver::try_recv, onHeldStage,HeldWrite,HeldFold(testingfeature only, ~3 lines each).timeout/.is_ok()pair and assertassert!(gate.taken().is_none(), msg)after the terminal signal the case already awaits —failure.await(:1022),pause's error reply from the existingtokio::join!(:1127,:1228,:1339),env.wait_for(kind="continuation")(:1600,evaluator:1040, which today samples the gate before that barrier). Each of those paths returns only after the held stage could have been reached, so absence becomes a property, not a 750ms sample. No new stage hooks.hold_stage(Stage::Done, <deciding fact>)before the Queue emit, await its arrival, release, then a singleenv.settled("main")absence assertion. The durable fix is a barrier overState::decision_tasks(src/branch.rs:412,TaskTracker), since a decision deferred to a later settlement is invisible toStage::Done.goal_beta_flow.rs:26(NEGATIVE) is the same class and should disappear with that barrier.Risks / exceptions
taken()is a singletry_recvsample: sound only after a barrier that proves the producing task ended; keep the per-case15s/WAITtimeout on that barrier so a broken barrier fails instead of hanging. Keepsettled(),dispatched()as they are.Stage::Donedoes not cover a record restated after a rebuild, which is why the poll-class sites stay with tests: convert in-process polling waits to event waits #2215 rather than being forced onto it.Dropalready releases, so a converted case cannot leave a stale hold for a later case.taken()after the barrier still fails when the second decision or the deferral take-up really happens.Suggested PR
Files:
crates/dim-goal/src/testing.rs,crates/dim-goal/tests/goal_parts_flow.rs,crates/dim-goal/tests/goal_evaluator_flow.rs. Split: this PR does the 6 gate-arrival sites plustaken(); the 3 write-absence sites go with the #2215 quiescence barrier (andgoal_beta_flow.rswith them).Verify:
cargo test --locked -p dim-goal(all cases live in the singlegoal_suitetarget; the dev-dependency enablestesting), thencargo clippy --workspace --all-targets --locked -- -D warnings.4 remaining items
eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A9
branch_flowremaining machine-sensitive timeVerdict: split
Current evidence
soon, branch_flow.rs:41) around event-driven waits:a_stale_note_is_replaced_once12205 (not in the audit's nine rows),a_move_that_stopped_between_its_fact_and_its_notes_is_completed_at_load12531,a_restore_writes_the_owed_note_before_the_line_answers12670,a_move_committed_before_its_writer_starts_still_owes_its_note12811,a_close_waits_for_an_admitted_move_and_a_restore_reads_its_fact13076/13100. Each wraps a loop overHeldWriters::arrived()(timeline_tree.rs:61, mpsc), so the number guards nothing but the runner.data_creation_releases_its_cancellation_wait_when_the_caller_leaves2936:timeout(1s, released.cancelled()). The token is cancelled by thedrop_guardmoved into the call-owned future, dropped atdrop(waiting)2934 — no clock involved.an_ancestors_end_closes_a_pending_end_whose_delivery_was_held8985 and an inline 30 s at 6698 that duplicatespatient(branch_flow.rs:47).closing), 11111 (150 ms onended), 12960 (150 ms onnext), 13073/13097 (150 msselectwindows). These are the assertion, not a guard.for _ in 0..500 { sleep(10ms) }12381 andsleep(500ms)12429; pre-armsleep(50ms)11087, 11143, 12895, 13121; loops 1942/2088/2313/2615/2690/7824; helpersuntil_branch3742,settle_line3753,wait_new_line4466,quiet4495,second_parent_block6307,owed_notes12735,answers_default12752,records_end12766,support::Committed::next(support/mod.rs:98).until_events3603 is already event-driven (test(branch-flow): wait for committed events in until_events #2244).Proposed change
PR 1 (guards + the one exact semantic site):
drop(waiting)assertreleased.is_cancelled().held_writers(&mut HeldWriters, lines: &[&str])that loopsarrived()undersoon, panicking"the writers of {lines:?} never stopped at the test seam"; call it at 12205, 12531, 12670, 12811.soon(&mut closing); 8985 →patient(ender); 6698 →patient(...).assert!(futures_util::poll!(&mut closing).is_pending(), "close waits for the held dispatch"), the idiom already used at 13766/13826.StopInterrupthas committed andprobe.child_builds == 0, so the future is provably at its blocking point; the clock adds nothing.PR 2 (tests: convert in-process polling waits to event waits #2215 hand-off): the poll rows above. No semantic row changes value.
Risks / exceptions
#[tokio::test(flavor = "multi_thread")], wheretokio::time::pause()is unavailable, so no paused clock exists. A singlepoll!there is weaker than a window: those futures have not been driven to their blocking point, and only a window catches an answer landing a few milliseconds early. Keep the numbers as they are.quiet(&session, &line)(4495).Suggested PR: one PR,
crates/dim-agent-capabilities/tests/branch_flow.rsplus the helper incrates/dim-agent-capabilities/tests/support/mod.rs. The remaining poll rows are a separate #2215 PR, so the split is by issue, not by file. Verify withcargo test --locked -p dim-agent-capabilities --test branch_flow.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A6
crates/dim-app-server/tests/transport_flow.rsVerdict: split — every 5 s / 10 s / 20 s / 30 s bound in this file is a hang guard (one helper); the startup, handshake and write bounds are the behavior under test; the three poll loops belong to #2216/#2215.
Current evidence
Duration::from_secs(5)::1342timeout(5s, cleanup.entered.notified());:1370,:1395,:2011timeout(5s, server.join())afterserver.shutdown();:1664,:2127,:2327child stdoutunixPathline;:2150outer bound over the fd-exhaustion loop (10 ms retry sleep:2161);:2248,:2261,:2286,:2373,:2393wait_with_output()of a child that must exit;:2358recovered.wait();:2384foreign.accept().:1199timeout(10s, server.join());:1401timeout(1s, client.response(100))afterforce;:1549EOF read gated byhello_timeout:1527;:565timeout(20s, session.closed());:2875,:3014hold.waiting.notified();:332/:360Client::read/response30 s;:241230 s around the whole external-binary flow.startup_timeout2 s at:694/:726/:754, 500 ms at:775, 1 s at:586, withlaunch_inner:446-451widening only an untouched default (65c225a);hello_timeout100 ms:1527;write_timeout2 s:1758; note coalescingASSEMBLY_REPORT_INTERVAL = 500 ms(src/storage/sqlite.rs:983) driving fixture sleeps:2814(700 ms),:2936(50 ms),:2941(1500 ms),:3024(700 ms) and the file's only elapsed assertionseen - reported <= 800:3004.:1803-181220 ms poll ofdaemon.ping.connections; no fact exists (protocol.rs:945lists onlydaemon.ping/daemon.shutdown,ConnectionHub::counthas no notification).:2856-287050 ms and:2988-300120 ms polls of the.startupnote file.:1349timeout(30ms, client.response(id))is the "not premature" window;:3024is the "no trailing write" window.Proposed change
transport_flow.rs—const GUARD: Duration = Duration::from_secs(30)plusasync fn guarded<T>(what: &str, work: impl Future<Output = T>) -> Tthat panics namingwhat— and use it at:1342,:1199,:1370,:1395,:1401,:1549,:2011,:2875,:3014, each call naming the event it waits for ("daemon shutdown after cleanup", "cleanup entered", …).Client's 30 s andunloaded's 20 s already name their wait and stay. No external bound moves here.pub fn assembly_report_interval()underfeature = "testing"besideset_upgrade_report_delay(sqlite.rs:1234), and derive:2814,:2936,:2941,:3024and:3004from it instead of the literal 700/50/1500/800 ms;:3004keeps one interval-derived bound, and the existingin_applyassertion carries "before the row finished".AssemblyProgress::progress,sqlite.rs:1014), so thetake_upgrade_stepsshape (sqlite.rs:1284) — recorded counters plus aNotify— replaces both file polls and leaves one file read as the assertion.:1803has no event source; leave it until tests: convert in-process polling waits to event waits #2215 gives connection count a fact, with the guard kept abovewrite_timeout.:1349and:3024stay: both are the assertion, not a wait.Risks / exceptions
multi_threadruntime, sostart_pausedwould auto-advance pasthello_timeout/write_timeoutand stop proving the flow. The two note tests are genuinely wall-clock and also belong in the timing job from ci: separate debug-only and measurement tests from ordinary workspace verification #2218 (ci.yml:986is the pattern).:1349can only miss a bug, never false-fail.ulimit -n 64; its 10 ms retry is the documented macOSConnectionRefusedworkaround, not a poll.:2814below one interval would stop the counter from rising.Suggested PR
crates/dim-app-server/tests/transport_flow.rsonly.crates/dim-app-server/src/storage/sqlite.rs+tests/transport_flow.rs.cargo test --locked -p dim-app-server --test transport_flow -- --test-threads=4, plus the threeprocess_startup_timeouttests andsession_initialization_timeout_and_missing_dependency_fail_the_creationby name.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A12 scattered machine-sensitive time
Verdict: split
Current evidence (current tree; audit line numbers drifted, tests located by name)
crates/dim-app-server/tests/managed_oauth_flow.rs:567,578,798,803— 3 s/1 s aroundf.started.notified(),f.release, and joining a cancelledcomplete_browser; every signal is aNotify.crates/dim-agent-runtime/tests/lifecycle_review.rs:85,89,99,151,157,161,171— 2 s around the same threeNotifys plus joins.crates/dim-app-server/tests/storage_flow.rs:5951— 5 s ondb.close();:559730 s and:55485 s on a child daemon's stdout/stderr.crates/dim-modality/tests/modality_flow.rs:6477— 5 s onwait_terminal.crates/dim-app-server/src/methods/tests.rs:293is alreadyG(whole-flow 10 s).managed_oauth_flow.rs:1023-1030,1404-1410,1775-1781— 10 stimeoutaroundwhile f.device_successes.load(..) == before { sleep(10ms) }, thenwait_for_login(:316, 30 s, test(managed-oauth): give device login completion a load-tolerant budget #2233).storage_flow.rs:5846— 1 ms reopen loop.crates/dim-agent-capabilities/tests/interrupt_flow.rs:721— inline 5 mswhile !chain_events(..)although the file already hasuntil_events(:855).managed_oauth_flow.rs:904-916lowerelapsed() >= 8 sforslow_down,:941sleep(1100 ms)forexpires_in:1; the poll interval comes from the fixture and noClockis injectable indim-oauthor the app-server OAuth plugin.modality_flow.rs:4343,4351— 3 ×sleep(6 s)lease holds andelapsed() >= 18 sstartup recovery;start_in_with_clockfakes timestamps, not timers.modality_flow.rs:5109—elapsed() < 20 s"the FIFO did not block" (macOS-only), redundant withwait_terminal.methods/tests.rs:540—elapsed() < 1 sbounding synchronous rejection of four bad names including a 262 KB one: CPU-speed assertion, cannot hang.lifecycle_review.rs:9310 ms,interrupt_flow.rs:28510 ms,interrupt_flow.rs:73525 ms,storage_flow.rs:599310 ms. 58 such sites repo-wide.storage_flow.rs:6850cold read (test(storage): use a flow guard in the cold-read failure test #2315), managed device-login budget (test(managed-oauth): give device login completion a load-tolerant budget #2233), hooks (test(hooks): wait for async hook markers instead of sleeping #2224). Section-C rows ofmcp_session_flow,transport_flow/*,dim_oauth_flow,goal_*,branch_flow,context_*,local_execution/tool_binding/prompt_lifecycleanddaemon_startup_progressbelong to A1-A11/A13.Proposed change
SETTLED(storage_flow.rs:200) at:5951; add the same shape tolifecycle_review.rsandinterrupt_flow.rs, which already hassoon(:26).wait_for_loginstays.assert!(!stop.is_finished())atinterrupt_flow.rs:285,!close.is_finished()atlifecycle_review.rs:93(pattern already atmethods/tests.rs:316), andpoll_fn(.. is_pending())atstorage_flow.rs:5993, matching:5826in the same file.interrupt_flow.rs:721→ existinguntil_events; giveFixtureadevice_success: Arc<Notify>signalled next todevice_successes.fetch_add(managed_oauth_flow.rs:147) and wait on it at the three sites.methods/tests.rs:540andmodality_flow.rs:5109; the result assertions stay.slow_down, 1100 ms expiry and the retention 6 s/18 s row, until the device flow and modality startup take an injectable clock.Risks / exceptions
start_pausedcannot apply; those rows need a timing route (ci: separate debug-only and measurement tests from ordinary workspace verification #2218 closed) or owner-side clock injection.storage_flow.rs:5514,5885unix-only;modality_flow.rs:5070macOS-only.is_finished()can pass before the task is polled; keep it paired with the terminal-error assertions so an early return still fails. Droppingelapsed() < 1 sloses the only check that huge names are rejected quickly.device_successestests resetf.pollsbeforebegin_device, so the notify must fire on the success branch only at:147.Suggested PR
managed_oauth_flow.rs— fixtureNotify+ onetoken_response(&f)helper replacing:1023,:1404,:1775. One file, 3 rows.cargo test --locked -p dim-app-server --test managed_oauth_flowstorage_flow.rs—:5951→SETTLED,:5993→ poll-once.cargo test --locked -p dim-app-server --test storage_flowlifecycle_review.rstheninterrupt_flow.rs— guard constant, pending samples,until_events.cargo test --locked -p dim-agent-runtime --test lifecycle_review,cargo test --locked -p dim-agent-capabilities --test interrupt_flowmodality_flow.rsneeds a clock decision first; do not fold them into a guard PR.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A2
transport_flow/sessionsVerdict: split
Current evidence (HEAD
7b78aac17; 32Duration::from_secs(5)sites across 19 tests plus 2 test helpers):published_afterwaitspublication().watch()(sessions.rs:1362-1386, guard at 1365);gate.entered.notified()(1418, 1516, 1587, 2880, 3227); spawned-call joins (1198, 1243, 1458, 1548, 1615, 3265, 3279);held.recv()onDeferredInputs(2442, 2489, 2564, 2582, 2804); row-viewwatchtoUnloading(2497, 2750);rules.held.notified()(2745);legacy.watch().wait_for(2668); socket EOF after shutdown (3062). None readselapsed(); none asserts a lower bound.server.restart("Agents")(2568) andloader.restart("session-node")(2822).RunningServer::restartends inwait_active(startup_timeout)(src/lib.rs:327-354), this binary raises that deadline to 30 s because "a whole-suite run can make assembly slower than the product's 10 s default" (transport_flow.rs:446-451), andClient::readis 30 s (transport_flow.rs:331-333). 5 s is stricter than the harness budget for the same operation.event_written'schain_eventsloop (1029-1042, called by everyawaiting_approvaltest),write_published's 10 ms retry loop with no deadline at all (198-209),publication.has_pending()(1001, 3049),get::<PermissionState>().is_none()(1921 with a 10 ms sleep, 2367 withyield_now),agent.sessions()+ attach (2043), thehistoryprobe untilreloading(2449). Same class above 5 s: 2983, 3346, 3357.!is_finishedat 1126, 1778, 1191, 2038, 2507, 2829.#[ignore]node tests (2367, 2442, 2489, 2497, 2745, 2750, 2804, 2822).Proposed change
sessions.rs—const GUARD: Duration = Duration::from_secs(30);andasync fn guarded<T>(what: &str, wait: impl Future<Output = T>) -> Tthat panics withdeadline: {what}— used at the 23 guard sites and the two restart sites; each call names its predicate (e.g. 1458 "the withdraw replies while the close waits for its interrupt"). The existing named-predicate precedent isdeletion::eventually(deletion.rs:131). What stays: every guard (a stalled test must fail;cargo testhas no per-test deadline), all assertions, every 50/100 ms window.write.awaitalready returns the commit and 1011 asserts it stays pending); rewriteevent_writtenonpublication().watch()likepublished_after; givewrite_publisheda bounded, named retry;dispatch_watch().wait_for(|d| d.sequence >= publication.sequence())for 2983; consumed/approval event scans for 3346/3357.Risks / exceptions
Client, raisedstartup_timeout); the only cost is that a genuine stall reports 25 s later.Agent::sessionsis a snapshot, 2043); a committed-but-unpublished append (1001, 3049); Permission's cell being re-provided after a reload (on()returnsNonewhile the part is unloaded, 1921/2367 —Session::oncannot observe re-provision). TheHeldRulesfixture (sessions.rs:261-296) can expose a "provided again" notify, which is the cheapest signal to add.Setup::store(asDeferredInputsdoes,src/agents/sessions/tests/deferred_inputs.rs), not a larger number.RunningServer, SQLite lock contention and index reloads on a multi-thread runtime;start_pausedcannot replace these waits.input_replies_after_publication...(1020) andpending_waits_for_published_input_dispatch...(3245/3260/3273): they assert "still waiting" and stay wall clock.Suggested PR
crates/dim-app-server/tests/transport_flow/sessions.rsonly — addGUARD/guarded, convert the 25 guard sites, no test-logic change. Verify:cargo test --locked -p dim-app-server --test transport_flow -- sessions::Refs #2215): the helper and poll conversions above; split ifevent_written/write_publishedexceed about 30 call sites.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A10 context_flow, context_reads, host_flows
Verdict: split
Current evidence
elapsed()bound or asleep >= 500ms; everyMrow is an explicittimeout <= 5saround a wait that is already event-driven.context_flow.rs:1382,1634,1741,1752,1757,1803,1900—timeout(3s, session.idle("main")).Branch::idle(crates/dim-agent-runtime/src/timeline_context.rs:1037) is the completion event; the 3 s only decides when a hang fails, and:1634already names its predicate ("recovery stuck at {boundary}").context_flow.rs:2139timeout(3s, gate.entered.notified()),:2165 timeout(3s, stop)— same shape.context_flow.rs:2145andcontext_reads.rs:2167—timeout(3s, loop { select! { dispatch.changed() => {}, sleep(10ms) => {} } }): the event exists; the 10 ms arm is only a spare tick.context_reads.rs:1059,1481,2517,2522,2537,2552,2721,2728(10s),:1572,1703,2367,2811,5914(5s),:1528(1s),:5537(15s) — whole-test or whole-step guards;:1528wraps atimeline_eventsread that must not need publication (the assertiontimeline.sequence() == 0carries that, not the 1 s).context_reads.rs:1774—let premature = timeout(25ms, &mut stop)assertingstophas not settled while the turn/end publication is held. Here the window is the assertion; the repo's idiom isassert!(!task.is_finished())(branch_flow.rs:3227,transport_flow/sessions.rs:1021).host_flows.rs:1214,2910,2999,3083,3263,3423,3834,4410(5s),1285,1366,1435,2594,3614,3862,3928,3992,4060,4123,4188,4235(10s),2195,2419(15s) — whole-test guards around event waits. The file already holds the target state:#[tokio::test(start_paused)]+advance()for real-time subjects (:2635-2751,:2878), and:3545documents why a timeout there is only a liveness guard; no wall-clockelapsedassertion is left outside a paused test.context_reads.rs:2537(10 ms tick),:2811(yield_nowspin onstore.query_kinds),:5914(5 ms tick onToolSourcesView::get),:1450(1 ms fixture hold): tests: convert in-process polling waits to event waits #2215.ToolSourcesView::subscribe()already exists (crates/dim-agent-capabilities/src/tool_registry.rs:214) andmcp_session_flow.rs:793already waits that way.Proposed change
context_flow.rs(and throughuse super::*itscontext_flow/submodules): add once, next to the builders,then replace the duration argument of every
tokio::time::timeout(...)withFLOW_GUARD— 16 sites incontext_flow.rs, 19 incontext_reads.rs(all but:1774). Keep each.unwrap()/.expect("…")message and every assertion; nothing else changes.context_reads.rs:1774: delete the 25 ms window; beforerelease.notify_one()addassert!(!stop.is_finished(), "stop settled before turn/end {end} publication").assert!(returned >= end)stays.host_flows.rs(separate binary): the sameFLOW_GUARD, applied to all 24timeout(sites, the paused tests included (there the value is irrelevant — the timer fires only when the flow is stuck).context_reads.rs:5430 startup_timeout(120s)is the fixture profile's own no-progress setting for paging 1,200 refreshes, not a test bound.Risks / exceptions
is_finished()is sound here only because the spawnedstophas been through many awaits sinceends.recv(),reload.restart()and the generation loop, and cannot finish while the publication is held. Keepworker_threads = 2; on a single worker the check would be weak.5914should move tosubscribe()/borrow_and_update()first.Suggested PR
crates/dim-agent-capabilities/tests/context_flow.rs(const + 16 sites) —cargo test --locked -p dim-agent-capabilities --test context_flowcrates/dim-agent-capabilities/tests/context_flow/context_reads.rs(19 sites + theis_finishedassertion) —cargo test --locked -p dim-agent-capabilities --test context_flowcrates/dim-agent-capabilities/tests/host_flows.rs(const + 24 sites) —cargo test --locked -p dim-agent-capabilities --test host_flowsRefs #2217.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A4 transport_flow/approval
Verdict: split
Current evidence
approval.rs:251,:334(insidegate,:329-337),:386,:721,:942,:1075,:1500wait onprobe.entered/cancel_entered(Notify, notified by the probe's dispatcher handler at:150/:77);:817waits onHeldPublication::arrived(mpsc, storage/timeline.rs:122), released by:831.:871session.closing()(sqlite trigger failure),:948/:1022the spawnedapproval.admit,:1365server.restart("Rpc"),:1421probe.tools.restart().:339(wait_events:338-356,yield_now+chain_events) and:998-1004(while !timeline.has_pending()).RunningServer::restartbounds only activation,wait_active(startup_timeout)(crates/dim-app-server/src/lib.rs:351);view.restart()(rutisfiber.rs:2135) andloader.restarthave no deadline. The module already raisedstartup_timeoutto 30 s because "a whole-suite run can make assembly slower than the product's 10 s default" (transport_flow.rs:446-451), whileClient::readuses 30 s — so 5 s is the outlier, not the norm.:402100 ms,:47930 ms,:735100 ms,:1012100 ms. Two have exact observable substitutes:session.historyblocks ondispatch.state.sequence < through(crates/dim-app-server/src/connection/tree.rs:289-320) andApproval::respondreturns only when its registered oneshot is resolved by dispatch (crates/dim-agent-capabilities/src/approval.rs:379-403).Dispatcher::sequence()is public (crates/dim-agent-runtime/src/core/dispatcher.rs:266) and advances after handlers (:299-307), andProbealready stores the dispatcher (:1198usesfail).Proposed change
const SETTLE: Duration = Duration::from_secs(30)and one helperasync fn reached(notify: &Notify, what: &str)(timeout(SETTLE, notify.notified())+expectnaming the missed event). Replace the sevenprobe.*_enteredsites and useSETTLEfor:817,:871,:948,:1022,:1365,:1421. Mechanism unchanged; only the deadline and the panic message change, so a hang says which event never arrived instead ofElapsed(()).:402→ delete the 100 ms attempt; assertdispatcher.sequence() < headinline (that is the exact blocking condition intree.rs) and keep the reply assertions at:414-421.:479→ delete the 30 ms attempt; afterwait_events(..., "approval/respond", 2)read the second respond event's sequence and assertdispatcher.sequence() < seqwith the existing message.:735→ delete the loop; keep oneassert_eq!(calls…, 0, "a committed denial must block automatic admission before dispatch"). The post-release assert at:747catches a start that happens after the read. Stays: the gate and everything after release.:1012→ keep a no-progress window (shrink the name to a shared constant): it is the only check that admission does not finish while its terminal is uncommitted; the:1022await passes either way.wait_eventsand:998stay polling here; they are tests: convert in-process polling waits to event waits #2215's conversion (Line::dispatch_watchroute.rs:432,Line::publicationroute.rs:436,Timeline::watchcore/timeline.rs:944,has_pendingcore/timeline.rs:590).Risks / exceptions
Notifyholds one permit: if a gate fires twice between two waits, the guard is what reports it, so keep the guard and name the event.RunningServerover unix/ws sockets, a sqlite writer thread and rutis reloads;tokio::time::pause()would freeze those real waits.:1012keeps wall clock for that reason.Client::response_with_timeoutdrops a partially read socket line (transport_flow.rs:335-375). Remaining shortenedclient.responsecalls keep it.dispatcher.sequence() < seqstates "not delivered yet", which is the tested property; it does not detect a reply produced before its append, whichwait_eventsalready covers.Suggested PR
crates/dim-app-server/tests/transport_flow/approval.rsonly, no production change.SETTLE/reachedplus the real-work deadlines; (2) thedispatcher.sequence()conversions for:402and:479. Leave the poll conversion to tests: convert in-process polling waits to event waits #2215.cargo test --locked -p dim-app-server --test transport_flow approval::.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A11 integration machine-sensitive time (
local_execution,tool_binding,prompt_lifecycle)Verdict: split — 17
Mrows: 13 guards, 2 semantic bounds, 4 "still pending" windows that assert no time at all; 3 poll loops belong to #2215/#2216.Current evidence
tests/integration/tests/local_execution.rs:473— file-localuntilpollsbranch_events1500×20 ms and panics namingwhat. It is already the file's hang guard, so thetimeout(5s, until(...))wrappers duplicate it::754(started marker),:791,:796,:2012,:2923.local_execution.rs:781wrapssession.idle;:2706,:2770,:2808,:2829wraprestart/join!completions;:771(3 s) waits fordone-{n}before releasing the blocked offload;:766is the condvar self-release of that offload thread — a premature 5 s release silently drops the "drains before offload" premise.Harness::newwalks every process row withwait_active(..., 5s)at:419.tests/integration/tests/tool_binding.rs:285(adopted),:471(plugin_state) and per-test 5 s bounds:564,:590,:615,:698,:785,:862,:1017,:1026,:1381,:1400,:1519,:1543,:1554all wrap a completion event (watchwait_for,Notify,idle, plugin state) and assert nothing about 5 s.tool_binding.rs:1137pollsToolSourcesView::get()every 5 ms although the same file already usessubscribe().wait_for(...)at:1519.tool_binding.rs:1396,:1550— 150 mspublished.changed()/sources.changed()windows assert "nothing happened yet".tests/integration/tests/prompt_lifecycle.rs:1158,:1207— 50 ms windows on tasks held by hosts that block on aNotifyreleased later;:1951,:2084— 30 ms windows oncreationwhile the host still holdsrelease.prompt_lifecycle.rs:150520 s restore bound plus:1513elapsed() > 1 s; the fixture sleeps (200 ms steps) sum to ≥1.4 s, so slowness cannot fail it.:1491500 ms and:1897/:2033300 msstartup_timeoutare the subjects (inactivity deadline renewed by progress).prompt_lifecycle.rs::1216,:1562,:1927,:1946,:1961,:1982,:2071,:2092,:2098.Proposed change
tests/integration/tests/local_support/mod.rsthe app-server convention (crates/dim-app-server/tests/storage_flow.rs:203):pub const FLOW_GUARD: Duration = Duration::from_secs(60);andpub async fn settled<T>(what, fact).local_execution.rs: delete the fivetimeout(5s, until(...))wrappers —untilalready bounds and names its predicate; move:419,:766,:771,:781,:2706,:2770,:2808,:2829toFLOW_GUARD.tool_binding.rs: oneFLOW_GUARDforadopted,plugin_state,followand the listed test bounds; replace:1137withsession_service::<ToolSourcesView>().unwrap().subscribe().wait_for(...); replace:1396withassert!(!published.has_changed().unwrap(), ...)after the registry shows v2; delete therefreshedwindow at:1550— the existingassert_eq!(offered(&sources.borrow()), second)after close already detects a refresh; give it the message.prompt_lifecycle.rs:FLOW_GUARDfor the listed guards; replace:1158,:1207,:1951,:2084withassert!(!handle.is_finished(), ...)(each release comes later, so the state read is exact); keep the 1 s lower bound and the 300/500 ms deadline subjects.local_execution.rs:754,:771(tests: replace external process/file polling waits with exit or output events #2216);output_page/outputpolls:2012,:2923andprompt_lifecycle.rs:785(tests: convert in-process polling waits to event waits #2215).Risks / exceptions
is_finished()is valid only where the blocker is a laterNotify; never where the signal is a timer.published.has_changed()assumes no unrelated publication while assembly is held (true today).test-util, so these tests cannot usestart_paused;assembly.rs:185is tokio time, so paused-clock conversion stays possible for the 300/500 ms deadlines later.Harness::new's progress-basedwait_activealready names unmet rows; only its interval changes.Suggested PR: one PR per file plus the shared constant. Files:
tests/integration/tests/local_support/mod.rs,local_execution.rs,tool_binding.rs,prompt_lifecycle.rs. Verify per module:cargo test --locked -p dim-agent-integration-tests --test integration_flow local_execution:: -- --test-threads=4(repeat withtool_binding::,prompt_lifecycle::), thencargo clippy --locked -p dim-agent-integration-tests --tests -- -D warnings.eric8810 commentedon Nov 29, 2026
Batch analysis: 2217-A5
crates/dim-app-server/tests/transport_flow/reload.rsVerdict: split — 6 pure guards, 1 semantic, 8 polls (4 convertible now, 4 for #2215), 2 external.
Current evidence
tokio::time::timeout(Duration::from_secs(5), …)atreload.rs:152,163,228,317,329,464,469,479,688,775,783,794,810,884,892; 10 s at:188(set_read_timeouton a blockingUnixStream) and:213(restart("Connection")).:152/:464/:775/:884wait onstarted/enteredNotifygates (HoldTool:96-118,GatedModel:267-285);:810onstop(spawned:806);:213on a process restart that must settle while a child holds inherited descriptors.:251is a plain#[test]with a manual current-thread runtime,startup_timeout: 50ms(:269) againstsleep(250ms)(:275). The deadline is the subject; nothing else in the case is time-sensitive.:479(TurnEnd overchain_events) and:794(StopInterrupt) wait on committed facts, sosession.publication("main").watch()is the event (testing.rs:824,branch.rs:24) anduntil_events(branch_flow.rs:3603) is the existing shape.:783/:892pollsession.state("main").is_ok():SessionLines::watchis documented as “changes whenstate()may read differently” (testing.rs:818,timeline_context.rs:322), andstate()answersErrexactly while the Loop port is absent (timeline_context.rs:296-321).:163is a select probe for theservice_reloadingwindow (no sleep);:228retriessession.summariesbecauseRunningServer::restartwaits only for process plugins (lib.rs:322-355);:469/:688pollbranch_diagnosticsfor a Loop generation bump withFiberState::Active—FiberView::restartreturns when the row itself restarted, not its dependents,Loader::settledis not reachable from aserve()test, and the branch watch does not signal a fiber becoming Active;:909consumessession.statenotices bounded only byClient::read's 30 s message (transport_flow.rs:333).:317waits for the socket path (transport.rs:165 UnixListener::bind) and:329retries the bind after the dropped startup releases it.Proposed change
const SETTLE: Durationplusasync fn settled(what: &str, fact: impl Future) -> Tintransport_flow.rs, mirroringstorage_flow.rs:203-208, and use it at:152, 213, 464, 688, 775, 810, 884.:188keeps a wall-clock read timeout because it runs on a std thread. No behavior change..start_paused(true)to the builder at:253; keep the 50 ms deadline and the 250 ms release sequencing (now virtual).StartupProgressalready usestokio::time::Instant/sleep_until(assembly.rs:120,190), so virtual time drives it.:479and:794: subscribe topublication("main").watch()beforerelease/stop, re-readchain_events, wait onchanged(), fail naming “turn ended”/“interrupt written”. Convert:783and:892: takesession.watch("main")beforetools.restart(), then wait untilstate("main").is_err().:163,:228,:469,:688(client-retry and fiber-generation waits, no test-visible event), plus:909's notice loop — tests: convert in-process polling waits to event waits #2215 owns them; their 5 s bound becomesSETTLEwhen converted.:317/:329stay as polls; only the bound becomesSETTLE. Both name what they wait for.Risks / exceptions
servethat watches realstd::time::Instantwould never expire; today the startup deadline is tokio-only, andmax_blocking_threads(1)still forces the timeout path. Re-read the twoassert!(error.contains(...))lines after the switch.watchmust be subscribed before the action; a reload signal emitted in between is invisible towatch(last value only).:317/:329are OS/filesystem behavior with no event source, and are Unix-only.FiberState::Active, which is why:469is not converted.Suggested PR: split into (a)
transport_flow.rs+reload.rs: guard helper and the six guard sites; (b)reload.rs:start_pausedfor the startup-deadline case; (c) the four poll conversions with #2215's helper. Verify withcargo test --locked -p dim-app-server --test transport_flow -- reload::and, before/after (a),cargo test --locked -p dim-app-server --test transport_flow.eric8810 commentedon Nov 29, 2026
Review correction: 2217-A10 context_flow, context_reads, host_flows
Verdict: partially correct
What is wrong: the
host_flows.rsstep — "the sameFLOW_GUARD, applied to all 24timeout(sites, the paused tests included (there the value is irrelevant — the timer fires only when the flow is stuck)" — is wrong. Two of the 24 sites are inside#[tokio::test(start_paused = true)], where the guard is a virtual-time timer that competes with the flow's own virtual timers; its value decides whether the test fails. Lowering one of them from 600 s to 60 s breaks the test it guards. The site list enumerates only 22 of the 24 sites, which is what hides it.Evidence:
crates/dim-agent-capabilities/tests/host_flows.rs:2281-2283:#[tokio::test(start_paused = true)] async fn transient_retries_are_bounded_and_stop_after_irreversible_output() { tokio::time::timeout(Duration::from_secs(600), async {.:2289-2300) runs 11 fixture modes; modes 7 and 8 make 8 model attempts each (expected_calls,:2298-2300). The retry wait istokio::time::sleep(delay)(crates/dim-agent-capabilities/src/model_provider/recovery.rs:170) withBASE_DELAY1 s andMAX_BACKOFF30 s (recovery.rs:16-18): 1+2+4+8+16+30+30 = 91 s of virtual time for one such mode alone.start_pausedis already asserted in the same file:host_flows.rs:2738-2751drives the same retry path with noadvance()and assertsstarted.elapsed() >= Duration::from_millis(72_800).host_flows.rs:3543-3545(30 s), a raise to 60 s, harmless.A 60 s guard therefore fires inside mode 7's backoff, and the
timeout(...).await.unwrap()panics the test.Corrected conclusion: convert the 22 wall-clock sites (1214, 1285, 1366, 1435, 2195, 2419, 2594, 2910, 2999, 3083, 3263, 3423, 3614, 3834, 3862, 3928, 3992, 4060, 4123, 4188, 4235, 4410) to
FLOW_GUARDand leave the two paused sites (:2283at 600 s,:3545at 30 s) as they are. In a paused test a guard must stay above the flow's own virtual budget, so drop that rationale rather than "the value is irrelevant".The rest of the batch verifies correct: 16
tokio::time::timeoutsites incontext_flow.rs, 19 incontext_reads.rsexcluding:1774,context_reads.rs:1774→assert!(!stop.is_finished())(stopis aJoinHandlealready blocked at the publication, andreturned >= endstays), and the twoelapsed >= holddeletions in:1005/:1107— both fixtures answerhelloonly after the hold, andreleasedis stored afteroutput()returns (:986-987,:1089-1090), sooutput.status.success()already implies the wait outlived it.Impact: following the step as written makes
transient_retries_are_bounded_and_stop_after_irreversible_outputfail at 60 s of virtual time withElapsed— a green test turned red by the cleanup itself.eric8810 commentedon Nov 29, 2026
Review correction: 2217-A11 integration machine-sensitive time (
local_execution,tool_binding,prompt_lifecycle)Verdict: partially correct
What is wrong: two of the proposed replacements make a lower bound weaker than what the test asserts today.
prompt_lifecycle.rs:1207.closingis spawned on the line immediately before the window (:1205), and nothing has awaited it. Replacingtimeout(50 ms, async { while !closing.is_finished() { yield_now().await } })withassert!(!closing.is_finished(), ...)is vacuous there: on a freshJoinHandlethe task need not have been polled at all, so the assertion passes whateverclosedoes. Unlike the other threeis_finished()sites (:1158,:1951,:2084), where the handle is created before an awaitedstarted/cancelledhost signal, this one has no proof the task reached the held configure.local_execution.rs:771. That 3 sproducedbound must stay below the offload thread's own 5 s self-release at:766; it is not an interchangeable guard. Raising it toFLOW_GUARD(60 s) lets the condvar release first, so the drain completes at ~5 s andproduced.expect("all output must reach the pipe before releasing offload")(:780) passes in exactly the case the case exists to catch — the premise the comment itself names ("a premature 5 s release silently drops the 'drains before offload' premise"). The proposed PR also lists:771twice, once under "move … toFLOW_GUARD" and once under "Stay with tests: convert in-process polling waits to event waits #2215/tests: replace external process/file polling waits with exit or output events #2216: external marker pollslocal_execution.rs:754,:771".Evidence:
tests/integration/tests/prompt_lifecycle.rs:1205-1214:let closing = tokio::spawn(async move { agent.close().await }); assert!(tokio::time::timeout(Duration::from_millis(50), async { while !closing.is_finished() { tokio::task::yield_now().await; } }).await.is_err());tests/integration/tests/local_execution.rs:766:wait_timeout_while(done.lock().unwrap(), Duration::from_secs(5), |done| !*done);:771:let produced = tokio::time::timeout(Duration::from_secs(3), async { while !harness.cwd.join(format!("done-{attempt}")).exists() … });;:777-778setsreleased/notifies;:780produced.expect(...).Corrected conclusion: keep
:1207as a wait that first provesclosingis live — either keep the boundedis_finished()loop, or derive it from the signal that already exists (the held configure's host reply atstarted/finish) instead of replacing it with a bare check. Keep:771at 3 s (below the 5 s self-release) and do not move it toFLOW_GUARD;:766is a condvar timeout on a blocking thread, not a flow guard. The rest of the batch verifies correct: theuntilduplication at:754/791/796, the:1137poll versussubscribe().wait_forat:1519, the:1396/:1550windows, the two semantic bounds, and the other threeis_finished()conversions.Impact: as written, the PR would delete the only check that
closewaits for a held configure (a regression there would pass), and would remove the only check that the output drains before the offload is released. Both losses are silent — the tests stay green.(Non-blocking: the verdict line's "13 guards, 2 semantic bounds, 4 still-pending windows" sums to 19, not the stated 17 rows; the site-by-site enumeration itself covers the ledger's 17 rows — 5
local_execution, 7tool_binding, 5prompt_lifecycle— so only the summary numbers need fixing.)eric8810 commentedon Nov 29, 2026
Review correction: 2217-A4 transport_flow/approval
Verdict: partially correct
What is wrong: The two
dispatcher.sequence()conversions at:402and:479are not "exact observable substitutes" for the short bounds they delete. Both asserts hold before the code under test can act, because the probe gate is holding dispatch for the whole window; they stay true whether or notsession.history/Approval::respondwait at all. Deleting the bound therefore removes the only check that the reply is withheld, and the retained assertions pass on a reply produced without waiting. At:479the sequence of the wrong event is also used:a.response(first)resolves with the firstapproval/respond, not the second.Evidence:
crates/dim-app-server/tests/transport_flow/approval.rs:371-384appends["first in batch", GATE_INPUT];:150-151blocks the dispatcher inside the GATE_INPUT handler (probe.entered.notify_one(); probe.release.notified().await;).Dispatcher::sequence()(crates/dim-agent-runtime/src/core/dispatcher.rs:266, set at:307) is therefore pinned atbatch[0].sequencewhile the gate holds.approval.rs:394let head = session.sequence("main").unwrap();is the published head (crates/dim-agent-runtime/src/branch.rs:151-153), i.e.>= batch[1].sequence, sodispatch.sequence() < headis unconditionally true.crates/dim-app-server/src/connection/tree.rs:269,:279-307computesthrough = headand blocks whilestate.sequence < through; a handler that skipped that loop would still return both published batch events and the cursor, soapproval.rs:414-421continues to pass.:479:approval.rs:461gates before both responds,:464-476sends deny then allow.Approval::respondregisters its oneshot under its own event id (crates/dim-agent-capabilities/src/approval.rs:379-403:append_registered->inner.responses.insert(event.id.clone(), waiter)->result.await), soa.response(first)is released by dispatch ofapproval/respondfix: correct plugin storage, shutdown, and stream lifecycle handling #1, whiledispatch.sequence() < seq(#2)also holds once fix: correct plugin storage, shutdown, and stream lifecycle handling #1 has been dispatched.Corrected conclusion: Keep an observable check that the reply has not been produced. #2215's own N-row rule allows it: if no notification exists for "the reply is withheld", keep a bounded quiet window and state the bound as part of the assertion (
"history waits for its published snapshot to dispatch within 100 ms"), instead of replacing it with a predicate the test's gate already guarantees. If you keep a dispatcher assert at all, it is at most supporting evidence and must use the awaited event's own sequence (#1at:479). The rest of A4 is correct: the sevenprobe.*_enteredsites and:817/:871/:948/:1022/:1365/:1421are guards,:339/:998are #2215 polls,:1012stays a stated window, and:735is covered by the post-release assert at:747.Impact: Implementing PR-2 as written drops the only coverage of "history waits for its published snapshot to dispatch" and "RPC cannot succeed before its event is consumed"; a regression that returns either reply without waiting would pass both tests. The claimed mechanism (
Dispatcher::sequence()is public,tree.rsblocks onstate.sequence < through,Approval::respondwaits for dispatch) is real, so only the substitution is wrong.eric8810 commentedon Nov 29, 2026
Review correction: 2217-A8 goal-parts/evaluator
Verdict: partially correct
What is wrong: the classification holds (six 750 ms gate-arrival rows, three write-absence rows, no usable paused clock), but four of the six proposed
taken()conversions name a barrier that ends before the step they must rule out.taken()is onetry_recv, so at those sites the negative assertion would usually sample an empty channel and pass with the regression present.goal_parts_flow.rs:1022—failure.awaitis signalled from theGoalProbeFailStatebeforehook while the record's draft is rewritten, i.e. before the append is refused and before the writer reachesrelease_settlement(). The second decision the case rules out can only be spawned after that release.goal_parts_flow.rs:1127,:1228,:1339— the take-up the case rules out is a newly spawned task: a writer that wrongly resumes decisions goes throughresume_settlement→interrupted→task→self.work.spawn, and theStage::Recordhold it would land on is that spawned task. NeitherStage::Releasedarriving at:1120nor thepausereply thetokio::join!at:1231/:1342returns proves the spawned task ran; it can still be polled after the sample.Evidence:
crates/dim-goal/tests/support/parts.rs:230: the hook rewrites the paused block and doeslet _ = fired.send(());insidetimeline.before(ctx, "GoalProbeFailState", &["input/message"], ...)— the draft stage, sofailure.awaitresolves before the commit is even attempted.crates/dim-goal/src/branch.rs:746-755:Ok(_) => self.resume_settlement()/Err(_) => { self.release_settlement(); }runs after that hook.crates/dim-goal/src/branch/restore.rs:46-50:resume_settlement=release_settlement()thenself.interrupted(interrupt);crates/dim-goal/src/branch.rs:1499-1501fn interruptedcallsself.task(...), andcrates/dim-goal/src/branch.rs:791self.work.spawn(async move { ... })is where the heldStage::Recordis reached.State::decision_tasks(src/branch.rs:412) is the only thing that proves that task ended, and no test hook awaits it.Corrected conclusion: convert only
goal_parts_flow.rs:1600andgoal_evaluator_flow.rs:1040. There the continuation is written by the same task after the record was answered (src/branch.rs:2080-2113:record(after, None, Answers::TurnEnd{..}).await?, then theDecision::Continuationbranch), so awaitingenv.wait_for(kind="continuation")really does prove the append was never reached. Keep a bounded window at:1022,:1127,:1228,:1339— a namedNEGATIVE, with the false-pass risk the batch already accepts for the write-absence rows — or add atestinghook that awaitsdecision_tasksfirst and then usetaken().Impact: implementing the batch as written would have deleted the only detector for "a failed state record takes no second decision" and "a failed record takes up no interrupt it deferred" at four sites, leaving tests that still read as if they asserted it.
eric8810 commentedon Nov 29, 2026
Review correction: 2217-A9 branch_flow
Verdict: partially correct
What is wrong: the routing holds (four 5 s
HeldWritersguards, the 1 sreleased.cancelled()guard, the 8 s/30 s helper duplicates, the 150 ms windows staying real-time), but:3223cannot becomefutures_util::poll!.closingis not the future that waits for dispatch:main.close()starts the close in a spawned task and returns a result waiter, so one poll answers "has the close already finished", not "the future sits at its blocking point". That is the same argument the batch uses to keep:11111,:12960and:13073/:13097, and it applies here unchanged.Evidence:
crates/dim-agent-capabilities/tests/branch_flow.rs:3211-3226:let mut closing = main.close();is polled only insidetimeout(50ms, &mut closing), after the committedStopInterruptis observed onCommitted.crates/dim-agent-runtime/src/branch.rs:126-128:Branch::close()→TimelineContext::close()(timeline_context.rs:890) →finish(false), which callsself.close.start(ctx.handle(), async move { ... }).crates/dim-agent-runtime/src/lifecycle.rs:26-38:CloseOnce::startdoeshandle.spawn(async move { ... send.send_replace(Some(result)); })and returns a future that only waits on that watch. A close that skipped the dispatch wait would complete in the spawned task; a single poll seesReadyonly if the task already published, otherwisePendingand the regression passes.Corrected conclusion: keep
:3223as a real-time window — it is the assertion, as the batch itself classifies it — optionally with a sharedNEGATIVEconstant so the number has one home. Readiness has to come from the close itself (a signal the close task emits), not from polling its waiter. The rest of PR 1 stands: the fourHeldWritersrows,:2936→assert!(released.is_cancelled())(the guard lives in thecancelled()future thedropofwaitingdestroys, so it is synchronous), and:8985/:6698→patient.Impact: replacing the 50 ms must-not-complete window with a first poll would remove the only check that close answers only after the dispatcher delivered the StopInterrupt, while the test would still look like it asserted that.
eric8810 commentedon Nov 29, 2026
#2217 is complete in #2355, merged at
bd7fc347b.The PR classifies the actionable
Mrows into named hang guards, event waits, and documented semantic wall-clock exceptions. Poll loops remain with #2215, external waits with #2216, andwait_for_loginwith #2233. Targeted suites passed locally; CI at4457ddacdwas green before merge.Closing this issue as complete.