Skip to content

feat(usage): show Muse Code subscription quota in the status bar - #26938

Closed
shadownrx wants to merge 1 commit into
stablyai:mainfrom
shadownrx:feat/muse-usage-status-bar
Closed

shadownrx wants to merge 1 commit into
stablyai:mainfrom
shadownrx:feat/muse-usage-status-bar

Conversation

@shadownrx

@shadownrx shadownrx commented Oct 9, 2026 •

Copy link
Copy Markdown

ELI5

People who code with Muse Code had no way to see, inside Orca, how much of their Muse plan they had used. They only found out when Muse stopped answering. Now the status bar shows a Muse meter next to Claude and Codex, with the 5-hour and the weekly quota and when each one resets.

What Changed

  • Before: the Usage panel and the status bar listed Claude, Codex and the other providers, but not Muse.
  • After: when the muse CLI is installed, a "Muse Usage" meter appears in the status bar and in the Usage panel (5h + weekly bars, reset countdown). You can turn it on or off from the status bar menu and from Settings → Appearance.

How it works:

  • muse-usage-fetcher.ts starts muse serve --no-session-log and talks to it over its JSON-RPC protocol (MSP): initialize → session/start → one tiny turn/start → reads the quota from the usage/changed notification, or calls usage/read if that notification does not arrive.
  • muse-usage-response.ts checks the payload and maps it to the shared ProviderRateLimits shape. Values above 100% (over quota) are clamped to the 0–100 meter.
  • The rate-limit service polls Muse like the other CLI providers (fetching state, stale policy, failure backoff). muse is added to the status bar item enum, the defaults, the one-time "default-on" migration and the CLI-detection gating.

Why

Muse only reports quota after a model reply. There is no read-only quota endpoint, and the local session files hold only token counts, not plan limits. So each real probe spends one minimal request (Reply with exactly: ok, reasoning effort none). To keep this cheap:

  • the last good snapshot is reused for 14 minutes, so automatic polling does not spend a request on every cycle;
  • no probe runs while the meter is hidden (same resolver pattern as Antigravity);
  • the toggle description tells the user that each refresh spends one request.

