Skip to content

CPU topology v2 phase 7: improve affinity errors and priority guardrails#13

Merged
PrimeBuild-pc merged 2 commits into
mainfrom
codex/cpu-topology-v2-phase-7-affinity-errors-priority-guardrails
May 20, 2026
Merged

CPU topology v2 phase 7: improve affinity errors and priority guardrails#13
PrimeBuild-pc merged 2 commits into
mainfrom
codex/cpu-topology-v2-phase-7-affinity-errors-priority-guardrails

Conversation

@PrimeBuild-pc
Copy link
Copy Markdown
Owner

@PrimeBuild-pc PrimeBuild-pc commented May 20, 2026

Improve affinity errors and priority guardrails

Centralize safe user-facing messages for process affinity, CPU Sets, protected processes, access denied cases, topology errors and priority guardrails.

  • Add CpuSetApplyResult detailed path while preserving existing bool CPU Sets APIs
  • Use detailed CPU Sets results in the CpuSelection affinity flow
  • Centralize affinity/priority messages in ProcessOperationUserMessages
  • Improve AccessDenied, anti-cheat/protected, invalid topology, process exited and legacy fallback blocked messages
  • Add High priority warning
  • Block Realtime priority for direct apply, profile load and registry priority requests
  • Audit and log blocked Realtime priority attempts
  • Prevent critical status messages from being cleared immediately
  • Add tests for affinity messages, CPU Sets detailed failures, priority guardrails and status clearing

No persistent rules engine, registry affinity, preset/profile migration, version or tag changes.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 20, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71e2d1a708

ℹ️ 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".

Comment on lines +794 to +796
return lowered.Contains("anti-cheat") || lowered.Contains("anti cheat") || lowered.Contains("protected")
? ProcessOperationUserMessages.AntiCheatProtectedLikely
: ProcessOperationUserMessages.AccessDenied;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid treating generic access denial as anti-cheat protection

This branch now maps any message containing "protected" to AntiCheatProtectedLikely, but ProcessOperationUserMessages.AccessDenied itself contains the word "protected" (Services/ProcessOperationUserMessages.cs). As a result, ordinary permission failures thrown from SetProcessPriority/affinity paths are misreported as anti-cheat/protected-process cases, which gives users the wrong remediation guidance and obscures when admin elevation might actually help.

Useful? React with 👍 / 👎.

Comment on lines 312 to +316
else if (this.setLimitedInfoHandle.IsInvalid)
{
// The handle was already made previously and failed, don't bother trying again
return false;
return CpuSetApplyResult.Failed(
AffinityApplyErrorCodes.CpuSetsUnavailable,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve access-denied classification for cached invalid CPU-set handles

When opening the CPU-set handle fails with access denied, the handler instance is cached; on the next attempt this IsInvalid path returns CpuSetsUnavailable instead of AccessDenied. In the current flow this causes later retries to be treated as "CPU sets unavailable" (triggering legacy fallback) rather than consistently surfacing the permission/protection block, so repeated attempts against the same process can produce incorrect behavior and messaging.

Useful? React with 👍 / 👎.

@PrimeBuild-pc PrimeBuild-pc merged commit 9f56303 into main May 20, 2026
2 checks passed
@PrimeBuild-pc PrimeBuild-pc deleted the codex/cpu-topology-v2-phase-7-affinity-errors-priority-guardrails branch May 20, 2026 14:03
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.

2 participants