Skip to content

test(tui): dictation_command_trims_trailing_newlines flakes with a 5s wall-clock budget under load #178

Open

Description

@KooshaPari

Observed failure

Run 39698887862, job 119562950996 (branch codex/kcode-version-delivery-gates-20261021):

thread 'tui::app::dictation::tests::dictation_command_trims_trailing_newlines' panicked at crates/jcode-tui/src/tui/app/dictation.rs:526:14:
dictation command should succeed: "timed out after 5s"
test result: FAILED. 2516 passed; 1 failed; 19 ignored; 0 measured; 1 filtered out; finished in 62.99s

The test under master

    #[tokio::test]
    async fn dictation_command_trims_trailing_newlines() {
        let text = run_dictation_command("printf 'hello from test\n'", 5)
            .await
            .expect("dictation command should succeed");
        assert_eq!(text, "hello from test");
    }

Root cause

The 5 is a timeout in seconds passed to
run_dictation_command(command, timeout_secs). The test spawns
sh -lc "printf 'hello from test\n'" under setsid and requires the whole spawn to
complete inside 5 seconds of wall clock.

printf finishes in milliseconds. So the 5s budget is not measuring dictation
behavior at all -- it is measuring how contended the runner's scheduler is.
During the failure the desk was running load average 11-14 with concurrent
cargo builds, and a 5-second budget for spawning a shell was simply not
reachable. It failed in 2 of the 3 most recent desk-linux runs.

Pre-existing, not a regression

crates/jcode-tui/src/tui/app/dictation.rs has not changed on master since
commit 6cf71ed4e (2026-10-16). This flake is inherited from master and is not
caused by any recent fix-forward PR.

Fix

Raise the test's timeout budget from 5 to 30 seconds, plus a comment
explaining why. The production path is untouched: the run_dictation_command
signature and every production call site keep their existing timeout semantics.

30s keeps the assertion meaningful -- a genuinely hung shell still fails the test
-- while removing the test's sensitivity to runner load. The assertion itself
(assert_eq!(text, "hello from test")) is unchanged, and the test is not
ignored or skipped: the CI gate still covers this behavior.

Scope

crates/jcode-tui/src/tui/app/dictation.rs, #[cfg(test)] mod tests only.
8 insertions, 1 deletion.

Activity

  1. added
    kilo-triaged
    on Oct 22, 2026
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

    kilo-triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions