Skip to content

[CI] Enable the existing Windows hang watchdog and preserve restart evidence - #26763

Merged
nwparker merged 6 commits into
mainfrom
nwparker/win-issues-watchdog-local-1008
Oct 9, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/win-issues-watchdog-local-1008

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​281 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​274
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65

ELI5

Windows Orca can freeze without leaving the hang note macOS already produces. Enable that existing watchdog on Windows, then preserve the previous run's note until startup can write it to the local trace.

What Changed

Accept Windows in the existing installer and respect local diagnostic consent. Before installing the worker, move the previous marker aside so a new startup hang cannot overwrite it. Report and consume that saved note only after the trace sink exists. Marker reads are size bounded; transient read failures retain evidence for retry.

This PR contains no operation tracker, shared operation buffer, lifecycle observer module, or span start/end hooks. The worker entry and protocol are byte-identical to baseline 6a15cd8972bf5c9a4d771adc513ed4d5aac7f2e0. The only tracer change is a four-line read-only sink-presence getter called during startup; the span hot path is unchanged.

Why

The Windows installer was explicitly gated to macOS. Separately, startup consumed the previous marker before opening its trace sink and silently lost the durable breadcrumb. Reuse the existing worker and fix that order rather than couple these fixes to new global tracer instrumentation. Optional operation capture is preserved in linked draft #26770, whose base is this core branch and whose displayed diff contains only that feature.

Adapted the sink-ordering approach and startup regression test from @Fanzzzd's #26468, commits 3cee2eadc423bee88e5e7bc83e56aef238b031f0 and eb026bae9c7481e42cd50e993372ee2aab821c55. The original Co-authored-by: fanzzzd <[email protected]> trailer remains in this branch's ancestry.

Linked Issue

Fixes #26466
Refs #26719 — this core covers Windows detection and restart reporting; the requested in-flight operation list is in draft #26770. Neither PR claims universal command coverage or a stack sample.

Visual Proof

N/A — no UI change. Fresh actual Windows full-startup checks used hidden Electron CDP at baseline and exact core head; all reported visible:[false]. CDP screenshots of all three runs were captured and inspected, showing the rendered empty workspace. The behavioral evidence is the independent marker poll and restart trace:

Actual startup Bounded main-thread stall Result
Baseline 6a15cd8972bf 10,000ms No marker
Core 27d07cc2474d 10,000ms Detected after 6,159ms without heartbeat; recovered at 11,457ms
Core restart Same isolated profile Previous hang in trace; marker consumed

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Final head: ed4fa03decf3af5e637a862058eccf76ca8bc556. Production source is unchanged from the Windows-validated 27d07cc2474d11e32afd714be4511d0c47cf1c57; this follow-up changes only two test fixtures.

  • Full ORCA_BACKGROUND_LAUNCH=1 pnpm tc passes node, CLI and web projects; changed-code quality passes all scans with zero findings.
  • 73 focused tests across 11 files pass on macOS and Windows. Windows ran the same Vitest configuration directly under Node because the remote pnpm wrapper cannot find Bun.
  • Fresh real Windows startup/stall/restart at C:/owd-risk-1008, isolated profiles, CDP9550/main inspector9551: baseline has no marker, core detects/recovers, restart durably reports and consumes it. No user app/profile was stalled or restarted.
  • Fresh Windows app.asar fixture made from this head's actual out/main build loads the worker and passes detection, recovery and shutdown with exit0. This is development Electron with a real archive, not a signed full release package.
  • Fresh macOS Electron production-installer smoke passes development gate, diagnostic-consent gate, forced installation, idempotent stop and worker exit0, with zero BrowserWindows.

All tests/apps used background launch. Timing overrides were test-only (6s timeout, 200ms check); production remains 45s timeout, 2s heartbeat, 5s check. The previous CI test shard failed nine assertions because the fixtures inherited GITHUB_ACTIONS; exact old-head reproduction with CI=true GITHUB_ACTIONS=true confirmed all nine. Both fixtures now stub and restore every production-recognized CI variable and the diagnostic-disable variable, using the existing consent-test pattern; all assertions and consent-off coverage remain. At the final head, 105 tests across 13 files pass with all eight CI indicators set (73 core tests plus 32 consent/orcad tests), full typecheck passes, and the quality gate against original base 6a15cd8972bf reports zero findings. Exact fixture transport to an isolated Windows directory was SHA256-verified and cleaned; no fresh Windows execution is claimed for this test-only follow-up. New-head CI is pending; full lint/release packaging remain CI work. Split evidence and prior full-feature attribution are preserved in the coordinator's durable report.

Independent release verification reproduced the old head's nine failures in both affected files with ORCA_BACKGROUND_LAUNCH=1 CI=true GITHUB_ACTIONS=true. At exact ed4fa03, the same full files passed all 14 tests under stock Bun 1.4.2 and Node v24.20.0; all assertions and production consent behavior remain unchanged. This is separate from the author's broader 105-test report above.

At the 2026-10-09 06:56:36 UTC release snapshot, exact-head static analysis/typecheck, repository guards, persistence and relay integration passed. Five unit shards and the main package job were queued; Windows packaging was running. The aggregate verify check had not appeared. These pending jobs are not claimed as passing. Ordinary CI continues in run 37895041474; the standard matched-head merge does not override repository rules.

Review

Core is independently mergeable against main and does not depend on #26770. The read-only sink check is required to avoid consuming evidence when diagnostics are disabled or initialization has not installed a sink. This split removes cross-platform tracer lifecycle risk from the core; startup order and filesystem behavior remain its main review surface.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source copied or translated.

Notes

Local consent prevents new writes. Existing worker shutdown, archive resolution and platform gates remain; Linux stays disabled. No remote wire format, SSH execution authority, folder workspace assumption, mobile behavior or UI changes. Linux/SSH manual runs and full signed-release checks were not performed. Earlier operation/profiling claims belong to the preserved full implementation and draft #26770, not this reduced core.

Checklist

  • This PR is small and focused
  • Explained before/after, mechanism and alternatives
  • N/A for UI proof with hidden behavioral evidence
  • Self-reviewed correctness, privacy and performance
  • Cross-platform and SSH/remote impact considered
  • Full typecheck, focused tests, changed-code quality and real Windows development build pass; full lint/release packaging remain for CI

nwparker and others added 3 commits October 8, 2026 22:45
…ve operations

Enable the existing worker watchdog on Windows and retain a bounded name-only
snapshot from atomic shared slots when the main thread stops responding.
Preserve the previous marker until the startup trace sink exists, so a new
startup hang cannot overwrite the unreported previous run.

Adapt the startup-order regression coverage from community PR #26468.

Co-authored-by: fanzzzd <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29f3c77e-1e4d-42c5-99d7-ad4939c2bf42
📥 Commits

Reviewing files that changed from the base of the PR and between 27d07cc and ed4fa03.

📒 Files selected for processing (2)
  • src/main/hang-watchdog/main-thread-hang-watchdog.test.ts
  • src/main/hang-watchdog/previous-hang-detection.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The watchdog now supports packaged Windows builds as well as macOS, subject to local-file observability consent. Marker handling adds size and field validation, non-consuming reads, and retention when filesystem inspection fails. Startup preserves prior-run markers and reports them after a trace sink becomes active.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ed4fa

The reviewed changes improve Windows watchdog test coverage and cleanup. No user-facing regression or merge-blocking risk is established in this review scope.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed The implementation meets [#26466]. initializeReadyFoundation preserves the current marker before watchdog installation. initializeMainProcessObservers initializes observability before reporting th…
Out of Scope Changes check Passed The changes stay within the declared hang-watchdog scope. Windows enablement, consent checks, bounded marker reads, retry retention, and related test-fixture updates support reliable hang detection an…
Title check Passed The title clearly summarizes the primary changes: enabling the Windows hang watchdog and preserving restart evidence.
Description check Passed The description is complete and closely follows the repository template. It explains the user impact, implementation, motivation, linked issue, testing, platform limitations, and checklist status. It …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker nwparker changed the title Enable Windows hang watchdog and preserve previous-run diagnostics [CI] Enable Windows hang watchdog and preserve previous-run diagnostics Oct 9, 2026
@nwparker nwparker changed the title [CI] Enable Windows hang watchdog and preserve previous-run diagnostics Enable the existing Windows hang watchdog and preserve restart evidence Oct 9, 2026
@nwparker nwparker changed the title Enable the existing Windows hang watchdog and preserve restart evidence [CI] Enable the existing Windows hang watchdog and preserve restart evidence Oct 9, 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.

Hang watchdog breadcrumb from the previous run never reaches the trace

1 participant