Repository navigation
test(host-platform): give the macOS burst flow its full window - #2209
Conversation
The 400k-line PTY burst can take more than 20 seconds on the macOS runner; poll for up to 60 seconds before failing.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Reviewed head d9e79ebb769a99a1bcffb56fc2633ecd8aea28d8, round 1.
What changed
One line in crates/dim-agent-capabilities/tests/host_platform_flow.rs:1982: the poll bound in a_shell_burst_completes_without_a_private_subscriber goes from 2,000 to 6,000 iterations, so at the existing 10 ms sleep (:1996) the window moves from 20 s to 60 s. The 400k-line burst, the token, the follow-up wait and the assertion are unchanged. The literal is local to this loop; no other test or helper shares it.
Is the bound safe
Yes. The loop breaks on the first page that contains the token (:1992-1994), so a successful run does not pay the new ceiling; the exact test finished in 1.74 s on this macOS ARM64 host. The full 60 s is spent only when the token never arrives within the window. The per-test timeout is 900 s (.github/workflows/ci.yml:329) and the verify job timeout is 75 minutes (:276), so 60 s plus the 30 s wait that follows (:2006) fits with margin.
Does it mask an output-path defect
I do not think so. For a shell task, platform.output with cursor: None returns the retained tail, RETAINED = 64 * 1024 (crates/dim-agent-capabilities/src/host_platform.rs:4041), through ShellTask::page (:4946). The token is printed after the 400k seq lines, so a correct but slow reader eventually shows it; a path that drops the token never shows it, and a longer wait cannot turn that into a pass. The test still requires the command to exit (:2002-2012).
The evidence points to timing, not an output defect: on code without this change, the test failed in both attempts of run 45728714128 (aacc71da: 00:35:56 and 01:10:14, at host_platform_flow.rs:1998) and passed in run 45732001598 (8dbcec62) at 01:01:19, where a different macOS test failed. That makes 20 s about 11x the local time while still short for the loaded macOS runner; 60 s gives about 34x local headroom.
What remains unproven: the time to token on the macOS runner was not measured, because the panic message is truncated in the log. 60 s is still a wall-clock budget, not a guarantee, and a much slower run could flake again. The change does not make this a latency check.
P3
6000 is a bare iteration count, and the 60 s meaning exists only in the 10 ms sleep two lines below. A short comment or a deadline-based loop would keep a later change to the sleep from silently moving the bound. No comment, doc or test name states the old bound, so nothing else needs renaming. Optional; noted inline.
Cross-PR and main
git diff --check is clean. The head merges clean with origin/main 8dbcec62 (git merge-tree rc 0). #2178 b1387a0b, #2174 357e4e84 (head moved to a05a4423 during review), #2202 6867cb64, #2206 6c96d21f (head moved to 55636b70) and #2208 7b1103ad merge clean at the listed heads; the two new heads also merge clean. None touches host_platform_flow.rs. #1881 ff9825d2 conflicts in docs/design/plugins/Report.md and #2197 a27c9af0 in crates/dim-app-server/src/connection.rs; the same conflicts exist against origin/main alone and neither touches this file. #2207 is already in the base. #2206 rewrites the shell stop path and removes the private ShellSession page, but not the HostPlatform capture and page path this test uses.
Verification
CI at d9e79ebb, run 45735142171: verify (linux) passes in 11m48s, including host_platform_flow::a_shell_burst_completes_without_a_private_subscriber ... ok; macos-native passes in 2m37s; ci-ok passes. The PR is open, not draft, head unchanged, mergeable CLEAN. Local: the exact test passes in 1.74 s with isolated HOME, TMPDIR and target under the data directory. Worktree clean at the head; no residual processes.
Unverified
Pull request CI runs verify on Linux only (ci.yml:274), and scripts/test-macos-native.mjs:43-46 does not select this test, so this PR cannot show the fix on macOS. The next push-to-main verify (macos) run, or a local macOS run, will. The PR body's local command does not name the OS.
Verdict: APPROVE.
| let mut seen = false; | ||
| let mut last = String::new(); | ||
| for _ in 0..2000 { | ||
| for _ in 0..6000 { |
There was a problem hiding this comment.
P3 optional: 6000 is a bare iteration count, and the 60 s window exists only as 6000 times the 10 ms sleep at line 1996. A short comment or a deadline-based loop would keep a later change to the sleep from silently moving the bound. Not blocking.
Refs #1295 · Follow-up to #2002
Why
mainverify (macos)still failshost_platform_flow::a_shell_burst_completes_without_a_private_subscriber:the shell output never reached the public pageThe flow writes a 400k-line burst through the PTY and polls for the token for 2,000 × 10 ms (20 s). The macOS runner needs longer than that for the same burst; the failure repeated on a rerun. The output path itself already passes Linux and local runs.
Change
Poll for up to 60 s before failing. The assertion and the burst are unchanged; only the macOS-dependent wait bound moves.
Verification
cargo test -p dim-agent-capabilities --test capabilities_flow host_platform_flow::a_shell_burst_completes_without_a_private_subscribercargo fmt --all -- --check