Skip to content

Add global low power mode - #2518

Merged
steipete merged 3 commits into
steipete:mainfrom
Carl723000:codex/global-low-power-mode
Aug 2, 2026
Merged

Add global low power mode#2518
steipete merged 3 commits into
steipete:mainfrom
Carl723000:codex/global-low-power-mode

Conversation

@Carl723000

Copy link
Copy Markdown
Contributor

Fixes #2508

Summary

  • add a default-off global Low Power Mode under General → Refreshing
  • clamp automatic provider refreshes, Adaptive refreshes, local usage scans, and storage scans to a minimum 30-minute interval
  • apply the existing OpenAI Web battery-saver policy while global Low Power Mode is enabled
  • preserve manual refreshes, saved refresh-frequency choices, statistics settings, and Agent Sessions behavior
  • distinguish the provider-specific OpenAI web battery saver from the global control
  • include an audited Simplified Chinese translation and Chinese design document

Behavior

Background channel Normal behavior Global Low Power Mode
Fixed / Adaptive provider refresh selected or adaptive cadence no more often than every 30 minutes
Reset-boundary provider refresh may run before the normal poll never earlier than the 30-minute minimum
Local token / cost scan follows refresh cadence, minimum 5 minutes minimum 30 minutes
Provider storage scan 5-minute automatic cooldown 30-minute automatic cooldown
OpenAI Web routine refresh provider-specific saver controls it treated as saver enabled
Explicit manual refresh immediate unchanged

Validation

  • 56 focused tests in 9 suites passed, covering policy, settings, fixed/Adaptive timers, reset-boundary refresh, local usage, storage, and OpenAI Web gates
  • the regular OpenAI Web regression test was mutation-checked: reverting the runtime to the provider-only saver makes it fail
  • SwiftFormat: 0/1660 files require formatting
  • app locale checker: 22 catalogs pass against 1307 English keys
  • plutil and git diff --check pass
  • release CodexBar product build passed locally with the repository's Command Line Tools compatibility flags
  • portable repository checks passed; local SwiftLint execution is unavailable because this Mac has Command Line Tools rather than the full Xcode SourceKit framework, so CI remains authoritative for SwiftLint

The local ad-hoc no-Widget packaging used for manual testing is not part of this PR.

🤖 Generated with OpenAI Codex

Clamp automatic provider, local usage, storage, and OpenAI Web work while preserving manual refreshes.

Co-authored-by: OpenAI Codex <215057067+openai-codex[bot]@users.noreply.github.com>
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 6:58 PM ET / 22:58 UTC.

ClawSweeper review

What this changes

Adds a default-off Global Low Power Mode that clamps automatic provider refreshes, local usage scans, storage scans, reset-boundary refreshes, and optional OpenAI web work to a 30-minute minimum while preserving user-initiated refreshes.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary as the active implementation of the linked global low-power request. The branch cleanly merges with current main, its shared policy is wired through the automatic scheduling seams, and the new redacted installed-app evidence satisfies the real-behavior proof gate; it should proceed through the current CI and normal maintainer merge decision.

Priority: P3
Reviewed head: 89066087a12db698f11587111a7cff6ea42806ba

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused coverage, clean scheduling boundaries, maintainer validation context, and relevant installed-app runtime proof; remaining CI is a normal exact-head merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The contributor supplied redacted live output from an installed CodexBar.app showing a natural 30-minute automatic cycle, return to an idle sleeping state, no persistent background children or sockets, and a retained manual Refresh action.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The contributor supplied redacted live output from an installed CodexBar.app showing a natural 30-minute automatic cycle, return to an idle sleeping state, no persistent background children or sockets, and a retained manual Refresh action.
Evidence reviewed 5 items Shared policy and persisted default-off setting: The PR introduces one 30-minute automatic-interval policy, persists the new Boolean setting with a false fallback, and combines it with the existing OpenAI web saver without rewriting the provider-specific preference.
Settings changes restart automatic work: Current main observes the background-work settings revision and, after a setting change, restarts both the provider timer and the token timer before refreshing dependent runtime state.
Automatic timer and reset-boundary paths are clamped: The PR applies the shared interval to fixed and adaptive timer scheduling, and supplies a 30-minute earliest automatic refresh time to reset-boundary scheduling; user-initiated refreshes remain separate from the automatic timer closures.
Findings None None.
Security None None.

How this fits together

CodexBar persists refresh settings in its settings store, then uses them to schedule provider polling, local token and cost scans, storage-footprint scans, and optional OpenAI web enrichment. This PR inserts a shared low-power interval policy before automatic work is scheduled while preserving the user-initiated refresh path.

flowchart LR
  A[Saved refresh settings] --> B[Global Low Power Mode]
  B --> C[Shared interval policy]
  C --> D[Provider refresh timers]
  C --> E[Local usage scans]
  C --> F[Storage footprint scans]
  B --> G[OpenAI web saver gate]
  D --> H[Updated usage menu]
  E --> H
  F --> H
  G --> H
Loading

Before merge

  • Resolve merge risk (P1) - The PR changes several background scheduling paths; merge should wait for the already-running macOS test shards to complete on the exact reviewed head.
  • Complete next step (P2) - No discrete repair is needed; wait for the running exact-head checks and use the normal maintainer merge path.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Feature coverage 26 files affected; 717 additions, 19 deletions The change covers persisted settings, four automatic scheduling surfaces, user-facing copy, and focused regression tests.
