Repository navigation
Fix power plan switching after process exit - #124
PrimeBuild-pc wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e338cce5d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Read the list after any in-flight plan change has completed. Stop events | ||
| // remove their processes before waiting for this lock. | ||
| var candidates = this.runningAssociatedProcesses.Values | ||
| .Select(process => (Process: process, Association: configuration.FindMatchingAssociation(process))) |
There was a problem hiding this comment.
Reconcile cached processes before reevaluating the plan
If WMI recovery misses a process stop and start while Windows reuses that PID for a process with no association, the snapshot cleanup keeps the old entry because the PID is still present. This candidate enumeration then evaluates the stale ProcessModel, and IsProcessStillRunning checks only the PID, so the replacement process can activate the old process's plan. Reconcile cached entries against the current process identity before using them.
Useful? React with 👍 / 👎.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
A process can exit while ThreadPilot is still handling its start. A delayed power plan switch can then leave the rule's plan active after the process has gone, even with a default plan configured.
This change checks that the process is still running before requesting the switch and reevaluates the remaining processes after any switch already in progress. The configured default is restored after the last matching instance exits.
Related to #123.
Verification