acpmux tests: stand-in harnesses keep normal CPU class (3 codex-steer reds on loaded fleet Macs)

LA
5d ago
+33-3

Summary

On the fleet Macs, 3 acpmux tests failed only on macOS, on the STILL-RED list (STATUS 2359):

  • stop::a_slow_stop_does_not_fold_the_next_prompt_into_the_stopped_turn
  • forum a_rule_steered_into_a_running_turn_counts_as_told
  • hub::steer_end::race_tests::an_unsent_steer_gets_its_own_turn_after_another_steer_finishes

Cause (test under load).

  • Since #27600, once a session's start is over, the daemon puts its harness in PRIO_DARWIN_BG (cpu_class.rs, default background).
  • The stand-in agent (tests/fake_agent.py) times its Codex-steer turn with short sleeps: it polls 300 x 10 ms for a joined prompt, then waits 0.2 s.
  • On a loaded fleet Mac (load1 13 to 21 on 10 performance cores, from the daemon's own host-budget warning), a background-class stand-in did not end that turn in 18 to 30 s.
  • The diagnostic event dumps show the turn's first chunk ("turn: X"), then nothing: jobs 7057c820 (stop), ad77491f (steer race) and 8432fc15 (forum: no answer to "warm up").
  • The scratch commit 093a4d29 changed only the default class to normal. With it, all 3 pass on macOS: a35af9a6, 0b8d6072, 1935c6fb.

Fix (test environment only; the product default stays background).

  • daemon_env::vars (the hermetic environment of every acpmux test process and of the daemons the tests start) sets ACPMUX_SESSION_CPU_CLASS=normal.
  • tests/cpu_class.rs, which checks the product's class, asks for background in its own process and in its real daemon.
  • The steer race unit test (library, no hermetic environment) names normal in its stand-in's profile env.
  • New check stop::a_stand_in_harness_runs_at_normal_class_in_tests (macOS).

Cause detail (review). The class change alone is proved (093a4d29 changes only DEFAULT). Host load is only inferred: the daemon logged high load in the diagnostic runs, but not in the 2 reds at 33f01ce9. Darwin background timer coalescing of the stand-in's 10 ms sleeps is another possible mechanism, and it does not need load. To decide, one run of the steer race test at background class on an idle mini (owner follow-up).

Note for the owner of cpu_class.rs. A real harness that times its work with short sleeps can also run slowly at background class on a loaded Mac. That is the product's choice (#27600, cmuxterm-hq#4947), and this PR does not change it. It only stops the tests from measuring it by accident.

Testing

runrefresult
red: new check33f01ce93ed (test only)macOS 3256ec1b (m4pro-7): FAIL, Background != Normal
red: stop / steer race at the test-only commit33f01ce93edmacOS 2fd97413 (m4pro-7) FAIL (hub_integration.rs:1323 timeout); a29da46e (m4pro-4) FAIL (steer_end_race_tests.rs:73)
green stop::a_slow_stop_does_not_fold… 5 of 537defdb6caemacOS f2ccd79c m4pro-3, 66d4bc66 m4pro-8, 69f5abda m4pro-3, 5f443a81 m4pro-7, a77653ba m4pro-2 (each compiled acpmux, 1 passed, ~9.9 s)
green forum a_rule_steered… 5 of 537defdb6caemacOS b8dfe9bf m4pro-7, 7d2cba69 m4pro-2, b0da60be m4pro-6, 14a9237c m4pro-7, 899bf74d m4pro-8
green steer race 5 of 537defdb6caemacOS a49ada96 m4pro-2, 26b79ad4 m4pro-7, f78ba0e6 m4pro-3, 793bafaf m4pro-7, 2e8a6d05 m4pro-9
new check37defdb6caemacOS efe04dc8: pass
cpu_class tests (product class still background)37defdb6caemacOS f0c3f4af: 9/9
clippy37defdb6cae89db498a red only on base hub/processes.rs:256 (fixed on feat by #30009)
after merging feat (0a45903b)clippy Linux d0a4e04f: pass; cpu_class macOS 5dd8ef18: see the check comment

Observed / Not run

Observed: everything above. Not run: Linux (Linux has no CPU class: for_session returns normal there).

Changelog

none

Proof

No capture: a test-environment change.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes three acpmux tests that timed out only on loaded fleet Macs because their stand-in harnesses ran at background CPU class once a session's start was over. This test-only change keeps the stand-ins at normal class; the product default (background) is unchanged.

  • The hermetic environment (daemon_env::vars) now sets ACPMUX_SESSION_CPU_CLASS=normal for test processes and the daemons they start.
  • tests/cpu_class.rs explicitly requests background in its own process and real daemon, so it still verifies the product's actual class.
  • The steer race unit test sets normal on its stand-in's profile env.
  • Adds a macOS check that a stand-in harness runs at normal class in tests.