Skip to content

feat(usage): allow disabling Claude credential-based plan meters - #5269

Draft
leonongoing wants to merge 1 commit into
milind-soni:mainfrom
leonongoing:leon/fix-claude-usage-opt-out-5079
Draft

leonongoing wants to merge 1 commit into
milind-soni:mainfrom
leonongoing:leon/fix-claude-usage-opt-out-5079

Conversation

@leonongoing

@leonongoing leonongoing commented Nov 10, 2026 •

Copy link
Copy Markdown

What changed

Add OMB_CLAUDE_PLAN_USAGE=0 to disable OpenMausBot's Claude subscription-meter credential reads and OAuth usage requests. It works server-wide or in one Claude instance's environment; an instance cannot override a server-wide opt-out. The report keeps an unavailable Claude row with an explicit disabled reason. Defaults stay enabled.

The shared loader checks the policy before credential access and HTTP, the file/keychain reader also honors it, and the cache key includes the server policy so an old enabled meter cannot bypass the opt-out. Existing account cache identity and non-Claude providers are preserved. Document setup and restoration in the self-hosting guide.

Why

Fixes #5079's request for an opt-out. The panel, internal engine-limit tool and limit-reset polling all share the protected loader. CLI refusal-based limit holds remain active. This controls OpenMausBot's usage-meter reads; Claude CLI sign-in and normal turns still use the CLI's own credentials. It does not make a claim about a provider's credential policy.

Related alternative: #5300 makes usage metering an explicit per-instance opt-in. This PR keeps the current enabled default and adds a server-wide/per-instance opt-out; these are different default-policy choices for the same issue.

How it was verified

  • Before the fix: all 8 new opt-out regressions failed.
  • pnpm exec vitest run server/plan-usage-opt-out.test.ts server/plan-usage.test.ts server/limit-resets.test.ts scripts/testing/file-size-ratchet.test.ts --maxWorkers=1: 72 passed across 4 files.
  • Tests cover credential/file/keychain/fetch non-access, server and instance opt-outs, prevention of an instance override, warm cache invalidation and restoration, all Claude instances versus unaffected Codex/Grok/OpenCode reads, and preservation of CLI refusal holds during limit polling.
  • pnpm lint, pnpm i18n:check, pnpm check:contrast, and git diff --check passed. The existing source-size ceiling is unchanged.
  • Intel macOS, Node 24: disposable fake-engine server, real private HTTP report with the configured instance disabled, doctor, create bot, send, settled wait and message readback passed. The fake Claude replied normally. No real provider credentials or live app data were used. Global/file/keychain non-access is verified with spies; the HTTP fixture verifies the per-instance setting and normal fake-CLI turn.
  • Full root pnpm typecheck passed at 057a885f6a8283e31cf6be1cfd7f88f792827cf2. Full pnpm test remains pending; keeping the PR draft.

Screenshots

No renderer or layout changes; the existing unavailable-meter response shape is retained.

Independent full validation

Independent Linux full validation is queued for exact head 057a885f6a8283e31cf6be1cfd7f88f792827cf2 in the frozen-source batch. It runs complete typecheck and unfiltered pnpm test with the project’s standard CI retry policy, preserving full results and retries. No full-suite pass is claimed yet; the local-Mac checkbox is unchanged.

Checklist

  • pnpm typecheck and pnpm test pass locally
  • Server behavior changes come with tests
  • No dist-server/ edits
  • No new platform-specific execution or shell command construction
  • No secrets in logs, responses, events, or argv

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

@leonongoing is attempting to deploy a commit to the SupaMaus Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to stop reading the Claude Code OAuth token for plan-usage meters (Anthropic credential policy)

1 participant