Skip to content

mark an invalid CPU delta as stale - #49

Merged
JamesLinYJ merged 1 commit into
mainfrom
cursor/cpu-stale-delta
Nov 9, 2026
Merged

JamesLinYJ merged 1 commit into
mainfrom
cursor/cpu-stale-delta

Conversation

@JamesLinYJ

Copy link
Copy Markdown
Owner

Summary

An accepted CPU sample always cleared system_sample_stale before checking cpu_delta_valid. An invalid delta kept the previous percent and did not push history, but the page stayed Ready, so that old percent looked current.

CpuPageState::apply_system_sample now marks the sample stale when the delta is invalid and a previous cpu_usage exists. The percent and history stay unchanged. With no previous usage, cpu_usage remains None and a placeholder 0 is not pushed. A later valid sample, including a real 0%, clears stale, stores that percent, and pushes it. derive_status then returns CpuPageStatus::Stale, which already uses TextKey::CpuRefreshFailedStale.

Test

invalid_cpu_delta_marks_retained_usage_stale_until_measured_zero covers the no-previous invalid delta, a retained percent marked stale, and the following measured 0%.

Linux could not compile Windows resources (llvm-rc is not installed). The change is limited to src/pages/cpu/mod.rs.

Open in Web Open in Cursor 

An accepted CPU sample cleared the stale flag before the usage delta was
checked. When that delta is invalid and a previous percent exists, keep
the percent, skip history, and report the page stale until a later valid
sample, including a real 0%, replaces it.

Co-authored-by: jameslincn <jameslincn@outlook.sg>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T06:10:27.656451Z e077a29 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@JamesLinYJ
JamesLinYJ merged commit b5a7a68 into main Nov 9, 2026
3 checks passed
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