Skip to content

Fix desktop CLI errors, shutdown hangs, and run verdicts - #4478

Merged
Jason Morse (JasonVMo) merged 15 commits into
mainfrom
user/jasonvmo/desktop-driver-cli-errors
Nov 10, 2026
Merged

Jason Morse (JasonVMo) merged 15 commits into
mainfrom
user/jasonvmo/desktop-driver-cli-errors

Conversation

@JasonVMo

@JasonVMo Jason Morse (JasonVMo) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

Related to #4435.

This PR combines three groups of fixes from the desktop testing review, because they change the same files (createDesktopStorybookCommand.ts and the desktop-test contracts):

  • CLI errors (@fluentui-react-native/desktop-driver, @fluentui-react-native/storybook-desktop): usage errors are reported in every reporter mode, and the NDJSON error record is the terminal record.
  • Lifecycle (@fluentui-react-native/desktop-test, @fluentui-react-native/storybook-desktop): shutdown hangs, cancellation, and signal handling (LIFE-1 to LIFE-7, LIFE-9 to LIFE-13, LIFE-15 to LIFE-17, and the transport parts of REP-11 and REP-16).
  • Reporting verdicts (@fluentui-react-native/desktop-test): skipped, empty, or incomplete work never counts as passing coverage (REP-1 to REP-8, REP-10, REP-12, and parts of REP-15 and REP-16).

The body of commit 5680dc365 lists the wrong LIFE IDs. Use the mapping below; the commits were not amended.

CLI errors

Subcommand usage errors in desktop-driver exited 1 with no output in plain, JSON and NDJSON modes. serve kept listening after an invalid DESKTOP_REPORTER. NDJSON errors were wrapped in a terminal record, unlike JSON.

  • Silent usage errors. Commander copies exitOverride and output settings only to commands created after they are set, but the root call ran after the subcommands existed. The new configureDesktopCliCommandTree in src/cli/reporter.ts configures the tree recursively, so stories list without --url prints error: required option '--url <url>' not specified to stderr, or a usage error record in JSON and NDJSON.
  • Reporter resolution. createDesktopDriverCommand.ts resolves the reporter mode once, before any action, so serve with an invalid DESKTOP_REPORTER exits 1 without listening. Serve writes its readiness line inside the error-handling try.
  • NDJSON framing. The error record {"schemaVersion":1,"type":"error","error":{...}} is the NDJSON terminal record, identical to JSON. desktop-test's CLI uses the same helper, so its NDJSON usage errors change the same way.
  • Error codes. Option parsers in desktop-driver and storybook-desktop throw InvalidArgumentError, so bad ports, depths, and choices are usage rather than internal. WebDriver invalid argument and invalid selector map to usage, unsupported operation to unsupported, and session not created with target-busy to busy; unknown codes stay internal.
  • doctor messages are clipped to 1024 bytes instead of up to 1 MiB.
  • Behavior change for direct callers of the exported createDesktopDriverCommand: it always sets exitOverride, so parseAsync rejects with a CommanderError instead of exiting. The only in-repo callers are the CLI and its tests.

