Skip to content

test(cli): give the spawn progress flow a stable bound - #1976

Merged
yyhhyyyyyy merged 3 commits into
mainfrom
hui/spawn-wait-test-bound
Nov 22, 2026
Merged

yyhhyyyyyy merged 3 commits into
mainfrom
hui/spawn-wait-test-bound

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator

Symptom

daemon_startup_progress::an_assembly_note_is_waited_for_before_the_spawn_answers fails intermittently on main in verify (macos), reporting did not start in time or App Server did not answer hello during startup and an empty daemon log. It failed 4 times in 19 main macOS runs.

Cause

The flow starts the CLI against a wrapper script that writes 12 assembly progress notes 0.3 seconds apart and then execs the real app-server, with a test-only wait bound of 1.5 seconds. The note carries the wrapper's pid and only a larger counter extends the wait; exec keeps that pid, while the app-server's own counters start again at 1, so they are not an increase over the script's 12 and are ignored (crates/dim-cli/src/client.rs:434). Progress therefore stops extending the wait after the script's last note, and any scheduling gap longer than 1.5 seconds between two notes ends the wait before the app-server can answer. The product default is not involved: it is 10 seconds.

Change

Three numbers in that test only: DIM_TEST_DAEMON_START_TIMEOUT_MS from 1500 to 10000 milliseconds, the script's note count from 12 to 20, and the sleep between notes from 0.3 to 0.6 seconds. The notes still last about 12 seconds in total, longer than the new bound, so the flow still proves that the spawn wait is extended past its bound by assembly progress. Assertions, neighbouring flows and the product default are unchanged.

Why the flow is not weaker

A mutation check: with progress notes temporarily made to not extend the wait, the same flow fails with the startup timeout. The flow therefore still fails when progress is ignored, as the original one did.

CI

The workflow runs the verify job for pull requests on Linux only; the macOS job runs on pushes to main. This flow was run on macOS locally, and main's verify (macos) after merge is where the intermittent failure is confirmed gone.

The spawn wait flow ran on a 1.5 s inactivity bound while its script
wrote twelve notes 0.3 s apart and then exec'd the real app-server.
Because exec keeps the pid and the app-server's counters start over,
progress stopped extending the wait after the script's last note, so a
scheduling gap on a loaded macOS runner ended the wait before hello.

Give the flow the production ten-second bound, twenty notes 0.6 s
apart, which still lasts about twelve seconds, and leave the
assertions, the neighbouring flows and the product default unchanged.
With progress notes no longer extending the wait the flow still fails
with the startup timeout, so it has not become weaker.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2cb5e42. No blocking issue in the patch itself. The wrapper still takes ~12 s before exec, longer than the 10 s inactivity bound, so the test still depends on assembly notes extending the wait. The product default and assertions are unchanged.

The modified flow passed in Linux CI, but ci-ok is red: managed_oauth_flow::managed_provider_selection_http_recovery_and_restart_flow timed out at managed_oauth_flow.rs:1010. That's outside the changed fixture; I haven't verified that it's a pre-existing flake. I'm leaving this as a comment rather than approving a red run. The macOS native job doesn't exercise this CLI flow, so the original flake still needs confirmation in the macOS verify runs.

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator Author

Review: #1976 (review)

The 12-second script against a 10-second bound is intentional: the flow exists to prove that assembly notes extend the wait past the bound, and a mutation check that removes the note renewal fails the flow with the startup timeout. The product default and the assertions are unchanged.

Both red tests in run 44905819992 are outside this diff. collaboration::native_member_work_absorbs_messages_and_spans_turns failed at collaboration.rs:3182 because only the read after unload and restore includes an environment client-presence input (sequence 54) appended between the two reads, while the earlier snapshot does not; #1971 adds exactly that filter and merged at 12:54:46Z, after this run was created at 12:49:40Z. managed_oauth_flow::managed_provider_selection_http_recovery_and_restart_flow hit the 3-second timeout at managed_oauth_flow.rs:1010, and the log shows the attempt still Pending for the whole window. This PR does not change that flow, and the log has no per-step timing, so which step inside the window was slow is not determined.