Focused test additions 9 focused test files changed; 1 new policy test suite The patch exercises the shared policy, settings persistence, timer behavior, reset-boundary behavior, storage cooldown, and OpenAI web gating.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the default-off setting after the exact-head CI completes, retaining the shared policy as the single source of truth for automatic work and keeping manual refreshes independent.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the default-off setting after the exact-head CI completes, retaining the shared policy as the single source of truth for automatic work and keeping manual refreshes independent.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds a new opt-in power-management capability rather than repairing a defined current behavior failure. Its after-fix runtime proof is a redacted installed-app transcript showing an automatic cycle on the intended 30-minute boundary and preserved manual refresh access.

Is this the best way to solve the issue?

Yes. A single shared interval policy plus a persisted default-off setting is the narrowest maintainable solution, and the wiring preserves existing preferences instead of mutating saved refresh frequency or disabling features.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2920019bc16d.

Labels

Label justifications:

  • P3: This is a default-off power-management enhancement with limited urgency rather than a broken core workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The contributor supplied redacted live output from an installed CodexBar.app showing a natural 30-minute automatic cycle, return to an idle sleeping state, no persistent background children or sockets, and a retained manual Refresh action.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied redacted live output from an installed CodexBar.app showing a natural 30-minute automatic cycle, return to an idle sleeping state, no persistent background children or sockets, and a retained manual Refresh action.

Evidence

What I checked:

  • Shared policy and persisted default-off setting: The PR introduces one 30-minute automatic-interval policy, persists the new Boolean setting with a false fallback, and combines it with the existing OpenAI web saver without rewriting the provider-specific preference. (Sources/CodexBar/BackgroundWorkPowerPolicy.swift:3, 89066087a12d)
  • Settings changes restart automatic work: Current main observes the background-work settings revision and, after a setting change, restarts both the provider timer and the token timer before refreshing dependent runtime state. (Sources/CodexBar/UsageStore.swift:63, 2920019bc16d)
  • Automatic timer and reset-boundary paths are clamped: The PR applies the shared interval to fixed and adaptive timer scheduling, and supplies a 30-minute earliest automatic refresh time to reset-boundary scheduling; user-initiated refreshes remain separate from the automatic timer closures. (Sources/CodexBar/UsageStore.swift:808, 89066087a12d)
  • Clean merge result against current main: A three-way merge-tree check against current main produced no conflict markers; GitHub also reports the PR as mergeable. (89066087a12d)
  • Recent scheduling-area provenance: Recent current-main history includes usage-store maintenance by Xu Xiang and merges by Peter Steinberger on the surrounding provider and usage paths; the PR's latest head is the follow-up low-power gate commit. (Sources/CodexBar/UsageStore.swift:808, 89066087a12d)

Likely related people:

  • Peter Steinberger: Recent history shows merged work on the surrounding provider and usage-store surface, and the supplied PR discussion records direct maintainer gate and integration review. (role: recent area reviewer and merger; confidence: high; commits: c80131732d55, b1170d83963d; files: Sources/CodexBar/UsageStore.swift, Sources/CodexBar/SettingsStore+Defaults.swift)
  • Xu Xiang: The current-main head commit maintains UsageStore behavior, the central automatic-refresh owner in this change. (role: recent area contributor; confidence: medium; commits: 2920019bc16d; files: Sources/CodexBar/UsageStore.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress macOS test shards and Linux musl build to complete on the reviewed head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-07-30T17:02:37.132Z sha 403cce7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T05:23:43.991Z sha 403cce7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T22:24:19.167Z sha 8906608 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T22:39:22.520Z sha 8906608 :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Maintainer gate pass complete at 89066087a1.

I merged current origin/main, fixed the stale SwiftLint failure in the Low Power Mode subtitle, and added the credited changelog entry.

Proof:

  • make check — passed (0 SwiftFormat changes, 0 SwiftLint violations).
  • Focused low-power/settings/scheduling/storage suites — 132 tests in 8 suites passed.
  • make test — all 779 selections passed. One unrelated Kiro timing group failed its first pass and passed the harness's automatic full-group retry; no isolated selection retries.
  • Bounded source-blind behavior run from a temporary directory — the same 132 compiled tests passed, proving the setting defaults off, automatic intervals below 30 minutes clamp to 1800 seconds, longer intervals remain unchanged, manual cadence stays unscheduled, and user-context forced refresh still executes under Low Power Mode.
  • Autoreview delta and full branch review against origin/main — clean, no accepted/actionable findings.

The fork head is updated; CI is rerunning. I did not merge the PR.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 2, 2026
@Carl723000

Copy link
Copy Markdown
Contributor Author

Runtime evidence from a real installed CodexBar.app with Global Low Power Mode enabled (redacted; no account identifiers or private paths):

scenario=idle duration=5m process_cpu_delta=0.04s rss=53MB
idle_wakeups_start=3 idle_wakeups_end=3 activity_monitor_energy_impact=0.0

scenario=natural_automatic_cycle interval=30m process_cpu_delta=8.86s
idle_wakeups_delta=1 rss_peak=337MB rss_settled=126MB
end_cpu=0.0% end_state=sleeping

background_children=0 persistent_network_sockets=0 sleep_prevention_assertions=0
codex_cost_cache_files=501 incomplete_scans=0

The status menu retained the explicit manual Refresh action. Automatic work was observed on the natural 30-minute boundary and the process returned to an idle sleeping state afterward; this is not a single 0% CPU snapshot.

Measurement scope: this was the intended minimal local configuration, with nonessential Agent Sessions, status checks, storage footprints, and OpenAI Web disabled. Therefore the figures characterize that real configuration and are not presented as an isolated A/B attribution for every PR code path. The installed build contains the policy introduced at 403cce7 plus later local scan optimizations; the current PR head remains 8906608 with the maintainer integration and test fixes.

@clawsweeper re-review

🤖 Generated with OpenAI Codex

@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 2, 2026
@steipete
steipete merged commit aeab80e into steipete:main Aug 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a global low-power preset or clarify OpenAI web battery saver scope

2 participants