fix(desktop): scope native activity and distinguish decode CPU time - #74
Merged
Merged
Conversation
rldyourmnd
marked this pull request as ready for review
October 1, 2026 22:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Installed diagnostics reported occasional 0.3–0.75 second native decode stages even for tiny packets, alongside separate multi-second frame reads. Elapsed native duration alone could not distinguish actual CPU work from waiting/preemption, and reporting delay could inflate the completed stage.
Completed decode probes now fix their end time before reporting and sample the worker's read-only thread CPU clock. Unsupported/failed CPU observations stay absent. A macOS viewer-lifetime Foundation user-initiated activity keeps ongoing reference processing classified as user-requested work while the window is covered, explicitly allowing idle system sleep and preserving ordinary display sleep/lock behavior. No global power/QoS policy is changed.
Validation: a real blocking-worker fixture performs 20 ms of CPU work and 80 ms of sleeping and verifies that thread CPU excludes the wait. All 72 macOS desktop unit tests and strict workspace/all-target/all-feature lint passed. All-feature focused suites passed 217 tests on macOS and 220 on Linux (9 explicit display-dependent ignores). Linux strict all-feature workspace lint and both optimized builds passed. Installed executable digests, original identities, IPC and remote service health were verified; native follow-up is running. Existing pinned Rustix/Foundation bindings are reused; no new package or wire change.
App Nap is a candidate, not a proven cause. The installed predecessor still failed native continuity (ten minutes: decoded-age p95 799 ms/max 6570 ms, zero reconnects). CPU observations and the activity guard require current installed follow-up; this PR does not close latency, quality or sustained stability acceptance.