Skip to content

test(runtime-host): attribute Windows startup stalls - #3454

Open
liugddx wants to merge 1 commit into
apache:mainfrom
liugddx:fix/windows-runtime-host-startup-diagnostics
Open

test(runtime-host): attribute Windows startup stalls#3454
liugddx wants to merge 1 commit into
apache:mainfrom
liugddx:fix/windows-runtime-host-startup-diagnostics

Conversation

@liugddx

@liugddx liugddx commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

Adds bounded structured evidence to Runtime Host election timeout failures and a repeatable Windows fresh-root startup stress entry point.

The diagnostic distinguishes the observed startup cut with the exact Candidate PID/attempt identity and exit state, the final election elapsed time, endpoint-connected observation, fixed observation counters, and the last safe registration summary. Desktop and CLI startup errors include the same structured JSON.

This is diagnostic-only. It does not change the 45-second election deadline, retry/respawn policy, candidate backoff, endpoint behavior, public wire protocol, or existing failure classification.

Refs #3279.

Diagnostic boundary

  • Candidate launches are counted by launch-object identity, so a coalesced owned launch remains one process attempt even when election asks repeatedly.
  • Quick exits retain exact code/signal evidence; running attempts remain distinguishable from exited/unknown attempts.
  • The diagnostic does not add the runtime root path or endpoint value to startup errors.
  • The detached Candidate still uses stdio: 'ignore'. This PR does not claim to capture child stderr.
  • sawEndpointConnected and the observation counters are election observations plus final elapsed time, not exact endpoint publication/phase timestamps.

Capturing child stderr, adding detailed phase timestamps, or changing startup policy remains deferred until this evidence classifies another real failure.

Stress harness

npm run stress:windows-runtime-host-startup -- <iterations> <parallel> <electionDeadlineMs> <settleTimeoutMs> [keep-failures]

The runner creates an isolated root per iteration, emits NDJSON for every iteration plus a summary, coalesces ownership of the exact Candidate attempt, and settles that attempt before removing the root. A rejected spawn is reported as election failure evidence rather than overriding the iteration in cleanup; resolved-attempt settlement errors still propagate.

Verification

L1/L2 on exact head b2315f21eec3076592d86643d492c6e7f5e70183:

  • npm run lint: 2,472 files, 0 errors
  • npm run format:check: 1,554 files, 0 changes
  • Runtime Host, CLI, and Desktop main build/typecheck passed
  • checkout-only CI contracts: 55 passed, 0 failed, 1 privilege-dependent symlink skip
  • startup-error + stress tests: 9 passed
  • targeted election/coalescing: 3 passed
  • owned Candidate quick-exit: 1 passed
  • CLI Runtime Host context: 9 passed
  • Desktop Runtime Host manager: 22 passed
  • git diff --check passed
  • independent author-gate review: no unresolved P0-P2 findings

Windows dynamic evidence on this exact head:

  • fresh-root stress: 1/1 connected in 5.642 seconds
  • exact Candidate exited with code 0 / no signal
  • Candidate PID exited and the root created by this run was removed

Local limitation: an unrelated full Runtime Host suite process was already stalled on this machine, so the authoritative merged-base full-suite evidence is core CI rather than another local full-suite run.

L3 on the merged result:

Remaining work

  • Use a future real occurrence to classify Candidate exit, endpoint observation, or stale registration before proposing a behavior fix.
  • Decide separately whether a bounded retry/respawn, endpoint hygiene, or deadline policy change is justified.

Fresh merged-base and packaged Windows CI are green; the PR is ready for review.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented the bounded diagnostic and stress harness, added focused regression coverage, ran local verification, and used an independent review agent for the author gate. The commit includes a Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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.

1 participant