Skip to content

test(core): first PowerShell shell-tool test intermittently stalls in CI #493

Open

Description

@shuv1337

The first PowerShell case in packages/core/test/tool-shell.test.ts sometimes stalls in CI and times out at 15 s. That case is Write-Output "$(Write-Output hello)" (around line 892) in "ordinary syntax reuses approvals".

What we know

Diagnostics now in place

#491 (merged in f22976b620) makes the test print a report when it times out: the ps process state plus the shell tool's job state. The next occurrence should show which of these happened:

  • pwsh hung before writing anything.
  • pwsh exited, but Bun missed the exit.

The test still fails at 15 s; it is not skipped or quarantined.

Next

Capture the diagnostic block the next time it fires (unit job log, gh run view <run> --log-failed), attach it here, and decide on a fix from that. The diagnostic-only branch pwsh-ci-diag is kept for reference.

Activity

  1. shuv1337 commented on Nov 14, 2026

    @shuv1337
    OwnerAuthor

    Bounded investigation — 2026-11-14 PST

    Root cause remains unproven. No fix, timeout change, retry, skip/quarantine, warmup, dependency bump, or release is proposed. Passing runs below are negative reproduction evidence, not evidence that #493 is fixed.

    Source: freshly fetched origin/integration-v2 at 27840dc9a8d0d1454b213aeb016ffae893e9420e, clean isolated pwsh-stall checkout. Read-only upstream comparison at d759c548aab33a7a6f5171cbeab40a59e91d90aa; no unrelated upstream merge. The cross-spawn adapter is unchanged from the failing 1c228df6c6 run.

    CI evidence

    • Inspected recent failed runs 43565490213 (unrelated session-ui boundary assertion) and 43519568020 (build failure). Neither supplies a new pwsh timeout/process-state report.
    • Re-read 43509382846: alive:true, no pending permissions, empty output after 15020ms. kill(pid, 0) succeeds for zombies too, so this does not distinguish a live PowerShell hang from an unreaped process.
    • Read parked diagnostic branch logs without merging it. 43505609084 has 131 traced cold launches, maximum 8.110s, logger maximum 13ms, and 660 repeated PowerShell tests passing. No 15s failure was captured. A long poll from a non-main thread in a successful trace does not establish the cause.

    Fresh-process experiments

    All used Bun 1.4.4 and existing real shell/Effect tests, with private HOME/XDG roots. No production server or configuration was used.

    • 17/17 fresh-home shell-suite runs completed without this failure: 12 on Linux host userspace (108 tests each), plus 5 in an unprivileged Ubuntu24.04 container (96 pass, 12 existing missing-shell skips each). The PowerShell cases ran, including the first substitution case.
    • The runner manifest identifies PowerShell7.6.10. Downloaded that exact portable release into scratch, rather than changing the installed7.7.0. Eleven host runs and all five Ubuntu runs used7.6.10; one baseline used7.7.0. Ten host suites were limited to CPU0–3 and overlapped broad core workloads; 140 pwsh descendants were observed, none lived long enough to trigger the8s diagnostic snapshot.
    • Four broad core runs passed, each7618 pass/23 existing skips. GitLab OAuth was excluded because another local service owns8080; it was not stopped. Two runs used a three-package Turbo workload (core/ai/util, concurrency3, forced uncached) to exercise captured output. AI2212 pass/29skip and Util146pass also passed in each Turbo run.
    • A process snapshot caught a separate successful parser-oracle pwsh alive8s: sleeping main thread, runnable worker threads, Blob-backed stdin. That is not the ShellTool process (stdin:ignore) and was not a15s stall.

    Reproduction commands (from packages/core, using an explicit portable executable):

    CI=true SHELL_SCAN_PWSH=/path/to/powershell-7.6.10/pwsh \
      taskset -c 0-3 bun run script/test.ts test/tool-shell.test.ts
    
    CI=true SHELL_SCAN_PWSH=/path/to/powershell-7.6.10/pwsh \
      taskset -c 0-3 bun run script/test.ts \
      --test-name-pattern '^(?!GitLabPlugin OAuth)'

    Repeat the first command in fresh runner processes, not just --rerun-each; the runner isolates HOME/XDG each time. One selection pitfall: core's node-bin setup can prepend /usr/bin ahead of a custom PATH, while Turbo strict mode strips SHELL_SCAN_PWSH. The first Turbo control therefore used installed7.7.0, confirmed by child FD paths. The second explicitly passed SHELL_SCAN_PWSH with --env-mode=loose in an otherwise minimal, credential-free experiment environment. No CI configuration was changed.

    Remaining discriminator

    The historical rate remains 2/10 full CI runs; there is no before/after repair rate because no repair was made. None of the local passes falsifies a hosted-runner-specific wait, Bun exit/capture loss, or full-workflow resource interaction. Ubuntu userspace does not replicate the hosted kernel/services; local page caches were not flushed. No macOS or Windows execution is claimed.

    On the next actual failure, preserve #491's report before teardown:

    • Z process state: exited but unreaped; investigate Bun wait/reaping.
    • gone with a running shell/job: inspect exit notification/output completion.
    • Live process: capture all thread wait channels and a bounded syscall trace of that owned child; a main-thread futex alone is insufficient to diagnose PowerShell deadlock or I/O backpressure.

    Similar Bun reports 46326, 45483, 45365, and 34069 were read, but their platform/async/sync/exit-state differences prevent attributing #493 to them.

    Checks on the unchanged source pin: root bun run check passed (40 cached typecheck tasks), core bun run typecheck:tsc passed, git diff --check passed. Existing first-pwsh coverage already owns the output/exit contract; adding a duplicate without a reproducer would not establish a regression test.

  2. shuv1337 commented on Nov 14, 2026

    @shuv1337
    OwnerAuthor

    Bounded hosted-runner probe — 2026-11-14 PST

    The reviewed diagnostic-only experiment completed: run 43612203544, exact source 174302ace970c26ca42cb5bca1d26bc5f133a3c3, one dispatch / run attempt 1 / four fresh hosted VMs / no reruns.

    No #493 failure was observed. Root cause remains unknown; this is not a fix or evidence that the issue is disproven.

    • Each leg executed the normal full unit package selection at Turbo concurrency 3 with an explicit cache bypass; all completed 32 tasks / 0 cached. Each core summary reported 7,321 pass, 339 skip, 0 fail across 333 files. Passing-case lines are suppressed, so no individual permission-case timing is available.
    • All four had four vCPUs, Bun 1.4.4 and PowerShell package 7.6.10. Three used image 20261111.370.1 with kernel 7.0.0-1017-azure; one used image 20261111.127.1 with kernel 7.0.0-1014-aws. These are not four identical-image samples.
    • Full Turbo durations were 10m20s, 7m38s, 8m41s and 10m31s. No matching 15-second PowerShell permission-command timeout or test(core): fix the stopped-command race and report stalled PowerShell calls #491 process/job diagnostic report appeared, so there is still no live/Z/gone/drain discriminator to diagnose.
    • The experiment retained the existing test timeouts, cases and retry/skip policies. Differences were forced cache bypass, streamed/tee'd unit output, a diagnostic marker, runner/source receipts and artifact upload. E2E and post-unit packaging/build checks were intentionally omitted on this non-merge diagnostic branch; success is not production qualification.

    Per-leg image/source/version pins, full job logs and unit artifacts are attached to the Actions run. Artifacts expire around November 28; a local archive with SHA-256 receipts is retained in ~/.cache/agent-ws/pwsh-493/hosted-43612203544/.

    The four-attempt bound is exhausted; no extra dispatches or retries were made. pwsh-hosted-probe is parked NONMERGE / never release from this ref. No production source change, fix PR, merge, release or host-service action followed. The historical 2/10 failures, local non-reproduction and these hosted observations are different populations—not a before/after repair rate. #493 stays open with the existing in-scope diagnostics for the next actual occurrence.

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