Lifecycle

  • LIFE-1, Storybook serve and story tests never exit. desktop-test tracked the integration run in its service scope with services.guard(). storybook-desktop closed that borrowed scope from inside the run (driver(), server(), and runSmokeLifecycle()), and close() waited for the run, so each waited on the other. This also caused the recorded "idle CLI after Ctrl+C" and serve --agent interrupt limitation.
    • cli.ts no longer tracks the integration run. It races the run against a stop request, and after a stop or a scope failure it waits up to 60 s for the integration to unwind before closing the scope.
    • storybook-desktop closes the scope only when it created it (ownsServices).
    • DesktopServiceScope drains tracked work with a bound (drainTimeoutMs, default 60 s). Work still running after that is reported as a cleanup failure and abandoned.
  • LIFE-2, cancellation.
    • runner.run() and runner.start() take the scope signal. Stage, suite, and storybook-desktop executePlan commands now stop when the scope stops, with failed: true. A command cannot start after the abort.
    • POSIX commands are stopped by process group: SIGTERM, then SIGKILL, until no member of the group is left.
    • An interrupted one-shot action is reported incomplete, not passed, in both the desktop-test CLI and the storybook-desktop CLI. Before this PR an interrupted storybook-desktop stage such as bundle reported [desktop] PASSED with exit 0.
  • LIFE-3, a service that never started. A service whose spawn fails (for example ENOENT) settles without a cleanup failure, and the workload claim is released.
  • LIFE-4, close robustness. A resource observer that throws (the claim writer) no longer interrupts acquisition or disposal. The failure is reported once. Claim records are written to a temporary file and renamed into place; on Windows the rename is retried.
  • LIFE-5, signals. The new signals.ts keeps the SIGINT, SIGTERM, and SIGHUP handlers installed until cleanup and the session close finish. A second signal force-stops the owned process trees, and a third exits with status 128 + the signal number. Isolating the helper's process group is in desktop-driver and is not part of this PR.
    • The policy is exported from the package root as handleDesktopInterrupts. The storybook-desktop CLI (createDesktopStorybookCommand.ts) and the standalone Storybook channel (config/server.cjs) now use it instead of process.once listeners. Those listeners were consumed by the first signal, so a second SIGINT, or any SIGHUP, killed the CLI in the middle of cleanup. The handlers are released only after cleanup and the session close finish. The channel can force nothing, so its second signal only warns.
    • Owned Node services (ownedService.ts) escalate on a second signal through the same policy.
  • LIFE-6, tree kill. POSIX stops use the process group whatever the stdio mode.
    • Windows: taskkill /T /F now runs synchronously (spawnSync, bounded by the shutdown timeout), and only while the command's exit is unrecorded. Windows reuses a process ID only after every handle to the process closes, and Node closes the child handle while it processes the exit on the same event loop, so the ID still names the owned leader when taskkill resolves it. The old asynchronous force-stop spawn could race the exit. A failed taskkill is judged by the recorded completion; the old fallback probed process.kill(pid, 0), which could match a reused ID.
    • That is the PID-safety check only. It is not descendant containment: /T follows parent process IDs, so a descendant whose parent already exited escapes. Only Job Objects close that gap, and they are deferred. Whether taskkill also checks process creation times before matching a stale parent ID was not verified.
  • LIFE-7 and REP-11, sockets. The new localSocket.ts gives processControl.ts and reporting/transport.ts a short socket path in a private owner-only (0700) directory, with a check against the platform path-length limit. It falls back to /tmp when TMPDIR is too long. Only service commands get a process-control IPC server.
  • LIFE-8, PID reuse: deferred. No change in this PR; an earlier one-second tolerance was removed again because it could match a reused PID. Inspection still compares the recorded start time exactly, and the claim still records a Node.js-clock time. desktop-driver's identity machinery is the helper's --application-incarnation mode, which verifies a pid against a helper-described start time but cannot describe one. A real fix needs a helper "describe process" mode (native Swift and C++), a helper available when the claim is taken, and a claim schema bump. lifecycle.md and current-status.md now say that pid-reused is unproven until then.
  • LIFE-9, claim location. Workload claims live in a per-user directory that does not depend on TMPDIR:
    • macOS: ~/Library/Caches/com.microsoft.fluentui-react-native.desktop-test/workload
    • Windows: %LOCALAPPDATA%\Microsoft\FluentUIReactNative\desktop-test\workload
    • Linux: ~/.cache/fluentui-react-native/desktop-test/workload
  • LIFE-10 and LIFE-11, commands. Output capture closes once and always kills the whole group. A synchronous spawn error becomes a command failure. A NUL character in the command, its arguments, its directory, or its environment is rejected as a configuration error.
  • LIFE-12, R-SCAN-002.
    • The generated WDIO config is a fixed module that reads its settings from the JSON file named by DESKTOP_WDIO_SETTINGS. It no longer splices JSON.stringify(settings) into code.
    • The AppX lookup in PowerShell reads the package name from $env:FURN_APPX_NAME.
  • LIFE-13, disposal order. Services and resources are disposed in one pass, in reverse acquisition order. The separate loop that stopped services first is removed. A service's resource.dispose, which nothing called before, is now how that pass stops the service.
  • LIFE-15, createTarget. An integration's createTarget can only add the story context (storyOrchestrator and storyRootTestId). It cannot replace the target's identity or launch modes.
  • LIFE-16, contracts.
    • The neutral boundary consumer imports all 11 public entries and fails if any of them exports nothing.
    • New contract modes: lifecycle covers in-flight cancellation, release of the claim after a spawn failure, and an observer that fails during close. interrupt-cli sends SIGINT to the CLI during a stage and expects exit 1 within 10 s, a dead stage process, and an incomplete run. spec-load-failure uses a WDIO spec that throws while loading.
    • The resources mode now checks the default claim directory.
    • Focused tests: commands.test.ts emulates Windows against a mocked taskkill (no call after a recorded exit, even while a grandchild holds the output open; a synchronous call for a running leader; and a stop that fails with taskkill's diagnostic when the leader keeps running). ownedService.test.ts escalates an owned service on a second SIGINT. storybook-desktop interrupts.test.ts interrupts a stage with SIGINT then SIGINT, and with SIGHUP then SIGTERM. serverIntegration.test.ts closes a standalone channel on SIGHUP. The three signal tests fail without the change.
  • LIFE-17, suite bound. Suites accept suiteTimeoutMs. By default the WDIO launcher bound grows with timeoutMs, spec groups, and retries.
  • REP-16 (transport part). New negative tests for reporting/transport.ts.

Reporting verdicts

  • REP-1, retries. A test's status comes from its decisive attempt. If the last attempt passed, the test passed, and it is flaky when an earlier attempt failed. Otherwise any failed attempt makes the test failed; otherwise the last attempt's status stands. runQueries.ts, results, JUnit, and the summary all use this rule.
  • REP-2, empty work. Selected worker work that finished without any reported test, and without a keyed selection, is incomplete. The WDIO reporter warns about a spec that ran no tests. The Jasmine and Mocha framework loggers log at warn, so a spec import failure shows up.
  • REP-3, WDIO attempts. Attempts keep the order they arrive in, and the attempt number from the producer is treated as opaque.
  • REP-4, presentation errors. A stalled console (5 s), a full output queue (4 MiB), or an EPIPE is now a warning and no longer changes the verdict. The final line comes from the terminal result.
  • REP-5, paths. Run-query errors use a closed set of codes. The run and artifacts roots are replaced with <run> and <artifacts> in projected text.
  • REP-6, incomplete runs. Each unmet piece of work is reported. assertSuccessful throws a typed DesktopIncompleteError, which is recorded as the run's verdict.
  • REP-7, secrets. One DesktopFailureRegistry sanitizes failures and late-registered secrets when the run is finalized.
  • REP-8. Failed, incomplete, and cancelled NDJSON milestones are never suppressed. Skipped and unsupported milestones share a separate cap of 25.
  • REP-10. Writes of the live run.json are throttled. flush() and finalize always write it.
  • REP-12. The NDJSON projection is bounded by encoded size, and a projection failure produces a minimal fallback record instead of losing the record.
  • REP-15 (first part). IPC producers cannot send collector-only kinds such as run-finished.
  • REP-16 (reporter part). Unit tests for wdio/reporter.ts.

Combining the groups

  • The reporting contract now asserts REP-4's behavior. A slow sink and a late console failure leave the run passed. The summary says passed, junit.xml does not list the late failure, and stderr shows [desktop] WARNING: Console output stopped. The warning is journaled after run-finished, as { level: 'warning', message: 'Console output stopped: late terminal fixture' }.
  • An interrupted one-shot run is incomplete, an empty spec is incomplete, and a spec that throws while loading is failed. For a spec-load failure, run.json has one failed work item labelled with the spec, and an infrastructure failure "selected work did not produce complete executable results". The original error text is only in the worker command log (commands/*.log). run.json and junit.xml do not carry it; that remains a reporting gap.
  • The CLI change reaches desktop-test only through the shared framing helpers. Its JSON and NDJSON usage errors are now error records (the reporter-cli contract asserts the JSON record), and the delegated success record {"type":"terminal","result":{"runId","delegated":true,"exitCode":0}} is unchanged (asserted by the delegated-output contract).
  • wdio/run.ts still runs assertSuccessful before it checks the exit code, so an empty spec stays incomplete. Checking the exit code first would report that spec as an infrastructure failure.

Documentation and changesets

  • desktop-test references/: lifecycle.md, commands.md, configuration.md, reporting.md (a new Verdicts section, plus signals), current-status.md, and native-qualification.md (the claim paths and Ctrl+C).
  • storybook-desktop references/commands.md: integrations borrow the scope, and the signal policy (SIGHUP, escalation, and incomplete interrupted one-shot commands).
  • desktop-driver references/getting-started.md and references/remaining-work.md: the error record shape and the NDJSON terminal rule.
  • Changesets: cli-usage-errors.md (desktop-driver and storybook-desktop patch), life-desktop-test-shutdown.md and rep-desktop-test-verdicts.md (desktop-test patch), and life-storybook-desktop-scope.md (storybook-desktop patch).
  • The desktop-test contract runner now prints AggregateError members and causes when a contract fails, so a disposal failure shows the cleanup error behind it.

Not in this PR

  • XPKG-1, unifying the three CLI startups. Only the command-tree helper moved to reporter.ts.
  • storybook-desktop bare group commands (for example sbd --reporter json) report the usage message (outputHelp), and its plain-mode configuration errors still print a stack trace.
  • Errors without structured codes still report internal: readManifest and stories explain for a missing story, the SessionManager "does not allow ... sessions" error, and the "is not registered" server error. The unknown-target and attach-only codes are reserved; nothing produces them yet.
  • LIFE-14, the refactor, apart from the shared socket helper.
  • LIFE-8, which needs a helper "describe process" mode and a claim schema bump.
  • Isolating the helper's process group, which is desktop-driver work.
  • Windows Job Objects, so orphaned descendants are not contained on Windows.
  • A spec-load error message in run.json.
  • REP-9, REP-13, REP-14, and revision negotiation for REP-15.
  • A first-class cancelled run status.

Verification

Local runs were on macOS. The native and aggregate runs held the shared native lock. Final PR head 8c202b74a.

  • Build: yarn build in packages/agentic/storybook-desktop (tsc -b, which also builds desktop-driver and desktop-test) passed.

  • packages/agentic/desktop-driver: yarn test src/cli passed: 2 suites, 33 tests (reporter.test.ts and DesktopDriverCli.test.ts).

  • packages/agentic/desktop-test: yarn format, yarn lint, and yarn build passed. yarn test passed: 23 suites, 379 tests passed, 1 skipped (an existing Windows-only test). All 30 contract modes passed, including reporting, lifecycle, interrupt-cli, spec-load-failure, resources, packageBoundary, the reporter-cli error record, and the delegated success record.

  • desktop-test CLI by hand: a usage error with --reporter json and with --reporter ndjson prints {"schemaVersion":1,"type":"error","error":{"code":"usage",...}}, exits 1, and leaves stderr empty.

  • packages/agentic/storybook-desktop: yarn format, yarn lint, yarn build, and yarn test passed: 23 suites, 338 tests passed, 4 skipped (existing PowerShell owned-service tests that run only on Windows). These tests fail on the code without the fix:

    • "leaves a borrowed scope to the integration that tracks the run in it" fails when the ownsServices guard is removed.
    • The interrupts.test.ts cases and the standalone SIGHUP test fail on the code before f01039fcb: the CLI is killed by the second SIGINT or by SIGHUP, and the channel exits by signal.
  • Root: yarn oxfmt --check on the edited markdown passed, yarn check-agent-instructions passed, and yarn markdown-link-check -c .github/markdown-link-check-config.json <file> passed for each edited markdown file.

  • Root, under the lock, on 8c202b74a: yarn clean-lage-cache && yarn lage buildci --concurrency 4 passed: 178 tasks succeeded, 0 failed (1 min 9 s).

  • Serve and Ctrl+C. In apps/storybook, yarn desktop-test --target macos serve was started as its own process group, and SIGINT was sent to the group once it was ready.

    • Before the fix (base 666e32983): the CLI was still running 90 s later and still held its claim.
    • On 8c202b74a: the CLI was ready in 2 s, exited 1 s after SIGINT with code 0, and reported PASSED: lifecycle (no tests). No owned process, driver helper, or app was left, and the claim directory was empty.
  • One story, standalone path, on 8c202b74a. The commands were yarn storybook driver --macos, then yarn storybook run --macos (exit 0, 18 s), then a wait for the app's Storybook runtime, then yarn storybook test --macos --test "exposes enabled button semantics".

    • The test passed: exit 0 in 5 s, 1 selected, 1 executed, 1 passed.
    • The driver exited 1 s after SIGINT with code 0 and left nothing in its process group. The app was then quit, and the claim directory was empty.
    • An earlier attempt that started the test 2 s after run returned failed with bridge-unavailable and exit 1. That is expected: authored-test navigation does not wait for the bridge.
  • One story, owned-runtime path, on 8c202b74a: not qualified. Two commands were tried:

    • STORYBOOK_SMOKE_STORY=components-button--default yarn desktop-test --target macos test --suite stories, the integration path behind LIFE-1, run twice.
    • STORYBOOK_SMOKE_STORY=components-button--default yarn storybook --verbose smoke --macos --mode stories-and-tests, run once.

    All three runs exited on their own in 30 to 35 s with code 1 and FAILED. Each stopped Metro, the channel, and the app, and released its claim. Each failed in the driver's first newSession, about 4 s after the app's runtime started, with the macOS helper error "Accessibility returned an incomplete or internally inconsistent window enumeration." The app was then stopped during teardown, so the driver's concurrent bridge-epoch attach also reported attach-failed.

    This PR does not change the helper's Swift sources or the attach sequence. The macOS-helper branch (Fix macOS desktop-driver input accounting and application cleanup #4482) separately passed 209 story traversals and 2 authored tests; that does not qualify this branch. A run on this branch's base was not repeated, so whether this is environmental or a base-helper race is unproven.

  • Combined integration follow-up: passed. The local integration of Harden desktop-driver native artifact cache and build locks #4477 through Check cancellation in more Windows desktop-driver helper waits #4483 merges cleanly at 921a7c9ce. Its earlier head ed9353e83 passed fresh-cache buildci (178 tasks); the only later change is contract AggregateError diagnostics, and yarn test contracts in desktop-test passed all 30 cases at 921a7c9ce.

    • yarn storybook build-driver --macos passed, building a helper from the combined sources. yarn desktop-driver doctor --platform macos --permissions reported ready, unlocked, and Accessibility/PostEvent/ScreenCapture granted without prompting or changing permissions.
    • yarn storybook bundle --macos, yarn storybook prep --macos, and yarn storybook build --macos each passed in the integration checkout; no app from another worktree was borrowed.
    • STORYBOOK_SMOKE_STORY=components-button--default yarn desktop-test --target macos test --suite stories passed, exit 0 in 291 s: 209 story traversals and 2 authored Button tests, all 211 selected/executed/passed, with zero failed, skipped, incomplete, retried, or flaky work. Run id: 76caf360-1703-4cd3-b81c-1af465939dc9.
    • The owned app, helper, and integration processes exited through normal cleanup; the claim directory is empty and the worktree is clean. The pipeline and smoke were each run once, with no source changes or retries.
    • The newly built helper artifact (50309ad4...) was the only compatible shared-cache entry. Its use is inferred from that selection state; the run record does not attest the helper path. This successful combined-head run does not isolate the cause of the earlier lifecycle-only attach failures.
    • This combined run includes Check cancellation in more Windows desktop-driver helper waits #4483 at b16d0349c; the subsequent Windows cancellation follow-up 114c2f605 is not part of this qualification.
  • STORYBOOK_SMOKE_STORY filters authored callbacks, not catalog traversal. The three failed owned-runtime attempts stopped before traversal with zero selected work; they provide teardown evidence, not passing story coverage.

  • Hosted CI at 8c202b74a: passed. All checks succeeded, including JS, macOS Fabric/Paper Storybook, iOS/macOS builds, Windows Storybook, and both Win32 Storybook lanes.

  • Not specifically qualified: physical Ctrl+C and real taskkill on Windows. The dedicated stop regressions use mocked/emulated Windows behavior; passing hosted lanes does not replace that interactive qualification. current-status.md records the remaining Windows gap.

Before After
desktop-test serve with the Storybook integration was still running 90 s after Ctrl+C and still held the workload claim. A cancelled stage waited for its command and could report passed. A failed test retried into skipped attempts passed, a spec with no tests passed, and a stalled console failed a passing run. The CLI exits 1 s after Ctrl+C with code 0 and leaves no owned processes. A cancelled stage stops its process group and the run is incomplete. These runs are failed, incomplete, and passed with a warning.

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

Commander copies exit and output settings only into commands created
after they are set, so subcommand usage errors went to an in-memory
buffer and exited silently. Apply the reporter output and exit override
to the whole command tree.

- Route usage errors through the selected reporter: one error record in
  json and ndjson, a stderr message in plain.
- Throw InvalidArgumentError from option parsers so they are reported as
  usage errors instead of internal.
- Resolve the reporter mode once and before any action, so an invalid
  DESKTOP_REPORTER no longer lets serve start listening.
- Write the serve readiness record inside the try so a write failure
  still closes the server.
- Make the NDJSON error record the single terminal record, matching JSON.
- Map WebDriver error codes to matching CLI error kinds, including busy
  for target-busy session failures.
- Clip doctor error messages to the same byte limit as other errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Option parsers and input checks threw TypeError, which the reporter
classified as internal. Throw InvalidArgumentError so the error is
reported as a usage error in every mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Describe the single error record written for usage and configuration
failures in json and ndjson modes, and correct the NDJSON terminal
record rule.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size report

Tree-shaken, minified production esbuild bundles with React and React Native runtimes externalized.

Scenario Modules-Mac (Δ) Modules-Win (Δ) Size-Mac (Δ) Size-Win (Δ)
components-button 79 (+1) 80 (+1) 72.78k (-842b) 72.71k (-842b)
components-catalog 228 (+1) 229 (+1) 228.46k (-855b) 228.38k (-855b)
design-themed-root 55 (+4) 56 (+4) 56.26k (+998b) 56.18k (+998b)
design-color-lib 6 (+0) 6 (+0) 6.27k (+0b) 6.27k (+0b)
design-theme-state-legacy-source 49 (+1) 50 (+1) 52.96k (-841b) 52.89k (-841b)
design-legacy-theme 42 (+0) 42 (+0) 39.11k (+0b) 42.91k (+0b)
design-legacy-theme-from-flex 58 (+4) 58 (+4) 60.70k (+824b) 64.51k (+822b)
design-fluent-light-theme 7 (+0) 7 (+0) 18.74k (+0b) 22.59k (+0b)
design-fluent-theme 35 (+0) 35 (+0) 27.46k (+4b) 31.25k (-1b)
design-fluent-hc-theme 32 (+0) 32 (+0) 27.34k (+0b) 31.13k (+0b)
design-flex-theme 29 (-4) 29 (-4) 14.30k (-9.07k) 14.29k (-9.07k)
design-flex-cool-theme 26 (New) 26 (New) 12.51k (New) 12.50k (New)
design-flex-warm-theme 26 (-7) 26 (-7) 12.28k (-11.15k) 12.27k (-11.15k)

The job is advisory: size changes are reported but do not fail the pull request. Bundle or analysis errors still fail.


View bundle-size workflow run

@JasonVMo
Jason Morse (JasonVMo) enabled auto-merge (squash) November 10, 2026 12:42
Retried tests no longer pass when a failed attempt is followed only by skipped
attempts, selected worker work that reported no tests is incomplete, and
presentation errors become warnings that keep the verdict. Incomplete lane runs
list their unmet work and throw a typed error, secrets are sanitized once at
finalize, run-query errors use a closed code set without filesystem paths,
NDJSON milestones never suppress failures, run.json writes are throttled, and
IPC producers cannot send collector-only events.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The producer's attempt number is opaque, so retry numbering no longer corrupts
workerAttempt, a spec that ran no tests is reported as a warning, and the
generated config raises the framework log level so spec import failures show.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Integrations borrow the supervisor scope without closing it; the CLI awaits
  the integration run outside the scope with a bound, and scope draining is
  bounded (drainTimeoutMs), so Storybook serve and story tests exit after
  SIGINT (LIFE-1). storybook-desktop closes only a scope it created.
- Stage, suite and storybook-desktop stage commands receive the scope signal;
  abort stops the POSIX process group as failed, a late spawn is refused, and
  sync spawn failures leave nothing tracked (LIFE-2, LIFE-9).
- Interrupt handlers cover SIGINT/SIGTERM/SIGHUP until cleanup completes; a
  second signal force-kills owned trees, a third exits (LIFE-3..5).
- Close disposes services and resources in one reverse order, isolates
  observer failures and releases spawn-failure claims (LIFE-10, LIFE-13).
- Per-user claim directory, atomic claim replacement and start-time tolerance
  (LIFE-6, LIFE-8 partial); one short private local-socket helper for process
  control and reporting transport, with IPC only for services (LIFE-7, REP-11).
- Generated WDIO config reads settings from a file; PowerShell reads the AppX
  name from the environment; suiteTimeoutMs bounds the launcher; NUL is
  rejected in command args and env (LIFE-11, LIFE-12, LIFE-15, LIFE-17).
- Tests: commands, services, signals, localSocket, transport negatives,
  lifecycle and CLI-interrupt contracts, public-entry consumer, borrowed-scope
  regression (LIFE-16, REP-16).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Records the fixed idle-CLI-after-interrupt cause, signal escalation, bounded
draining, reverse disposal, the per-user claim directory, suiteTimeoutMs and
the NUL rule, and the borrowed storybook-desktop scope. Adds changesets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combines user/jasonvmo/desktop-test-verdicts (REP) with the lifecycle work
because the reporting contract asserted the stalled-console verdict REP-4
removes. Resolution against the combined behavior:

- reporting contract: a stalled or failing console is a warning, so the run
  passes; the final-line failure is journaled after run-finished, which the
  contract now asserts explicitly.
- New spec-load-failure WDIO contract: a spec that throws while loading
  reports no tests yet fails rather than becoming incomplete under REP-2.
- reporting.md: SIGHUP and stopped-stage wording.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the one-second start-time tolerance from workload-claim inspection.
The recorded start time comes from the Node.js clock rather than the
operating system, and a tolerance would let a reused process ID match a
live owner. Inspection compares exactly again; the lifecycle and status
references record that `pid-reused` is unproven until the claim records a
helper-described start time (LIFE-8 deferred).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Export the desktop-test interrupt policy as `handleDesktopInterrupts` and
use it in the storybook-desktop CLI and standalone Storybook channel. The
handlers now stay installed until cleanup completes, SIGHUP is handled, a
second interrupt force-stops owned commands, and a third exits without
cleanup. Previously the one-shot `process.once` listeners were consumed by
the first signal, so a second SIGINT or a SIGHUP killed the CLI mid-cleanup.

An interrupted one-shot command, such as a stage, now reports `incomplete`
instead of passed with exit 0.

Tests: interrupted stage under SIGINT/SIGINT and SIGHUP/SIGTERM, standalone
channel SIGHUP, and an owned service escalating on a second SIGINT; each
fails without the change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run `taskkill /T /F` synchronously, and only while the command's exit is
unrecorded. Windows reuses a process ID only after every handle to the
process closes, and Node closes the child handle while processing the
exit on the same event loop, so the ID still names the owned leader. A
failed taskkill is now judged by the recorded completion rather than by
probing a process ID that may have been reused, and the asynchronous
force-stop spawn that could race the exit is gone.

This is not descendant containment: `/T` follows parent process IDs, so a
descendant whose parent already exited still escapes until Job Object
containment exists. Emulated-Windows tests cover the exit gate, the
synchronous call, and a failed taskkill for a leader that keeps running.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The spec-load-failure contract now also requires the failed work item to
be labelled with the spec that threw. The original error text remains in
the worker command log only; run.json and junit.xml do not carry it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep overlapping Storybook command handling and desktop-test reporting contracts in a single pull request.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	packages/agentic/storybook-desktop/src/cli/createDesktopStorybookCommand.ts
The contract runner printed only the outer error stack, so an
AggregateError from disposal hid the cleanup failure that caused it.
Print the error with `util.inspect` so members and causes are included.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JasonVMo Jason Morse (JasonVMo) changed the title Report desktop-driver CLI usage errors in every reporter mode Fix desktop CLI errors, shutdown hangs, and run verdicts Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants