Skip to content

ADR-048 Tauri-seam e2e tests flake under machine load with daemon-health timeouts #1610

Closed

Description

@malibio

Overview

The cargo test -p nodespace-app pre-push gate (the ADR-048 Tauri-seam integration test suite under packages/desktop-app/src-tauri/tests/) intermittently fails on real-daemon-spawning tests when the machine is under concurrent load, blocking pushes for unrelated changes.

Problem Statement

Several tests/*.rs files in packages/desktop-app/src-tauri/ spawn a real nodespaced binary and wait for it to become healthy before running assertions, via connected_client() in packages/desktop-app/src-tauri/test-support/src/lib.rs:

let status = wait_for_daemon(&daemon.socket_path, timeout).await;
assert_eq!(
    status,
    DaemonStatus::Healthy,
    "daemon never became healthy at {}",
    daemon.socket_path.display()
);

This assertion is timing-sensitive: spawning a whole OS process and waiting for it to bind a socket takes meaningfully longer under CPU contention than the fixed timeout accounts for.

Reproduction context: while pushing an unrelated branch, the pre-push gate failed 4 times in a row across 4 separate attempts, each time on a different test in the suite:

  • adapter_contract_test::create_node_insert_position_matches_the_http_adapter_contract — daemon never became healthy
  • ai_chat_send_to_idle_test::ai_chat_send_reaches_idle_with_no_stuck_processing_state — separate 180s turn-completion timeout, not the daemon-health assertion, but the same class of load-sensitive timing failure
  • commits_per_edit_test::second_coalesced_edit_uses_the_confirmed_version_not_a_stale_guess — daemon never became healthy (twice)

Every failing test passed cleanly when re-run alone immediately after failing as part of the full suite, which rules out a logic bug in any specific test — this is contention/timing, not correctness.

Correlation with machine load: the failures coincided with a concurrent cargo test --workspace running in another worktree session plus a live Ollama llama-server process competing for CPU. System load average (15-min) was ~10.5 on a 10-core machine during the failures; once the concurrent test run finished and load dropped to ~1.3, one retry got further before hitting the next timing-sensitive test.

Proposed Solution

Make the daemon-health wait (and any other fixed-timeout assertions in this suite, such as the ai_chat_send_to_idle_test turn-completion wait) tolerant of load-induced delay:

  • Increase the timeout passed to wait_for_daemon in connected_client(), and/or
  • Add retry-with-backoff around the health check instead of a single deadline, and/or
  • Detect and reduce test parallelism for this specific suite (real daemon spawns are far more load-sensitive than in-process assertions) — rust:test already runs nodespace-core with --test-threads=2; the nodespace-app Tauri-seam suite may need the same or lower.

Acceptance Criteria

  • cargo test -p nodespace-app passes reliably under representative background load (e.g. a concurrent cargo test --workspace running in another checkout) without raising the wall-clock cost of a clean, unloaded run significantly
  • The daemon-health wait in connected_client() (packages/desktop-app/src-tauri/test-support/src/lib.rs) has headroom for slow process spawn under load, via a longer timeout, retry/backoff, or both
  • Any other fixed-timeout assertions in the same test suite with the same load-sensitivity (e.g. the ai-chat turn-completion wait in ai_chat_send_to_idle_test.rs) are reviewed for the same fix
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • packages/desktop-app/src-tauri/test-support/src/lib.rs — connected_client() (the shared helper every tests/*.rs file uses to spawn a daemon and wait for health), CONNECT_MUTEX, SpawnedDaemon
  • packages/desktop-app/src-tauri/tests/adapter_contract_test.rs
  • packages/desktop-app/src-tauri/tests/commits_per_edit_test.rs
  • packages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs
  • .husky/pre-push / scripts/test-gate.ts — the pre-push gate that runs this suite

Related Issues

Activity

  1. added
    bug
    on Jul 10, 2026
  2. added a commit that references this issue on Jul 11, 2026
  3. added a commit that references this issue on Jul 11, 2026
    7ecdd94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buginfrastructuretesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions