Skip to content

fix(server): stop the "Machine overloaded" warning while the CPUs sit idle - #45337

Open
SimonLiu423 wants to merge 3 commits into
pingdotgg:mainfrom
SimonLiu423:fix/macos-load-overload-warning
Open

SimonLiu423 wants to merge 3 commits into
pingdotgg:mainfrom
SimonLiu423:fix/macos-load-overload-warning

Conversation

@SimonLiu423

@SimonLiu423 SimonLiu423 commented Nov 29, 2026 •

Copy link
Copy Markdown

On my Mac the sidebar said "Machine overloaded: Work waits for a free CPU most of the time", while Activity Monitor showed the CPU about 80% idle. Without Linux PSI, the CPU level came only from the 1-minute load average per core (severe at 3, held until 1.2). A Mac that is swapping keeps load around 9.6 on 8 cores while the cores sit 85% idle, so the warning fired and stayed up. The real bottleneck was memory.

Now the load average counts as CPU overload only while the host CPUs are nearly all busy: under 10% idle to enter a level, under 25% to hold it, using the same hysteresis as the other levels. Idle time comes from os.cpus() deltas between pressure samples. When idle is unknown (first sample, or stale), the previous level stays and the sample counts as unread, so a warning can't outlive its data.

Follow-up: this removes the wrong CPU warning but adds no memory warning; #45344 tracks warning when macOS memory paging slows agents.

Proof: new grading rows and a macOS layer test fail on main and pass here; vp run check:changed passes. On my Mac (load 12.4 on 8 cores, 43% idle), the old rule kept severe and the new rule reads none.

Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code (T3 Code); reviewed by gpt-6.2-sol in Codex.

🤖 Generated with Claude Code

… idle

Without Linux PSI the CPU level came from the load average alone, which
stays high on a swapping Mac with idle cores. Grade the load average only
while the host CPUs are nearly all busy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 29, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cf14e54

Macroscope's review found this PR approvable — CPU overload warnings now account for actual CPU idle time when Linux PSI is unavailable, reducing misleading warnings during memory or disk waits. The change is confined to advisory telemetry and preserves existing stale-sample safeguards.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CPU pressure fallback now considers host CPU idle time alongside load average. The host resource sampler derives idle share from successive CPU readings, and the tests cover pressure thresholds, missing data, and Darwin behavior.

Changes: CPU pressure assessment

Layer / File(s) Summary
Derive host CPU idle share
apps/server/src/resourceTelemetry/HostResources.ts
PressureSample now includes nullable CPU idle share. The sampler derives it from successive host CPU readings when the sample age, CPU count, and counter checks pass.
Apply load-based pressure thresholds
apps/server/src/resourceTelemetry/HostResources.ts, apps/server/src/resourceTelemetry/HostResources.test.ts
When CPU PSI is unavailable, load-based pressure requires CPU idle share below the saturation threshold. Tests cover pressure behavior, unread CPU data, and Darwin sampling.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#41997 — The issue describes load average indicating overload while the host is mostly idle. This change addresses the same condition in the server-side HostResources path; whether it fixes the issue’s client-side diagnosis is not confirmed.

Suggested reviewers: juliusmarminge, iamshadmantaqi

Merge Risk: Minimal · up to cf14e

The change stops high load average alone from being treated as CPU overload on idle machines, such as a swapping Mac. No actionable merge-blocking risk was found, and the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server stops the "Machine overloaded" warning while the CPUs are idle. The raw summary shows the load-average CPU fallback now requires measured CPU idle time belo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It has a clear Problem (sidebar warned "Machine overloaded" on a Mac whose CPUs were about 80% idle, caused by load-average fallback without PS…
Full details: Title check

Explanation

The title names the main change: the server stops the "Machine overloaded" warning while the CPUs are idle. The raw summary shows the load-average CPU fallback now requires measured CPU idle time below 10%, with a 25% hold threshold, so the title matches the changeset.

Full details: Description check

Explanation

The description follows the repository template closely. It has a clear Problem (sidebar warned "Machine overloaded" on a Mac whose CPUs were about 80% idle, caused by load-average fallback without PSI), a Change section explaining idle-time derivation from os.cpus() deltas and the 10%/25% hysteresis, and a Scope note that this is a bug fix tied to the observed behavior, with a follow-up issue (#45344) referenced for the memory warning gap. Verification gives specific evidence: new grading rows and a macOS layer test that fail on main and pass with the change, a passing check:changed run, and a concrete before/after reading (load 12.4 on 8 cores, 43% idle: old rule severe, new rule none). The template's required attribution line for agent use is present (model and harness named). Minor gaps: the Scope section does not link a specific issue that shows the bug, and it does not explicitly say why no issue is needed, so the bug link requirement is only partly met. The Verification section states what was run but does not list anything that could not be checked on other platforms (for example Linux PSI-present paths), which the template asks for.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a6516fb and cf14e54.

Files selected for processing: 2

  • apps/server/src/resourceTelemetry/HostResources.test.ts
  • apps/server/src/resourceTelemetry/HostResources.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). takeover:in-progress A takeover lead is working on this PR vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants