Boost the active OpenConsole host and associate its window QoS #20963
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #20963"
general
weight: 0.35
DHowett
Summary of the Pull Request
Apply window-associated QoS and foreground scheduling boosts to the same list of root clients and OpenConsole hosts, following Terminal's existing pane/tab policy.
References and Relevant Issues
This is a separate, narrower alternative to https://github.com/microsoft/terminal/pull/20948. It does not modify that branch or PR.
No issue is closed by this PR.
Detailed Description of the Pull Request / Additional comments
ConptyDuplicateHostProcessHandleto obtain an owned host process handle with the rights needed for QoS and boost registration.ConptyConnectionand expose it throughHostProcessHandle()while the connection is connected. Failure to obtain it is logged without failing the connection.TerminalTrySetWindowAssociatedProcessesandSetAdditionalForegroundBoostProcesses. Check support independently and skip pane collection when neither is available. The QoS wrapper has no capability query, so it is probed once with an empty list. Unsupported APIs do not block the supported one; failed supported operations remain retryable. Keep the per-window cache and update it when supported operations succeed.GetProcAddressByFunctionDeclarationwrapper for the runtime API lookup.CalledNewQoSAPIfor QoS andWindowProcessForegroundBoostfor priority boosting, including the window, process count, and API result. Attempt to clear stale foreground membership if boost registration fails.Windows applies and removes the scheduling boost as Terminal's top-level window becomes foreground or background. The window-associated QoS target is High/Important while focused and Medium while visible but unfocused, subject to Windows' classification rules. QoS and scheduling priority are separate.
No enumeration of additional attached clients, shared-memory transport, input-request checks, environment flags, standalone console policy, process-priority-class changes, or UI-thread +1 are introduced. Existing root-client selection and the 100 ms debounce are retained. The selected root clients now receive explicit foreground registration alongside their hosts, using one shared 32-handle list.
AI assistance was used for implementation and validation. The contributor supplied the original host/focus/QoS design and confirmed personal review and application testing during implementation. The shared process list and independent API support follow subsequent maintainer guidance.
Validation Steps Performed
Release x64 build during implementation:
Passed, after restoring the test dependency required by the updated main branch:
Passed.
Focused regression command, rerun before publication from
C:\Work\terminal\bin\x64\Release:Passed: 10 existing tests, 0 failed, rerun after the reviewer-requested cleanup. The added handle-duplication test was removed; the test suite no longer calls the foreground-boost API.
Passed.
A local ETW comparison showed the rebuilt Terminal-hosted OpenConsole receiving foreground-boost transitions and Important QoS while its Terminal was focused, with MediumImportant observed in a background interval. This is diagnostic evidence, not a claim of measured typing-latency improvement or a fixed numerical priority. Multiple-pane/reparenting, unsupported-OS, and permission-restricted handoff scenarios have not been comprehensively validated.
Latest shared-list/support update: Release x64 compilation/linking and unpackaged runtime refresh passed with:
Verified that runtime OpenConsole, TerminalApp, and TerminalConnection hashes match the latest outputs. Formatting and whitespace checks passed. The existing ConPTY test results above predate this latest window-policy-only update; no new native boost-dependent test was added. Actual multi-pane focus/QoS transitions for this revision still require a fresh ETW capture.
The existing building guide is unchanged. No settings schema changes are required.
PR Checklist
- If checked, please file a pull request on our docs repo and link it here: #xxx