Repository navigation
aitools: fix flaky TestRunAgentCmdTimeoutStopsDescendants on macOS - #8208
Conversation
…er the shell is ready The test gave the shell a 100ms timeout, so the group SIGTERM often landed while sh was still starting and forking its background sleep. On macOS a child forked at that moment can miss the group signal; it then holds the output pipes until the 10s grace period ends (every macOS failure took 10.1s or more; Linux never failed). The shell now records its child before the deadline expires, and the test expires the deadline by hand through a parent context, so the command still reports an agentCmdTimeoutError. With the group signal changed to target only the leader, the test still fails (10.0s). Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 /trigger all AI agent (opus5.5, isaac_claude) |
Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 /trigger all AI agent (opus5.5, isaac_claude) |
There was a problem hiding this comment.
Automated review at 0dd0550. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) below.
This PR fixes the flaky macOS TestRunAgentCmdTimeoutStopsDescendants. The test now waits for the shell to record its child's PID, then expires the deadline by hand through a parent context that reports DeadlineExceeded. The approach is sound and still covers the group kill and the timeout classification. Two test gaps remain: the test no longer covers runAgentCmd's own timeout argument, and a failed wait leaves the shell running after the test returns.
…test failure TestRunAgentCmdTimeoutStopsDescendants takes its deadline from the parent context, so it no longer runs a real process into runAgentCmd's own timeout. TestRunAgentCmdTimeoutFires does, with a command that forks nothing, so it cannot hit the macOS fork race. The descendants test now also expires its deadline from t.Cleanup, so a failed wait for the ready file still stops the shell and its sleep. Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 /trigger all AI agent (opus5.5, isaac_claude) |
Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 /trigger all AI agent (opus5.5, isaac_claude) |
Changes
Fix the flaky
TestRunAgentCmdTimeoutStopsDescendants(libs/aitools/installer) on macOS. Test-only change.The test gave the shell a 100ms timeout, so the process-group SIGTERM often landed while
shwas still starting and forking its backgroundsleep. On macOS a child forked at that moment can miss the group signal; it then holds the output pipes until the 10s grace period ends. Every macOS failure took 10.1s or more; Linux never failed.The shell now records its child's PID before the deadline expires (then runs
wait, which forks nothing), and the test expires the deadline by hand through a parent context that reportscontext.DeadlineExceeded, sorunAgentCmdstill returns its timeout error. This matches how the sibling tests inlibs/process/group_unix_test.gowait for the child before cancelling.Dashboard
"<N>s" is not less than "5s", macOS only, 5 flaky runs in 14 days on unrelated PRs.Tests
-raceon Linux.Gaps and risks
🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.