Skip to content

app tests: two async tests use fixed real-wall-clock Timer::after waits with no retry margin, and fail intermittently under full-parallel PR-gate load #13979

Open

Description

@fbartho

Summary

Two tests observed failing in full-parallel cargo test -p warp --lib PR-gate runs, both verified passing in isolation and in this investigation's two full local reruns (which instead reproduced the four already-tracked clusters, #13972-#13975). Unlike those four clusters, these two are not explained by any process-global static, cache, or leaked feature flag — I checked and neither test's code path touches FLAG_STATES, SECRETS_REGEX, EXPERIMENT_LAYER_MAPPINGS, the TELEMETRY queue, BOOTSTRAP_CACHE, or a detached PTY thread Arc. Both tests instead drive real-time async waits (warpui::r#async::Timer::after, backed by async_io::Timer — a genuine OS-reactor timer, not a virtual/mocked clock) as their sole synchronization mechanism, with no bounded poll-and-retry loop to absorb scheduler delay. Under full-suite parallel load (5765+ tests contending for 10 cores in this environment), that makes them structurally more exposed to false failures from thread/timer starvation than tests that poll.

I could not obtain a deterministic minimal reproduction (two full local runs of the full --lib suite did not reproduce either failure — see below), so this is filed on static-analysis mechanism evidence, not a captured failure, similar in spirit to the honesty caveat in #13975.

Affected tests

  • server::cloud_objects::update_manager::tests::test_pending_metadata_update_with_polling — app/src/server/cloud_objects/update_manager_tests.rs:2601
  • settings::cloud_preferences_syncer::tests::test_cloud_pref_not_synced_when_current_value_not_syncable — app/src/settings/cloud_preferences_syncer_tests.rs:1101

Reproduction

Both pass in isolation:

cargo test -p warp --lib -- --exact server::cloud_objects::update_manager::tests::test_pending_metadata_update_with_polling
# => ok. 1 passed; finished in 0.03s

cargo test -p warp --lib -- --exact settings::cloud_preferences_syncer::tests::test_cloud_pref_not_synced_when_current_value_not_syncable
# => ok. 1 passed; finished in 1.03s

Two full-suite local runs on this 10-core machine did not reproduce either failure; both instead reproduced exactly the four already-tracked clusters (12-13 failures matching #13972/#13973/#13974/#13975) plus two unrelated new failures out of this investigation's scope (notebooks::file::tests::test_load_local, notebooks::file::tests::test_load_before_session, util::path::tests::test_resolve_command):

cargo test -p warp --lib
# run 1: test result: FAILED. 5765 passed; 12 failed (the 4 tracked clusters' members)
# run 2: test result: FAILED. 5764 passed; 13 failed (same, +1 extra secrets-cluster member)

Neither test_pending_metadata_update_with_polling nor test_cloud_pref_not_synced_when_current_value_not_syncable appeared as a failure in either run. This is consistent with them being rarer, load-threshold-dependent flakes that need either more attempts or a higher core-count / more contended CI runner to trigger — the same category of difficulty documented for #13975's thread-join race, but via a different mechanism (see below).

Root cause (mechanism, not captured failure)

Both tests rely on a fixed real-time sleep as their only synchronization step, without a bounded retry loop:

// app/src/server/cloud_objects/update_manager_tests.rs:2577-2581
// await long enough that all the trash object retries are exhausted
warpui::r#async::Timer::after(Duration::from_secs(10)).await;

assert_trashed_status_for_object(&mut app, &sync_id.uid(), false);
assert_pending_status_for_object(&mut app, &sync_id.uid(), false);

Timer resolves to a real OS-backed timer, not a mocked/virtual clock:

// crates/warpui_core/src/async/native/mod.rs:3
pub use async_io::{block_on, Timer};

The 10s wait is meant to cover the retry backoff for ONLINE_ONLY_OPERATION_RETRY_STRATEGY (500ms base, factor 2, 3 retries — worst case ~3.5s), so there is nominally a ~6.5s margin. That margin assumes the test's own async task gets scheduled promptly; under full-parallel load with thousands of concurrent single-threaded App::test() executors and OS reactor threads contending for 10 cores, the actual wall-clock time for the awaited work to complete (not just the timer to fire) can exceed the fixed budget, causing the post-wait assertions to observe not-yet-settled state.

By contrast, update_manager_tests.rs has no bounded poll/retry helper anywhere in the file — every synchronization point is either ctx.await_spawned_future(...) (driven directly by the future, not time-boxed) or a bare Timer::after(...). This is a structurally more fragile pattern than the sibling module:

// app/src/settings/cloud_preferences_syncer_tests.rs:207-218
async fn wait_for_num_spawned_futures(app: &mut App, expected_num: usize, message: &str) {
    for _ in 0..50 {
        let num_spawned_futures =
            SyncQueue::handle(app).read(app, |sync_queue, _ctx| sync_queue.spawned_futures().len());
        if num_spawned_futures == expected_num {
            return;
        }
        warpui::r#async::Timer::after(Duration::from_millis(100)).await;
    }
    assert_num_spawned_futures(app, expected_num, message);
}

test_cloud_pref_not_synced_when_current_value_not_syncable (cloud_preferences_syncer_tests.rs:1148-1149) does use this bounded-retry helper (await_spawned_futures, which wraps wait_for_num_spawned_futures), giving it up to 5s of polled margin — more load-resistant than the update_manager test, but it is preceded by its own fixed Timer::after(Duration::from_secs(1)) (line 1148) before the poll loop starts, which is itself a real-time wait that could, in principle, still leave assertions checking state that a starved executor hasn't caught up to, if the initial fixed second is not enough for mock_initial_load processing to even begin under contention.

Both mechanisms funnel to the same category: a fixed-duration real-time Timer::after used as a proxy for "enough time has passed for async work to settle," which is inherently margin-dependent and therefore load-sensitive, as opposed to a bounded poll-until-condition loop (robust) or a virtual/mocked clock (immune to real scheduling delay).

Fix direction

  • For update_manager_tests.rs: replace the bare Timer::after(Duration::from_secs(10)) "wait long enough" pattern with a bounded poll-until-condition loop (analogous to wait_for_num_spawned_futures in cloud_preferences_syncer_tests.rs) that polls assert_trashed_status_for_object/assert_pending_status_for_object's underlying state until it settles or a generous timeout elapses, rather than asserting immediately after a fixed sleep.
  • For cloud_preferences_syncer_tests.rs: consider whether the leading fixed Timer::after(Duration::from_secs(1)) before await_spawned_futures can be folded into the existing poll loop (e.g. by increasing its retry budget) rather than kept as a separate ungated wait.
  • Longer term, consider whether App::test() should support a virtual/mocked time source for these test executors (many async runtimes offer this, e.g. tokio's time::pause()) so tests expressing "wait N seconds for backoff to exhaust" don't depend on real wall-clock scheduling at all. This would eliminate the whole class of load-sensitive timing flakes, of which this ticket's two tests may just be the currently-observed members.

Related

Related: #13853 (warp_editor render::tests Once-poisoning — same class, different crate) and the sibling flake tickets #13972, #13973, #13974, #13975. Unlike those four (cumulative process-global state, deterministically reproducible via ordering), this ticket's mechanism is real-time scheduling margin under parallel load — closer in spirit to #13975's "load-dependent, not a single static to reset" caveat, but via fixed-sleep synchronization rather than a lingering thread Arc.

Observation provenance: both tests were observed failing (and verified pass-in-isolation) during full-parallel gate runs on a sibling feature branch earlier today, on the same 10-core hardware — the non-reproduction above is about the two dedicated attempts on master, not the original sightings.

Activity

  1. warp-for-oss commented on Jul 19, 2026

    @warp-for-oss
    Contributor

    @fbartho

    Here's what I found while triaging this issue:

    This looks like a plausible rare test flake, but current code only partly matches the reported affected tests. The original failure output and branch/commit context are needed to confirm whether this is a fixed-sleep synchronization issue or a test-name/line mismatch.

    I have a few follow-up questions before I can narrow this down:

    1. Can you attach the full failure output from the original PR-gate run for the two named tests?
    2. Were the original failures observed on current main, or only on a sibling feature branch?

    Reply in-thread with those details and the triage workflow will automatically re-evaluate the issue and update the diagnosis, labels, and next steps.

    Maintainer details

    I concluded that likely rare test flake from real-time async waits, but current code only partly supports the named affected tests and needs original failure logs to confirm..

    Triage summary

    This looks like a plausible test-flake report, but the evidence is not yet strong enough to mark it as confirmed. The report is based on observed failures from a full-parallel gate run plus static analysis, while the dedicated full-suite reruns in the report did not reproduce either named failure.

    Current code inspection supports part of the hypothesis:

    • app/src/settings/cloud_preferences_syncer_tests.rs has test_cloud_pref_not_synced_when_current_value_not_syncable, which uses warpui::r#async::Timer::after(Duration::from_secs(1)) before awaiting spawned sync futures. Since native Timer is re-exported from async_io::Timer in crates/warpui_core/src/async/native/mod.rs, this is a real wall-clock wait and can be sensitive to scheduler/load delays.
    • app/src/server/cloud_objects/update_manager_tests.rs contains the reported 10-second fixed timer in the adjacent test_metadata_after_trash_item_failure, and app/src/server/cloud_objects/update_manager.rs defines ONLINE_ONLY_OPERATION_RETRY_STRATEGY with exponential retry timing. However, the currently named test_pending_metadata_update_with_polling body does not contain that fixed wait, so the update-manager affected-test mapping appears inconsistent with current main.

    The related issues #13972, #13973, #13974, and #13975 cover other full-suite flake clusters, but they involve different tests and mechanisms. I did not find an existing open or recently closed issue that matches these exact tests/files or the fixed-Timer::after mechanism closely enough to call this a duplicate.

    Recommended next step: get the original failure output and branch/commit context before implementing a fix, especially for the update-manager test-name mismatch. If confirmed, the likely fix direction is to replace fixed wall-clock sleeps used as synchronization with bounded poll-until-condition helpers or direct awaited futures where possible.

    Question reasoning

    1. Can you attach the full failure output from the original PR-gate run for the two named tests? — The report does not include captured assertion output, and current code inspection does not fully match one named affected test.
    2. Were the original failures observed on current main, or only on a sibling feature branch? — This would clarify whether the update-manager test mismatch is due to branch divergence or an issue in the report's affected-test mapping.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  2. added
    area:settings-keybindings
    area:warp-drive
    bug
    needs-info
    repro:low
    triaged
    on Jul 19, 2026
  3. fbartho commented on Jul 20, 2026

    @fbartho
    ContributorAuthor

    As the flakes were timing based and I didn't capture the logs at the time, I can't provide them here, though I was able to reproduce them on the same day in a clean worktree checked out to master..

    I worked with Claude to statically analyze the code, and that's what fed the ticket above

    I just re-checked both test bodies against current master and they match the ticket's description exactly — the fixed Timer::after(Duration::from_secs(10)) at the exhaustion-wait point in update_manager_tests.rs, and the fixed Timer::after(Duration::from_secs(1)) before the poll loop in cloud_preferences_syncer_tests.rs — so the "test-name mismatch" theory doesn't hold up on inspection; test_pending_metadata_update_with_polling does contain the fixed 10s wait as described, right where the ticket says. I also tried a fresh repro attempt just now (full cargo test -p warp --lib under load), but it didn't reproduce (my system is under load however).

    2. Branch context. The two failures were originally observed on a sibling feature branch, not on master directly — same hardware (10-core), same day as the #13972–#13975 investigation.

    I still believe this is worth fixing since test cases that use real-wall-clock delays are a classic flaky-test pattern that is worth fixing, imo.

  4. warp-for-oss commented on Jul 20, 2026

    @warp-for-oss
    Contributor

    @fbartho

    Here's what I found while triaging this issue:

    Code inspection supports the general fixed-timer flake concern, but one affected test named in the report does not line up with the current code. Exact failure output would still be helpful if this reproduces again.

    I have a few follow-up questions before I can narrow this down:

    1. Can you clarify whether either of these two named failures was observed on an unmodified master checkout?
    2. If this reproduces again, can you capture the exact failing test name and assertion output for the Warp Drive failure?

    Reply in-thread with those details and the triage workflow will automatically re-evaluate the issue and update the diagnosis, labels, and next steps.

    Maintainer details

    I concluded that plausible test-flake report for fixed real-time waits in app tests, but current evidence leaves the exact Warp Drive failing test and reproducibility uncertain..

    Triage summary

    This is a plausible app test flake report, but the current evidence is not enough to mark it reproducible. The reporter saw failures during full-suite runs under load and says the tests pass in isolation; no logs or assertion output are available, and later full-suite attempts did not reproduce these two failures.

    Code inspection

    • app/src/settings/cloud_preferences_syncer_tests.rs:1148 uses Timer::after(Duration::from_secs(1)).await immediately before await_spawned_futures(...), whose helper polls spawned future count for up to 5 seconds. This supports a plausible load-sensitive timing concern, though there is already a bounded poll after the fixed wait.
    • app/src/server/cloud_objects/update_manager_tests.rs:2578 has a fixed Timer::after(Duration::from_secs(10)).await waiting for trash_object retries from ONLINE_ONLY_OPERATION_RETRY_STRATEGY. That pattern is plausibly fragile, but in current master it is inside test_metadata_after_trash_item_failure, not test_pending_metadata_update_with_polling, which starts after that timer and does not contain it.
    • crates/warpui_core/src/async/native/mod.rs:3 re-exports async_io::Timer, so these waits are real wall-clock timers rather than a virtual test clock.

    Reproduction and routing

    Keep this routed as a bug for Settings/Keybindings and Warp Drive test reliability, with repro:low and needs-info. The fixed-timer pattern is worth hardening, but the exact Warp Drive failure target and whether these failures reproduce on current master remain ambiguous.

    Duplicate check

    I enumerated open issues with the GitHub API and checked exact test/file-name matches across issues. #13972, #13973, #13974, and #13975 are related full-suite flake reports but cover different mechanisms and affected tests, so this issue is not a duplicate under the duplicate-detection threshold.

    Question reasoning

    1. Can you clarify whether either of these two named failures was observed on an unmodified master checkout? — The issue body says current-master full-suite reruns did not reproduce these two failures, while the follow-up comment mentions a clean master reproduction; this affects whether the bug is branch-specific or present on current master.
    2. If this reproduces again, can you capture the exact failing test name and assertion output for the Warp Drive failure? — Current master has the fixed 10-second timer in a different UpdateManager test than the one named in the report, so exact output is needed to confirm the affected test and root cause.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  5. fbartho commented on Jul 20, 2026

    @fbartho
    ContributorAuthor

    Correction to my earlier reply: the test-name mismatch is real. The quoted 10s Timer::after is at line 2578, inside test_metadata_after_trash_item_failure — the test immediately preceding test_pending_metadata_update_with_polling (which begins at line 2601 and contains no timer wait). The mechanism and quoted snippet in the ticket are accurate but attributed to the neighboring test's name. I have a fix PR queued that targets the correct test and lays out the causal chain in full.

  6. warp-for-oss commented on Jul 20, 2026

    @warp-for-oss
    Contributor

    @fbartho

    Here's what I found while triaging this issue:

    I confirmed the latest correction: the reported 10s fixed wait belongs to a neighboring test, not the originally named one. This still looks like a plausible low-repro flaky-test report, but the failure evidence is limited because the original failing logs were not captured and fresh master reruns did not reproduce it.

    Maintainer details

    I concluded that low-repro app-test flake report with plausible code evidence for fixed real-wall-clock waits, but the triggering correction changes one affected test attribution..

    Triage

    This looks like a low-repro app-test flake with plausible static evidence, but the latest correction changes one affected-test attribution. The fixed 10s wait is in test_metadata_after_trash_item_failure, not test_pending_metadata_update_with_polling; the latter does not contain the reported wait at that location. The settings-side test still has the reported fixed 1s timer before draining spawned sync futures.

    Evidence

    • app/src/server/cloud_objects/update_manager_tests.rs:2578 uses warpui::r#async::Timer::after(Duration::from_secs(10)).await after the trash failure path and before asserting reverted trash/pending state.
    • app/src/server/cloud_objects/update_manager.rs:98 defines the online-only retry strategy as a 500ms exponential retry with factor 2 and 3 retries, and trash_object uses that strategy before reverting state on failure.
    • app/src/settings/cloud_preferences_syncer_tests.rs:1148 uses Timer::after(Duration::from_secs(1)) immediately before await_spawned_futures(&mut app, 3, "initial load").
    • crates/warpui_core/src/async/native/mod.rs:3 re-exports async_io::Timer, so these waits are real wall-clock timers rather than virtual test time.
    • The report does not include captured failing logs, the original failures were seen on a sibling feature branch, and fresh master full-suite attempts did not reproduce these two specific failures.

    Duplicate check

    I searched open issues across the repository and checked recently closed matching issues from the last 7 days. Related flake tickets #13972, #13973, #13974, #13975, and #13980 cover different global-state, cwd, or thread-lifetime mechanisms, so I am not marking this as a duplicate.

    Suggested next step

    If a fix PR is already queued, it should target the corrected test attribution and replace fixed real-time sleeps with condition-driven waiting where practical. No further reporter input seems necessary for initial routing because the latest comment and code inspection resolve the main ambiguity.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  7. removed
    needs-info
    on Jul 20, 2026
  8. fbartho commented on Jul 21, 2026

    @fbartho
    ContributorAuthor

    I proactively attempted an implementation based on the ticket as it's currently written: #14042.

    If the ticket changes, I'm happy to update the PR to match a maintainer's guidance, just let me know!

  9. fbartho commented on Jul 28, 2026

    @fbartho
    ContributorAuthor

    Just nudging @oss-maintainers that this is still a real flake, and that I have a proposed fix here: #14042

  10. added
    ready-to-implement
    on Jul 29, 2026
  11. warp-for-oss commented on Jul 29, 2026

    @warp-for-oss
    Contributor

    This issue has been labeled ready-to-implement and is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment @oz-agent on this issue to have the bot draft an implementation PR automatically.

  12. warp-agent-staging commented on Jul 29, 2026

    @warp-agent-staging
    Contributor

    Your GitHub account is not connected to Warp. Connect it here.

  13. seemeroland commented on Jul 29, 2026

    @seemeroland
    Contributor

    Sorry for the delay, marked this ready to implement and will re-run the review bot on your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:settings-keybindingsarea:warp-drivebugready-to-implementrepro:lowtriagedwarp:auto-triage-review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions