Skip to content

Draft: capture bounded active operations in hang watchdog notes - #26770

Draft
nwparker wants to merge 2 commits into
nwparker/win-issues-watchdog-local-1008from
nwparker/watchdog-active-operations-1008
Draft

nwparker wants to merge 2 commits into
nwparker/win-issues-watchdog-local-1008from
nwparker/watchdog-active-operations-1008

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​291 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​287
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​245 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​227

ELI5

When Orca freezes, a hang note can name operations that were still running. This draft adds that optional detail after the independent Windows watchdog and restart fix in #26763.

What Changed

Observe existing tracer span starts and ends and store up to 64 fixed operation names and start times in a 520-byte atomic buffer. The worker reads that buffer while the main thread is blocked; recovery retains the original detection-time snapshot. Marker parsing accepts only known names and bounded elapsed values, and restart writes the sanitized snapshot to the local trace.

The displayed diff is only operation capture, its CLI typecheck registration, and tests. Its base is the final core branch from #26763, not a prerequisite of that core PR. Rebase/retarget after core merges.

Why

#26719 asks for in-flight operations as well as Windows detection. Separating this feature lets reviewers assess the global tracer start/end hooks without delaying the Windows gate and lost-breadcrumb fixes. Reuse existing spans rather than introduce a second command observer or an unbounded worker-message queue.

Linked Issue

Refs #26719; the Windows/restart portion is #26763. This is limited to existing allowlisted spans, including git and Windows ACL work; it does not provide universal gh/WSL/file-write coverage or stack samples and is not a complete causal diagnosis.

Visual Proof

N/A — no UI changes. The original full implementation at 1b15061cea6e3c116c326cc0649215879f30d4f9 was exercised through hidden Windows Electron CDP: a 10-second main-thread stall produced a note and recovery, then restart persisted the breadcrumb. Original operation probe recorded git.exec:5606ms; an app.asar fixture recorded git.exec:5694ms. These are prior full-feature receipts, not fresh app runs of this split draft or signed-release validation. A named-object comparison proves all production source at this draft head is byte-identical to preserved c1c68b96; only the new equivalence/burst test differs.

Testing

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

At prior draft 400096feb86964d16e725392120e3d6a0c4156e6, full ORCA_BACKGROUND_LAUNCH=1 pnpm tc passes node/CLI/web, the changed-code quality gate passes, and 84 focused tests across 13 files pass. Tests cover atomic slot reuse, overflow bounds, privacy, detection/recovery snapshot equality, startup sink ordering, consent, and stop/error/exit cleanup. New tests compare trace records with tracking enabled/disabled and exercise 20 full-capacity bursts through the production tracer.

Fresh seven-trial macOS no-op-sink benchmark compares exact core tracer with this draft's tracer, both without and with an observer, at 40,000 spans/trial. Raw samples and exact source attribution are preserved in the split report; this is a noisy microbenchmark, not an end-to-end UI performance claim. Fresh Windows tests also pass all 84 tests/13 files. A Windows comparison of the exact core and draft tracer bundles produces equal trace records; seven 40,000-span trials measured median added overhead about 0.611µs/span (macOS: 0.204µs/span), with 520-byte buffers and zero occupied slots after every trial. Normal CI remains pending in the recorded snapshot; draft status skips some platform jobs.

Final head: ac0019a3ed6e87e1686f87767a9b4f32a9bfccd3, based on core ed4fa03decf3af5e637a862058eccf76ca8bc556. A non-force merge brings in only the two CI consent fixture corrections from core; the displayed diff remains the optional operation feature. At this final head, 116 tests pass under inherited CI indicators (84 feature/core tests plus 32 consent/orcad tests), full node/CLI/web typecheck passes, and original-base quality reports zero findings. The equivalence/burst suite remains green. Production source is unchanged from the prior draft; Windows execution and benchmark receipts above remain attributed to that prior head. Final-head CI is pending.

Review

DRAFT: adds synchronous callbacks to the global tracer on all platforms; the enabled watchdog subscribes only on macOS/Windows when local consent and development/packaging gates allow it. Review this broader performance/lifecycle risk separately from #26763. Observer errors cannot alter operation behavior, and unsubscribe/clear run at every worker shutdown boundary.

Agent skill upstream boundary

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

Notes

Only fixed names and elapsed times cross the worker boundary; no dynamic operation names, commands, attributes, or paths. The original feature source at c1c68b96b1f0ce45ac754742efa32cae4bc14646 is preserved in ancestry and local branch nwparker/watchdog-operations-preserved-1008; this split does not discard it. The base's startup-order approach and regression test were adapted from @Fanzzzd's #26468 (3cee2eadc423bee88e5e7bc83e56aef238b031f0, eb026bae9c7481e42cd50e993372ee2aab821c55); its original Co-authored-by: fanzzzd <[email protected]> trailer remains in ancestry. That attribution belongs to the core startup fix, not authorship of this operation tracker.

No remote protocol, SSH execution authority, folder workspace assumption, renderer UI, or platform command behavior changes. Full signed-release, Linux and SSH manual checks remain unperformed.

Checklist

  • This PR is small and focused on optional operation capture
  • Explained user behavior, mechanism and alternatives
  • N/A for UI proof, with behavioral evidence attribution
  • Self-reviewed correctness, privacy, cleanup and performance
  • Cross-platform and SSH/remote impact considered
  • Full typecheck, focused tests and changed-code quality pass; full lint/release packaging remain for CI

…kers

Keep global tracer lifecycle instrumentation separate from the independently mergeable Windows enablement and startup breadcrumb fix in PR26763. Preserve the original operation implementation and add trace-equivalence and sustained slot-reuse coverage.

This branch has not been deployed

No deployments
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