Skip to content

A WhatIf test times out in the emulated x86 host on the ARM64 runner #98

Done

Description

@fadwen

Summary

One test of Tests/Unit/Module.WhatIf.Tests.ps1 fails now and then in the Windows on ARM job of quality-gates.yml. It runs a script in the 32-bit host with a timeout of 60 seconds, and on the ARM64 runner that host is emulated: the run sometimes takes longer than the timeout, comes back as timed out, and the test fails on the exit code.

Findings

The test is "does not ask again inside a run the caller agreed to, in a session that cannot answer" (lines 228 to 247 on main). It calls Invoke-IslScriptRun with Architecture = 'x86' and -TimeoutSeconds 60, and expects exit code: 0.

Run Branch Result of the test Time
45300899213 fix/terminating-errors-harness Failed: exit code: 61.16 s
45314374634 fix/terminating-errors-analysis Failed: exit code: 61.2 s
45301061629, 45301781578, 45308632855, 45310065917 the same branches and fix/test-prompt Passed the whole file of 14 tests took 49 to 80 s

An empty exit code is what a run that timed out returns, and 61 seconds is the timeout plus the cleanup. The x64 jobs and the Windows PowerShell 5.1 job passed in all six runs. The order of the files was shuffled differently in each run, and in the passing runs the file ran both before and after the other files that start processes, so the order does not explain it.

The test is about the confirm preference inside a run, not about the architecture. On Windows on ARM there is no x64 host, and x86 is emulated; the native host is arm64 there.

Proposed change

Run the script in the device's own 64-bit host (Get-IslHostArchitecture: arm64 on the ARM64 runner, x64 elsewhere), which is the host the other test of the file that really runs a script gets from Invoke-IntuneDetectionTest's default (line 49).

Discovered and written up with Claude Code.

Activity

  1. fadwen commented on Nov 24, 2026

    @fadwen
    OwnerAuthor

    A third failure, and a check that it is not the branches.

    Discovered and written up with Claude Code.

  2. fadwen commented on Nov 24, 2026

    @fadwen
    OwnerAuthor

    A correction to the comment above, and a change to #99.

    The failures are not shown to be the runner's spread. Two more runs failed the same way, 45482242313 on #92 and 45483093006 on #95, each after 61.1 s. Counted by the code under test, the Windows on ARM job failed on this test in 5 of 9 runs of the branches of #92, #95 and #96, and in none of about 8 runs of main's code. If the rate were the same for both, a split that uneven would come up about 2 times in 100. The passing runs take about the same time on both (the whole file 47 to 53 s, with one run of 80 s on #94 and one of 87 s on main), and the files that ran just before the test do not differ in any visible way. The cause is not known. What the comment above said, "the spread is the runner's", does not follow from these numbers.

    #99 keeps the x86 host. The Windows on ARM job runs the unit suites only (./Tests/Invoke-Tests.ps1 -TestType Unit), and the other unit tests that name x86 mock the launch, so this test is the one that starts the emulated host for real on that runner. Moving it to the native host, as #99 first did, would have left that host untested there. #99 now gives the run 300 seconds, the default of the commands, in place of 60.

    What that leaves open. With 300 seconds the test no longer shows whether the emulated start is slower with the changes of #92. Measuring it needs either an ARM64 device or a run that prints the run's Duration, which this job does not do today.

    Discovered and written up with Claude Code.

  3. fadwen commented on Nov 24, 2026

    @fadwen
    OwnerAuthor

    Measured on an ARM64 device (Windows 10.0.26200, PowerShell 7.7.0): #92 does not make the emulated x86 start slower.

    The launch the test makes, Invoke-IslScriptRun -Architecture x86 under a confirm preference of Low with a script that writes a marker and exits 0, was run from fresh processes with main's code (c4bc352) and with #92's (9897016), alternating, three rounds of four:

    x86 runs Range
    main 12 1.7 to 2.2 s (2.2 s was the first run of all)
    #92 12 1.7 to 1.9 s

    Every run exited 0 and none timed out. The native arm64 host took 0.2 to 1.0 s on both. So the launch is about 30 times faster than the 60 s timeout on that device, the same on both trees, and the CI failures come from the hosted ARM64 runner, which is far slower or more variable for this start. The higher failure count on the stack's branches is then most likely chance, though the numbers above do not prove that either. #99's 300 s stands.

    One run of the test file on that device failed for another reason: with #92's code it ended in 13 s with one failed test, where every other run of the file passed in 15 to 17 s. It did not happen again in three more runs. It is being looked into separately and does not involve the timeout.

    Discovered and written up with Claude Code.

  4. fadwen commented on Nov 24, 2026

    @fadwen
    OwnerAuthor

    The one failure on the ARM64 device did not come back.

    Tests/Unit/Module.WhatIf.Tests.ps1 was run 30 times with #92's code (9897016) and 30 times with main's (c4bc352), in alternating batches of 15 in one process each, on the same device (Windows 10.0.26200, PowerShell 7.7.0, Pester 6.2.0). All 60 passed: about 13 s a run once the process was warm, and 15 to 16 s for the first run of each process. With the three earlier passing runs, #92's code passed 33 times after the one failure. That failure was recorded without its test name or error text, so its cause is not known; it was not the timeout, which allows 60 s for one run that takes about 2 s there.

    No IntuneScriptLab-* scheduled task was registered before, during or after the runs, and the number of folders under %TEMP%\IntuneScriptLab did not change, so the runs leave nothing behind.

    Nothing further is planned for it unless it shows up again.

    Discovered and written up with Claude Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions