Skip to content

test(tui): raise dictation newline-trim test timeout from 5s to 30s - #179

Closed
KooshaPari wants to merge 1 commit into
masterfrom
fix/tui-dictation-test-timeout
Closed

KooshaPari wants to merge 1 commit into
masterfrom
fix/tui-dictation-test-timeout

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

User description

Closes #178

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

Root cause

The 5 in the test is a timeout in seconds passed to
run_dictation_command(command, timeout_secs):

let text = run_dictation_command("printf 'hello from test\n'", 5)
    .await
    .expect("dictation command should succeed");

The test spawns sh -lc "printf 'hello from test\n'" under setsid and requires the
whole spawn to finish inside 5 seconds of wall clock. printf completes in
milliseconds, so 5s does not measure dictation behavior -- it measures how
contended the runner's scheduler is. The desk was at load average 11-14 with
concurrent cargo builds when this failed, and it failed in 2 of the last 3
desk-linux runs
.

Pre-existing flake, not a regression

crates/jcode-tui/src/tui/app/dictation.rs is unchanged on master since
6cf71ed4e (2026-10-16). This is inherited from master, not introduced by a
recent fix-forward PR.

The fix

Setting Before After
test timeout budget (run_dictation_command 2nd arg, test only) 5 seconds 30 seconds

Why raise the budget instead of restructuring the test. The wall clock is not
intrinsic to the assertion -- it is a byproduct of using the production spawn
path (which setsids a real shell) to drive it. Restructuring would mean either
injecting a fake spawn (which stops covering the real code path) or dropping
coverage. A 30s budget keeps the test exercising the production path end to end
and still fails on a genuinely hung shell, so the assertion stays meaningful.

30s is the smallest round jump that clears a load-average-14 scheduler stall with
margin, and it costs nothing when the test passes fast -- the budget is a ceiling,
not a sleep.

What deliberately did NOT change:

  • run_dictation_command's production signature and timeout semantics: untouched.
  • Every production call site: untouched. Only the #[cfg(test)] mod tests literal moved.
  • The assertion assert_eq!(text, "hello from test"): untouched.
  • The test is not #[ignore]d or skipped. The CI gate still covers this behavior.

Scope

crates/jcode-tui/src/tui/app/dictation.rs only, #[cfg(test)] module only.
8 insertions, 1 deletion. No workflow changes.

Validation

Compilation and the test itself are delegated to CI on this PR. Local cargo was
intentionally not run: the laptop had 20 GiB free (at the floor for a
jcode-tui test build) and the desk compute node was unreachable (SSH banner
timeout on two attempts), so a cold local build risked filling the disk for a
one-literal change. CI builds this crate on every PR and will exercise the
jcode-tui lib test cohort, including this test.


CodeAnt-AI Description

Allow dictation tests more time on busy runners

What Changed

  • The test that checks trailing newline removal now allows 30 seconds for the shell command to start and finish, instead of 5 seconds.
  • Production dictation behavior and its timeout settings are unchanged.

Impact

✅ Fewer dictation test timeouts on busy runners
✅ More reliable test results during concurrent builds
✅ Hung shell commands still fail within 30 seconds

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

`dictation_command_trims_trailing_newlines` shells out to
`sh -lc "printf 'hello from test\n'"` via `setsid` and gives the whole
spawn a 5-second wall-clock budget. `printf` itself finishes in
milliseconds, so the only thing that 5s can measure is how badly the
scheduler is backed up.

Observed in run 39698887862 / job 119562950996 (branch
codex/kcode-version-delivery-gates-20261021) on a desk that was running
load average 11-14 with concurrent cargo builds:

```
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
```

It failed in 2 of the last 3 desk-linux runs. `dictation.rs` is
unchanged on master since 2026-10-16 (6cf71ed), so this is a
pre-existing flake, not a regression from any recent PR.

30s keeps the assertion meaningful -- a hung shell still fails -- while
stopping the test from being a load-average canary. The production
`run_dictation_command(command, timeout_secs)` signature and every
production call site are untouched; only the `#[cfg(test)]` budget moves.

tx-agent: jcode
tx-validated: none
tx-scope: crates/jcode-tui/src/tui/app/dictation.rs
tx-intent: Stop a pre-existing TUI flake that measures runner load, not dictation behavior
Copilot AI balanced review requested due to automatic review settings October 22, 2026 02:42
@codeant-ai

codeant-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR e7618b4 Oct 22, 2026 · 02:42 02:45

@codeant-ai

codeant-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: db8c4a72-17e2-4e97-9bd9-94d087d6151e
📥 Commits

Reviewing files that changed from the base of the PR and between 0d95c41 and e7618b4.

📒 Files selected for processing: 1
  • crates/jcode-tui/src/tui/app/dictation.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Oct 22, 2026
@codeant-ai

codeant-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: e7618b4db270

@kilo-code-bot

kilo-code-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • crates/jcode-tui/src/tui/app/dictation.rs - 0 issues

Reviewed by free · Input: 64.2K · Output: 4.9K · Cached: 95.4K

@KooshaPari

Copy link
Copy Markdown
Owner Author

Sibling PR #191 (branch fix/tui-dictation-test-timeout-budgets) carries the cold-cache timeout budgets that let this PR's Build & Test (desk-linux) job go green on its own: compile budget 900s -> 3300s, job timeout 120 -> 240 minutes, and the retention-readiness cohort budget 600s -> 1800s. It is based on this branch (fix/tui-dictation-test-timeout) and adds only those three values to .github/workflows/ci.yml; no Rust source and no cache configuration is changed. The additional rust-cache blob fix (cache key suffix -notarget plus cache-targets: "false") stays in PR #183 and remains required.

@KooshaPari

Copy link
Copy Markdown
Owner Author

@KooshaPari KooshaPari closed this Oct 27, 2026
@KooshaPari
KooshaPari deleted the fix/tui-dictation-test-timeout branch October 27, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants