Skip to content

Fix persistent priority reversion after process startup#33

Merged
PrimeBuild-pc merged 2 commits into
mainfrom
fix/persistent-priority-retry
Jul 11, 2026
Merged

Fix persistent priority reversion after process startup#33
PrimeBuild-pc merged 2 commits into
mainfrom
fix/persistent-priority-retry

Conversation

@PrimeBuild-pc

Copy link
Copy Markdown
Owner

Root cause

ThreadPilot treated a completed CPU-priority write as success without verifying that the process still reported the requested priority. Processes that reset their own priority shortly after startup could therefore end at Normal while Activity Log reported a successful persistent-rule apply.

Fix

The persistent-rule lifecycle is now:

apply → immediate verify → delayed verification → detect revert → one retry → final verify

  • Verifies the OS-observed priority after the initial write.
  • Detects a post-start reversion with two bounded delayed checks.
  • Allows at most one retry per PID and rule signature.
  • Cancels pending retry state and clears runtime keys when the process exits.
  • Skips retry for exited, access-denied, or protected processes.
  • Adds no continuous polling and no executable-specific behavior.
  • Attributes internal priority writes and logs initial apply, verification, reversion, retry, final verification, and failure separately.

Automated validation

  • dotnet clean ThreadPilot_1.sln
  • dotnet restore ThreadPilot_1.sln
  • dotnet build ThreadPilot_1.sln --configuration Release --no-restore
  • Official test command with coverage: 555 passed, 0 failed
  • Release build: 0 warnings, 0 errors

Real-world validation

A private diagnostic build was tested by the reporting user against a real process that resets priority shortly after startup. The logs confirmed initial High, reversion to Normal, exactly one scheduled retry, successful retry verification as High, and a final stable High priority. The implementation is general and contains no RimWorld-, Unity-, or Steam-specific logic.

Fixes #32

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codecov-commenter

Copy link
Copy Markdown

@Focaccina-Ripiena37 Focaccina-Ripiena37 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the bounded retry lifecycle, cancellation, protected/exited-process guards, write attribution, release metadata, and automated validation.

@PrimeBuild-pc PrimeBuild-pc merged commit fbfe010 into main Jul 11, 2026
3 checks passed
@PrimeBuild-pc PrimeBuild-pc deleted the fix/persistent-priority-retry branch July 11, 2026 17:17
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.

Can't save rule

3 participants