The new head, 7c16830, merges the current main, which includes #1971.

Agreed that the macOS effect can only be confirmed by the verify (macos) run on main after merge.

@yyhhyyyyyy
yyhhyyyyyy requested a review from eric8810 November 21, 2026 15:55

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked 7c168300. The fixture is unchanged by the main merge and an_assembly_note_is_waited_for_before_the_spawn_answers passes again in the exact-head Linux run. The previous collaboration/OAuth failures are not the failures in this run. ci-ok is still red: the recovery wake test read a sequence inside an atomic batch, the staged updater recovery fixture failed during installer setup, and the goal evaluator test did not wait for its evaluator. None of those assertions are in the changed fixture; this run doesn't establish their cause. Holding approval while the required check is red. The hosted macOS native check does not run the changed CLI flow.

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator Author

#1976 (review)

The staged_update::recovery::a_store_this_build_cannot_read_never_recovers failure is the test fixture failing to install the built binary, not a staged-update assertion: the job log records install: cannot install ... Disk quota exceeded (os error 122) while install_updater copies the test binary into a home under /tmp, and the panic only shows exit status: 1 because the fixture does not capture the command's stderr. Tracked in #1987.

The local_execution::a_failed_recovery_wake_faults_the_session_and_is_posted_once_on_retry failure is the test's own store read at local_execution.rs:3333 returning InvalidInput("sequence 8 is inside an atomic batch") after it injects a wake-append failure. The in-memory Timeline store addresses rows by position while a failed append has already consumed a sequence, so head stops being a batch boundary; the recovery behavior the test verifies never runs. Tracked in #1988.

The goal_product_flow::goal_evaluator_judge_creates_an_evaluator_and_completes_on_done failure is the Goal turn-end decision seeing the agent's completion request and the turn end in an order that writes a continuation before the evaluator is created, so the assertion a completion request must wait for its evaluator fails. It is the same assertion that failed once before on an unrelated change. Tracked in #1989.

This pull request changes only crates/dimcode/tests/cli_flow/daemon_startup_progress.rs (six lines), and none of the three failing paths is in that file or reached by it.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head 1dcc14f.

The diagnosis holds together and the fix is confined to the three numbers that caused it. The flow starts the CLI against a wrapper that emits 12 assembly notes at 0.3 s spacing and then execs the real app-server; the note carries the wrapper's pid and only a larger counter extends the wait, while the app-server's own counters restart at 1 and are therefore not an increase over the script's 12. That is a real gap in the flow's assumptions, not a slow machine, and it explains both signatures (did not start in time, App Server did not answer hello) with an empty daemon log.

Raising the bound to 10 s is the right knob rather than an assertion change: the test's subject is that an assembly note is waited for before the spawn answers, and the bound is the harness's patience, not the behaviour under test. Using the product's own 10 s default instead of a special 1.5 s value also removes a second thing that could drift away from the product. Spacing the notes at 0.6 s and running 20 of them keeps the script phase longer than the bound, so the notes keep extending the wait as intended until exec.

Blocking: none.

Checks are green at this head. I read the diff (three numeric changes in one test), the PR body's account of client.rs:434, and the file list; I did not read the surrounding flow or re-derive the counter comparison from client.rs myself, and ran nothing.

Non-blocking:

  • crates/dimcode/tests/cli_flow/daemon_startup_progress.rs — the flow now spends ~11.4 s in the wrapper script and up to 10 s in a genuine failure, where it used ~3.6 s and 1.5 s. That is the price of removing a flake and I would pay it, but it is the kind of change that adds up across a suite whose verify (linux) run is already several minutes; if this file's neighbour flows grow the same way, a shared helper with one documented bound would keep the cost in one place.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test-only change still makes the wrapper exceed the initial inactivity deadline and requires successful startup through assembly progress. The revised fixture passed on exact Linux CI, and the aggregate gate is green. The selected macOS native checks passed but did not run that specific CLI fixture. Exact CI.

@yyhhyyyyyy
yyhhyyyyyy merged commit 3e5a2d6 into main Nov 22, 2026
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.

3 participants