Skip to content

test(desktop): make PTT HAL liveness deterministic - #10742

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/ptt-hal-liveness-main
Jul 27, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/ptt-hal-liveness-main

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #10724.

What changed and why

  • wait until the injected CoreAudio probe has actually entered its wedged semaphore before checking responsiveness
  • replace the fixed > 10 timer/read throughput requirements in a 300 ms window with three explicit main-actor heartbeat completions and three explicit currentSnapshot completions
  • keep snapshot reads off-main so a blocking regression times out without preventing the test from releasing and joining the parked HAL probe
  • exempt the real Swift package test path, desktop/macos/Desktop/Tests/, from the user-facing changelog gate and cover that path classification with regression cases

testMainRunLoopKeepsPumpingWhileTheHALIsWedged was testing a binary liveness contract with host-throughput thresholds. Under macOS runner contention, the main actor and snapshot path still made progress, but the isolated suite completed too few iterations. The production contract is that the main actor and turn-start snapshot reads both keep completing while the HAL probe remains blocked off-main, so the new test observes those two completions independently instead of measuring scheduler throughput.

The changelog gate already exempts internal test paths because its post-merge push run cannot see a PR-only no-changelog-needed label. It covered the legacy lowercase desktop/macos/tests/ directory but not the Swift package tests under Desktop/Tests/, so this test-only patch exposed the same open failure class on the actual Swift test path.

Failure evidence

All sibling PTTInputDeviceProbeTests cases passed in those failures.

Product invariants affected

none

How it was verified

  • python3 .github/scripts/test_desktop_changelog.py passed: 4 tests
  • python3 .github/scripts/check-desktop-changelog.py --base origin/main --head HEAD passed: no desktop changes require a changelog entry
  • python3 desktop/macos/scripts/check_desktop_test_quality.py passed
  • git diff --check origin/main...HEAD passed
  • reviewed the semaphore ordering: started is fulfilled immediately before release.wait(), main-actor heartbeat and snapshot-read expectations settle before release.signal(), and finished is awaited afterward

This contribution was prepared on Windows, so the local commit hook could not run the Xcode-only swift-format command (xcrun is unavailable). Desktop Swift CI is the authoritative compile, formatter, and XCTest verification for the Swift test change.

Tests

  • ChangelogRequirementTests now covers both a top-level and nested Swift package test path.
  • The rewritten PTT test is the regression proof for the three linked flaky runs; it fails in bounded time if either the main actor stalls or snapshot reads block while the injected HAL probe is parked.

Failure class (fixes)

Failure-Class: FC-push-gate-internal-path-scope

Scoped cleanups

The changelog path exemption is a separate commit because the initial test-only head demonstrated that relying on no-changelog-needed would pass only the PR lane and could still redden the post-merge push lane.

Review in cubic

Fixes #10724.

Wait until the injected HAL probe is actually wedged, then require three main-actor snapshot reads to complete. This preserves the liveness contract without treating macOS runner throughput in a fixed 300 ms window as correctness.

Tests: desktop/macos/scripts/check_desktop_test_quality.py (macOS Swift CI required; this Windows host has no Xcode toolchain).

Failure-Class: none
@Git-on-my-level Git-on-my-level added the no-changelog-needed Skip desktop changelog enforcement for internal-only changes label Jul 27, 2026
@Git-on-my-level
Git-on-my-level merged commit e4a6264 into main Jul 27, 2026
33 of 35 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/ptt-hal-liveness-main branch July 27, 2026 22:22
undivisible pushed a commit that referenced this pull request Aug 17, 2026
Fixes #10724.

## What changed and why

- wait until the injected CoreAudio probe has actually entered its
wedged semaphore before checking responsiveness
- replace the fixed `> 10` timer/read throughput requirements in a 300
ms window with three explicit main-actor heartbeat completions and three
explicit `currentSnapshot` completions
- keep snapshot reads off-main so a blocking regression times out
without preventing the test from releasing and joining the parked HAL
probe
- exempt the real Swift package test path,
`desktop/macos/Desktop/Tests/`, from the user-facing changelog gate and
cover that path classification with regression cases

`testMainRunLoopKeepsPumpingWhileTheHALIsWedged` was testing a binary
liveness contract with host-throughput thresholds. Under macOS runner
contention, the main actor and snapshot path still made progress, but
the isolated suite completed too few iterations. The production contract
is that the main actor and turn-start snapshot reads both keep
completing while the HAL probe remains blocked off-main, so the new test
observes those two completions independently instead of measuring
scheduler throughput.

The changelog gate already exempts internal test paths because its
post-merge push run cannot see a PR-only `no-changelog-needed` label. It
covered the legacy lowercase `desktop/macos/tests/` directory but not
the Swift package tests under `Desktop/Tests/`, so this test-only patch
exposed the same open failure class on the actual Swift test path.

## Failure evidence