Reusing muse serve (the CLI's own protocol) instead of reading Muse credentials keeps Orca out of Muse's login lifecycle: the user stays signed in through muse login.

Open question for maintainers: the meter is default-on when muse is detected, like the other CLI meters. Because each refresh spends a small amount of the user's quota, you may prefer default-off. That is a one-line change in ui-slice-hydration-status-bar-items.ts / status-bar-defaults.ts.

Linked Issue

Fixes #23471

Visual Proof

Before (released Orca 1.4.220, Muse missing) and after (this branch, Muse row + status bar meter): screenshots attached below.

Testing

  • I manually tested these changes locally (macOS, pnpm dev, Muse Code 1.4.4): the Usage panel and the status bar show Muse with real values (5h 2%, weekly 2%).
  • Automated tests added/updated:
    • muse-usage-fetcher.test.ts: payload parsing, mapping and clamping, and the full muse serve handshake against a fake child (pushed usage, usage/read fallback, failed turn).
    • The service suites now mock the Muse fetcher, so the tests never start a real muse process or spend a request.
    • The hydration tests cover the new _museStatusBarDefaultAdded migration flag.
  • pnpm typecheck, oxlint, oxfmt --check, and the localization / max-lines / RPC catalog / reliability checks pass. Vitest on src/main/rate-limits, src/main/startup, src/renderer/src/store/slices, src/renderer/src/components/{status-bar,settings} and src/shared: 19,534 passed.
  • Not tested on Linux, Windows or SSH.

AI Disclosure

Written with Claude Code (Claude Opus 5.5) and reviewed by the author.

Review

  • Cross-platform: the process starts through spawnProcess and the CLI path comes from resolveExecutableCommand, with no shell and no hard-coded paths, so Windows .cmd shims are handled by the shared helpers.
  • SSH / remote: like the other CLI quota meters (Antigravity, Kimi, ZCode), the probe runs on the local machine against the local muse login. Quota belongs to the account, not to the host.
  • Agents / integrations: this only adds the muse provider. The other providers do not change, apart from the test mocks.
  • Performance: one short muse serve run at most every 14 minutes, only while the meter is visible. Concurrent refreshes share one in-flight probe. A 90 s timeout and abort signal kill the child process.
  • Security: no credentials are read or stored. The probe prompt is a constant, and --no-session-log keeps the probe out of the user's Muse history.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Cross-platform behavior goes through the shared process helpers (see Review). Older persisted UI state gets the new item once through the existing one-shot default migration.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

Read the 5-hour and weekly quota from `muse serve` (MSP usage/changed,
falling back to usage/read) and surface it as a CLI-gated status bar
meter next to Claude and Codex. Muse only reports quota after a model
reply, so each probe spends one minimal request; the fetcher reuses the
last snapshot for 14 minutes and skips probing while the meter is hidden.

Refs stablyai#23471

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@facundopadilla

Copy link
Copy Markdown

+1

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27a5df5b-2f59-494a-9ce4-c4abe4d08e42

📥 Commits

Reviewing files that changed from the base of the PR and between fbcf0ed and 8f216c8.


📒 Files selected for processing (41)
  • src/main/rate-limits/muse-usage-fetcher.test.ts
  • src/main/rate-limits/muse-usage-fetcher.ts
  • src/main/rate-limits/muse-usage-response.ts
  • src/main/rate-limits/muse-usage-snapshot.ts
  • src/main/rate-limits/rate-limit-service-test-harness.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-antigravity-usage.test.ts
  • src/main/rate-limits/service-cursor-usage.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/main/rate-limits/service-minimax-usage.test.ts
  • src/main/rate-limits/service-opencode-go-credentials.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service-window-activation.test.ts
  • src/main/rate-limits/service-zcode-usage.test.ts
  • src/main/rate-limits/service/service-configuration.ts
  • src/main/rate-limits/service/service-full-cycle-application.ts
  • src/main/rate-limits/service/service-full-cycle-preparation.ts
  • src/main/rate-limits/service/service-polling.ts
  • src/main/rate-limits/service/service-state.ts
  • src/main/rate-limits/service/service-types.ts
  • src/main/startup/main-process-account-services.ts
  • src/renderer/src/components/settings/appearance-status-bar-muse-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/StatusBarVisibilityMenu.tsx
  • src/renderer/src/components/status-bar/status-bar-agent-gating.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/ui-hydration-workspace-preferences.test.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-status-bar-items.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/rate-limit-state-factory.ts
  • src/shared/rate-limit-types.ts
  • src/shared/rpc-contract/client-ui-params.ts
  • src/shared/status-bar-defaults.ts
  • src/shared/ui-chrome-types.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.



📝 Walkthrough

Walkthrough

The change adds Muse subscription-usage parsing and a muse serve --no-session-log probe with caching and fallback usage reads. It connects Muse results to rate-limit service state and adds Muse to the status bar, including visibility controls, translated settings, and default-item hydration. The service enables probing based on the Muse status-bar setting.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 8f216

No identified issue prevents merging the Muse usage meter after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 40 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue [#23471] requires Muse usage tracking and UI display of current usage and limits. muse-usage-fetcher.ts performs the muse serve probe, caches successful snapshots for 14 minutes, and maps us…
Out of Scope Changes check Passed The changed files support the Muse quota objective in [#23471]. Fetcher and parser code implement quota measurement. Service, shared types, UI, settings, localization, detection gating, migration, and…
Title check Passed The title clearly and concisely describes the main change: adding Muse Code subscription quota to the status bar.
Description check Passed The description covers the required sections, user-facing behavior, implementation, rationale, linked issue, visual proof, testing, AI disclosure, compatibility considerations, and checklist. It also …

Full details: Docstring Coverage

Explanation

Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 40 files. (1 skipped: 1 unsupported.)



  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@facmartoni

Copy link
Copy Markdown

We want this!!

@contrera-lean

Copy link
Copy Markdown

We need this.

@nwparker

nwparker commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for putting this together, @shadownrx! We've since shipped Muse quota in the status bar in #38907, which covers the same ground, so I'm closing this one in favor of it. It reads muse usage --json and runs the Muse binary directly, so a background poll never triggers the launcher's update or sign-in. We really appreciate the contribution. It helped shape the feature, and we'd love more PRs from you.

@nwparker nwparker closed this Nov 7, 2026
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.

[Feature]: Integrate Meta Muse quota measurement

5 participants