Add Muse Code subscription usage windows - #3435
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The Muse provider integration is self-contained, covered by focused tests, and the only feedback is a minor improvement to diagnostic detail.
Pull request overview
Adds first-class Muse Code support focused on subscription usage visualization (rolling 5-hour + weekly windows) by minting quota data from Meta’s /muse-code/key endpoint using the Muse CLI’s device-code (dca:) token, and updates project docs/site copy to reflect the new provider count.
Changes:
- Added Muse provider plumbing (descriptor, credentials reader, OAuth fetch strategy, usage fetcher + snapshot mapping).
- Added focused Swift Testing coverage for Muse mint parsing/credential handling and updated architecture fingerprints.
- Updated docs/site/changelog to include Muse and bump “69 → 70 providers”.
File summaries
| File | Description |
|---|---|
| Tests/CodexBarTests/ProviderArchitectureGatekeeperTests.swift | Updates expected provider/branding fingerprints for the new provider set. |
| Tests/CodexBarTests/MuseUsageFetcherTests.swift | Adds parsing + transport + credential-safety tests for Muse subscription minting. |
| Sources/CodexBarCore/Providers/Providers.swift | Registers new UsageProvider.muse case. |
| Sources/CodexBarCore/Providers/ProviderManifest.swift | Adds Muse descriptor to the core manifest. |
| Sources/CodexBarCore/Providers/ProviderInstanceIDAliases.generated.swift | Adds .muse instance ID alias. |
| Sources/CodexBarCore/Providers/Muse/MuseUsageFetcher.swift | Implements mint request/validation + response parsing into a usage snapshot. |
| Sources/CodexBarCore/Providers/Muse/MuseProviderDescriptor.swift | Defines Muse metadata/branding and OAuth-only fetch pipeline. |
| Sources/CodexBarCore/Providers/Muse/MuseCredentials.swift | Reads Muse login state/token from auth.json + Keychain (no-UI query). |
| Sources/CodexBar/Resources/ProviderIcon-muse.svg | Adds Muse provider icon resource. |
| Sources/CodexBar/Providers/Shared/ProviderImplementationManifest.swift | Registers Muse provider implementation in the app layer. |
| Sources/CodexBar/Providers/Muse/MuseProviderImplementation.swift | Adds app-layer availability/presentation wiring for Muse. |
| README.md | Adds Muse to provider list and updates “70 providers” marketing copy. |
| docs/social.html | Updates landing-page provider count to 70. |
| docs/site-locales.mjs | Updates localized provider-count strings across supported locales. |
| docs/providers.md | Updates provider count and adds Muse fetch-strategy row. |
| docs/provider-ids.md | Adds muse to the documented provider ID list. |
| docs/muse.md | New provider doc describing auth, data shown, and privacy notes. |
| docs/llms.txt | Updates provider count in LLM-readable summary. |
| docs/index.html | Updates meta/og copy and on-page provider count to 70. |
| CHANGELOG.md | Adds unreleased entry for Muse subscription windows. |
Review details
- Files reviewed: 19/20 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 12:11 PM ET / 16:11 UTC. ClawSweeper reviewWhat this changesAdds Muse Code subscription usage through the CLI login, with five-hour and weekly windows, provider registration, documentation, and regression tests. Merge readiness✅ Ready for maintainer review This remains a useful, distinct subscription-quota integration absent from current main. The earlier findings are addressed, the supplied live CLI proof covers the central behavior, and no remaining blocking defect was identified. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s provider pipeline reads account credentials and fetches usage for both the menu-bar app and CLI. The Muse integration converts Meta’s subscription response into the existing usage-window and provider-identity displays. flowchart LR
A[Muse CLI login] --> B[Auth file or prompt-free Keychain read]
B --> C[Device token validation]
C --> D[Meta subscription endpoint]
D --> E[Subscription and window parsing]
E --> F[Usage windows and Muse identity]
F --> G[Menu bar and CLI]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep subscription quotas in the existing provider pipeline, preserving Muse-only identity and leaving dashboard spending and local token history as separate capabilities. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this adds a provider capability, and the supplied live CLI output demonstrates the requested subscription windows. Is this the best way to solve the issue? Yes. A provider-local OAuth strategy using the shared credential and HTTP helpers is a narrow fit for the existing architecture; the related spending and token-history integrations do not supply these quotas. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 170a4d41c6d6. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Fixes the three actionable findings on PR steipete#3435: - Guard the window-duration conversion. `window_duration_mins: 1e30` decoded as a Double and then trapped in `Int(minutes.rounded())`, turning malformed provider data into a process-level crash. The decoder now uses `Int(exactly:)` and throws a decoding error, which the surrounding handler maps to `MuseUsageError.parseFailed`. - Register a provider-owned credential adapter so login detection is reported. Without it `codexbar diagnose` fell back to an empty adapter and printed `auth.configured: false` with no modes whenever a fetch failed, even with a valid Muse login. The adapter is OAuth-only and prompt-free: no API-key override, and detection reuses `MuseCredentials.hasLogin`. - Document the auth file's real credential precedence. An inline `providers.meta.access_token` selects the account queried and takes precedence over Keychain, so the file is not only a login marker. Also drops a stray blank line before the `UsageProvider` closing brace that SwiftFormat flagged. Verification: `swift test --filter MuseUsageFetcherTests` (12 passed) and `make check` (0 violations, 2128 files).
|
@clawsweeper re-review Published fixes at 0b131e7 address all three findings: checked Int conversion rejects oversized duration values; an OAuth-only credential adapter reports prompt-free login diagnostics; auth documentation now states inline-token precedence over Keychain. Also fixed the SwiftFormat trailing blank line. Verification: make check passed; all 12 Muse tests and ProviderArchitectureGatekeeperTests passed. The full make test run passed 78 groups before UsageStoreCachedTokenHydrationTests timed out. All remaining selections were then run successfully (1,020 of 1,021 selections passed overall). The identical isolated hydration-suite command also timed out after 180 seconds on clean PR base 4d27bb1, with Keychain access suppressed; this is not being reported as a fully green make test. Please reassess the duration crash, login diagnostics, and documentation findings against the new published head. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Fixed the additional reset-timestamp finding in c080982. Both windows now omit reset timestamps beyond Date.distantFuture while preserving valid usage percentages. A parser → UsageSnapshot → countdown regression covers window and weekly independently: both cases failed before the fix and pass after it; the unaffected window retains its countdown. The requested focused Muse/diagnose/diagnostic-export/architecture suites passed, as did make check. The full final-tree make test is running again; the previously documented hydration-suite timeout also reproduced on the exact PR base. Release bundle will be rebuilt and installed from this final head. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Final verification for c080982: make check passed; the focused Muse/diagnose/diagnostic-export/architecture tests passed, including both new parser-to-countdown cases. The full make test again passed 78 groups and then hit the previously baseline-reproduced UsageStoreCachedTokenHydrationTests timeout. All 84 remaining non-hydration selections were subsequently run successfully. Full make test is not claimed green. Release packaging succeeded, including strict ad-hoc code-signature verification, bundled CLI/resource probes with the source checkout inaccessible, and a six-second app launch smoke. Installed the final release build in /Applications/CodexBar.app; installed app and CLI SHA-256 hashes match the packaged build and the installed CLI reports 0.56.6. Thanks for the re-review confirming all four findings addressed and no remaining blockers. |
c080982 to
7fb3d4c
Compare
Fixes the three actionable findings on PR steipete#3435: - Guard the window-duration conversion. `window_duration_mins: 1e30` decoded as a Double and then trapped in `Int(minutes.rounded())`, turning malformed provider data into a process-level crash. The decoder now uses `Int(exactly:)` and throws a decoding error, which the surrounding handler maps to `MuseUsageError.parseFailed`. - Register a provider-owned credential adapter so login detection is reported. Without it `codexbar diagnose` fell back to an empty adapter and printed `auth.configured: false` with no modes whenever a fetch failed, even with a valid Muse login. The adapter is OAuth-only and prompt-free: no API-key override, and detection reuses `MuseCredentials.hasLogin`. - Document the auth file's real credential precedence. An inline `providers.meta.access_token` selects the account queried and takes precedence over Keychain, so the file is not only a login marker. Also drops a stray blank line before the `UsageProvider` closing brace that SwiftFormat flagged. Verification: `swift test --filter MuseUsageFetcherTests` (12 passed) and `make check` (0 violations, 2128 files).
Show the Muse CLI 5-hour and weekly subscription windows from POST /muse-code/key using the Keychain device-code login. Dashboard LLM_ keys and minted LLM| inference keys cannot read this quota. Refs steipete#3409.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fixes the three actionable findings on PR steipete#3435: - Guard the window-duration conversion. `window_duration_mins: 1e30` decoded as a Double and then trapped in `Int(minutes.rounded())`, turning malformed provider data into a process-level crash. The decoder now uses `Int(exactly:)` and throws a decoding error, which the surrounding handler maps to `MuseUsageError.parseFailed`. - Register a provider-owned credential adapter so login detection is reported. Without it `codexbar diagnose` fell back to an empty adapter and printed `auth.configured: false` with no modes whenever a fetch failed, even with a valid Muse login. The adapter is OAuth-only and prompt-free: no API-key override, and detection reuses `MuseCredentials.hasLogin`. - Document the auth file's real credential precedence. An inline `providers.meta.access_token` selects the account queried and takes precedence over Keychain, so the file is not only a login marker. Also drops a stray blank line before the `UsageProvider` closing brace that SwiftFormat flagged. Verification: `swift test --filter MuseUsageFetcherTests` (12 passed) and `make check` (0 violations, 2128 files).
7fb3d4c to
47ab8a0
Compare
Summary
Adds Muse Code as provider #70 with subscription visualization (the 5-hour and weekly windows Meta added for Everyday / High / Power Usage). Existing Muse PRs do not cover this:
Closes the gap called out on #3409 and #3340.
How it works
muse loginstores a device-codedca:token in Keychain (ai.meta.dev.credentials/meta). CodexBar reads it withKeychainNoUIQuery(no prompt) andPOSTshttps://api.meta.ai/muse-code/key. The mint payload includesis_subs_active,subs_tier_name, andsubs_usage.{window,weekly}(used_percent,window_duration_mins,resets_at).Dashboard
LLM_keys and Muse-mintedLLM|inference keys 401 on that mint endpoint and are not used.Live proof (this desk)
Card last-four is not displayed.
Tests
swift test --filter 'MuseUsageFetcherTests|ProviderArchitectureGatekeeperTests'— 51 passed.