Skip to content

Add Caffeinate controls to the status bar - #13480

Merged
nwparker merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/caffeinate-status
Aug 10, 2026
Merged

nwparker merged 3 commits into
stablyai:mainfrom
nwparker:nwparker/caffeinate-status

Conversation

@nwparker

@nwparker nwparker commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a compact right-side Caffeinate control using the coffee icon, mode label, and activity dot
  • support On, Auto, and Off modes, with Auto reflecting live agent work
  • extend the existing OS awake service while preserving the legacy setting for mixed-version clients
  • mirror the three modes in Settings > Agents

Readiness review

  • reconcile stale mode/legacy conflicts after downgrade and rollback
  • hide desktop-only Caffeinate controls and search metadata in paired web
  • publish only visible mode/activity transitions, avoiding redundant multi-window IPC and renders
  • completed independent performance, correctness/security, and compatibility/platform audits with no remaining P0/P1/P2 findings

Testing

  • pnpm run typecheck
  • pnpm run check:code-quality:changed
  • pnpm run check:max-lines-ratchet
  • focused Vitest suites for awake mode, service, IPC, settings, paired-web visibility, and navigation metadata
  • Electron E2E for settings persistence, blocker behavior, compact status display, and Auto activity
  • cross-version terminal wire suite against v1.4.176

Visual proof

Before

Before: status bar without Caffeinate

Compact mode menu

After: compact Caffeinate control with On, Auto, and Off menu

Compact Auto active

After: compact Caffeinate Auto active indicator

@nwparker
nwparker requested a review from brennanb2025 as a code owner August 10, 2026 05:01
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change replaces boolean computer-awake configuration with normalized on, auto, and off modes. AgentAwakeService applies these modes and publishes activity status. Main-process IPC, preload APIs, and the web API expose status retrieval and change notifications. Renderer settings and the status bar provide mode selection and activity display. Legacy settings remain supported through normalization and compatible persistence. Unit, component, and end-to-end tests cover mode conversion, service activity, settings updates, and status-bar transitions.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers the summary, visual proof, and testing, but it omits the required AI Review Report, Security Audit, and Notes sections. Add the missing sections, including reviewed risks, security and IPC findings, explicit macOS/Linux/Windows compatibility confirmation, and follow-up notes.
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main user-visible change: adding Caffeinate controls to the status bar.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx (2)

59-82: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Guard the mount effect against paired web client windows.

isPairedWebClientWindow() returns true for these windows, and the component then renders null. The useEffect on Line 59 still runs before that check. It subscribes to window.api.agentAwake.onChanged and calls getStatus() in windows that never display this segment.

Move the check inside the effect to skip the subscription and the status fetch when the window is a paired web client window.

♻️ Proposed fix
   useEffect(() => {
+    if (isPairedWebClientWindow()) {
+      return
+    }
     let mounted = true
     const unsubscribe = window.api.agentAwake.onChanged((status) => {
       if (mounted) {
         setServiceStatus(status)
       }
     })
     void window.api.agentAwake
       .getStatus()
       .then((status) => {
         if (mounted) {
           setServiceStatus(status)
         }
       })
       .catch(() => {})
     return () => {
       mounted = false
       unsubscribe()
     }
   }, [])

84-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Simplify the mode assignment; the ternary always resolves to configuredMode.

When serviceStatus.mode === configuredMode is true, serviceStatus.mode equals configuredMode by definition. When it is false, the expression returns configuredMode directly. Both branches produce the same value, so mode is always configuredMode.

Only active needs to reconcile live status against the configured mode. Simplify mode to remove the misleading ternary.

♻️ Proposed fix
-  const mode = serviceStatus.mode === configuredMode ? serviceStatus.mode : configuredMode
+  const mode = configuredMode
   const active =
     serviceStatus.mode === configuredMode ? serviceStatus.active : configuredMode === 'on'

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16cb6dd0-36dc-4cb8-bee5-88b0c1b579fa

📥 Commits

Reviewing files that changed from the base of the PR and between d9e84d8 and 4196a06.

📒 Files selected for processing (20)
  • src/main/agent-awake-service.test.ts
  • src/main/agent-awake-service.ts
  • src/main/index.ts
  • src/main/ipc/settings.test.ts
  • src/main/ipc/settings.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/feature-wall/KeepAwakeCard.tsx
  • src/renderer/src/components/settings/AgentAwakeSetting.tsx
  • src/renderer/src/components/settings/AgentsPane.test.tsx
  • src/renderer/src/components/settings/agent-awake-copy.ts
  • src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/computer-awake-mode.test.ts
  • src/shared/computer-awake-mode.ts
  • src/shared/types.ts
  • tests/e2e/settings-agent-awake.spec.ts
  • tests/e2e/status-bar-caffeinate.spec.ts

@nwparker
nwparker merged commit 7dce044 into stablyai:main Aug 10, 2026
42 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* feat: add caffeinate status controls

* refactor: compact caffeinate status

* fix: harden caffeinate readiness
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.

1 participant