- current `main`: [run
30276084659](https://github.com/BasedHardware/omi/actions/runs/30276084659),
`reads == 10`
- unrelated #10574 head: [run
30280746072](https://github.com/BasedHardware/omi/actions/runs/30280746072),
`ticker.count == 5`, `reads == 4`
- unrelated #10574 rerun: [run
30283186121](https://github.com/BasedHardware/omi/actions/runs/30283186121),
`ticker.count == 7`, `reads == 7`

All sibling `PTTInputDeviceProbeTests` cases passed in those failures.

## Product invariants affected

none

## How it was verified

- `python3 .github/scripts/test_desktop_changelog.py` passed: 4 tests
- `python3 .github/scripts/check-desktop-changelog.py --base origin/main
--head HEAD` passed: no desktop changes require a changelog entry
- `python3 desktop/macos/scripts/check_desktop_test_quality.py` passed
- `git diff --check origin/main...HEAD` passed
- reviewed the semaphore ordering: `started` is fulfilled immediately
before `release.wait()`, main-actor heartbeat and snapshot-read
expectations settle before `release.signal()`, and `finished` is awaited
afterward

This contribution was prepared on Windows, so the local commit hook
could not run the Xcode-only `swift-format` command (`xcrun` is
unavailable). Desktop Swift CI is the authoritative compile, formatter,
and XCTest verification for the Swift test change.

## Tests

- `ChangelogRequirementTests` now covers both a top-level and nested
Swift package test path.
- The rewritten PTT test is the regression proof for the three linked
flaky runs; it fails in bounded time if either the main actor stalls or
snapshot reads block while the injected HAL probe is parked.

## Failure class (fixes)

Failure-Class: FC-push-gate-internal-path-scope

## Scoped cleanups

The changelog path exemption is a separate commit because the initial
test-only head demonstrated that relying on `no-changelog-needed` would
pass only the PR lane and could still redden the post-merge push lane.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10742?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
Fixes BasedHardware#10724.

## What changed and why

- wait until the injected CoreAudio probe has actually entered its
wedged semaphore before checking responsiveness
- replace the fixed `> 10` timer/read throughput requirements in a 300
ms window with three explicit main-actor heartbeat completions and three
explicit `currentSnapshot` completions
- keep snapshot reads off-main so a blocking regression times out
without preventing the test from releasing and joining the parked HAL
probe
- exempt the real Swift package test path,
`desktop/macos/Desktop/Tests/`, from the user-facing changelog gate and
cover that path classification with regression cases

`testMainRunLoopKeepsPumpingWhileTheHALIsWedged` was testing a binary
liveness contract with host-throughput thresholds. Under macOS runner
contention, the main actor and snapshot path still made progress, but
the isolated suite completed too few iterations. The production contract
is that the main actor and turn-start snapshot reads both keep
completing while the HAL probe remains blocked off-main, so the new test
observes those two completions independently instead of measuring
scheduler throughput.

The changelog gate already exempts internal test paths because its
post-merge push run cannot see a PR-only `no-changelog-needed` label. It
covered the legacy lowercase `desktop/macos/tests/` directory but not
the Swift package tests under `Desktop/Tests/`, so this test-only patch
exposed the same open failure class on the actual Swift test path.

## Failure evidence

- current `main`: [run
30276084659](https://github.com/BasedHardware/omi/actions/runs/30276084659),
`reads == 10`
- unrelated BasedHardware#10574 head: [run
30280746072](https://github.com/BasedHardware/omi/actions/runs/30280746072),
`ticker.count == 5`, `reads == 4`
- unrelated BasedHardware#10574 rerun: [run
30283186121](https://github.com/BasedHardware/omi/actions/runs/30283186121),
`ticker.count == 7`, `reads == 7`

All sibling `PTTInputDeviceProbeTests` cases passed in those failures.

## Product invariants affected

none

## How it was verified

- `python3 .github/scripts/test_desktop_changelog.py` passed: 4 tests
- `python3 .github/scripts/check-desktop-changelog.py --base origin/main
--head HEAD` passed: no desktop changes require a changelog entry
- `python3 desktop/macos/scripts/check_desktop_test_quality.py` passed
- `git diff --check origin/main...HEAD` passed
- reviewed the semaphore ordering: `started` is fulfilled immediately
before `release.wait()`, main-actor heartbeat and snapshot-read
expectations settle before `release.signal()`, and `finished` is awaited
afterward

This contribution was prepared on Windows, so the local commit hook
could not run the Xcode-only `swift-format` command (`xcrun` is
unavailable). Desktop Swift CI is the authoritative compile, formatter,
and XCTest verification for the Swift test change.

## Tests

- `ChangelogRequirementTests` now covers both a top-level and nested
Swift package test path.
- The rewritten PTT test is the regression proof for the three linked
flaky runs; it fails in bounded time if either the main actor stalls or
snapshot reads block while the injected HAL probe is parked.

## Failure class (fixes)

Failure-Class: FC-push-gate-internal-path-scope

## Scoped cleanups

The changelog path exemption is a separate commit because the initial
test-only head demonstrated that relying on `no-changelog-needed` would
pass only the PR lane and could still redden the post-merge push lane.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10742?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Skip desktop changelog enforcement for internal-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky: PTTInputDeviceProbeTests uses CI throughput as a liveness assertion

2 participants