Skip to content

feat(providers): add OMP provider with multi-account aggregation and subprovider selection - #4610

Closed
renan-brasilio wants to merge 9 commits into
steipete:mainfrom
renan-brasilio:feat/omp-provider
Closed

renan-brasilio wants to merge 9 commits into
steipete:mainfrom
renan-brasilio:feat/omp-provider

Conversation

@renan-brasilio

Copy link
Copy Markdown

Summary

Adds OMP (Oh My Prompt) as a first-party provider to CodexBar, enabling combined limit tracking, multi-account capacity aggregation, and subprovider filtering from omp usage --json.

Context & Motivation

OMP centrally manages authenticated OAuth credentials and provider usage quotas for developers working across multiple AI coding engines (Google Antigravity, OpenAI Codex, GitHub Copilot, Anthropic Claude, and xAI Grok). For multi-account setups (such as multiple Google accounts under Antigravity), OMP resolves live quotas directly through provider APIs and calculates aggregate capacity windows.

This provider brings that visibility directly into CodexBar's menu bar, popover cards, and CLI.

Features & Capabilities

  • Real Quota Families: Surfaces individual quota lanes per provider and cadence:
    • Google Antigravity: Gemini 5h, Gemini 7d, Claude & GPT (shared) 5h, Claude & GPT (shared) 7d
    • GitHub Copilot: Chat Requests, Completions
    • OpenAI Codex: 5 hours, 7 days
    • xAI Grok: Weekly Credits
  • Dynamic Multi-Account Aggregation:
    • 5-Hour primary window dynamically computes aggregate usage across all 5-hour accounts.
    • Weekly secondary window computes aggregate usage across all weekly accounts.
    • Reset times dynamically resolve to the nearest active reset deadline across accounts.
  • Subprovider Selection:
    • In Settings: Dedicated picker under Settings → Providers → OMP allows switching between Combined (All Limits), Google Antigravity (agy), OpenAI Codex, Anthropic Claude, GitHub Copilot, xAI Grok, and custom subprovider filters.
    • In CLI: Supports inline overrides via OMP_SUBPROVIDER (e.g. OMP_SUBPROVIDER=agy codexbar usage --provider omp).
  • Detailed Account Breakdowns:
    • Popover detail sections group accounts under their respective providers, showing individual account percentages and reset countdowns.
  • Defensive & Safe Execution:
    • Runs through SubprocessRunner with a 15-second execution timeout and null standard input.
    • Fixed, static CLI argument arrays (["usage", "--json"]) preventing any argument or shell injection.
    • Safe bounds-checked percentage conversions guarding against non-finite values (NaN/±Infinity).
    • Strict string length (120 chars) and section row (24 rows) enforcement.
    • Zero hardcoded credentials, personal identifiers, or telemetry.

Files Changed

  • Sources/CodexBarCore/Providers/Providers.swift: Registered .omp provider and icon style.
  • Sources/CodexBarCore/PathEnvironment.swift: Added resolveOMPBinary(...) locator.
  • Sources/CodexBarCore/Providers/ProviderVersionDetector.swift: Added ompVersion().
  • Sources/CodexBarCore/Providers/OMP/:
    • OMPProviderDescriptor.swift: Provider descriptor, pace configuration, and fetch plan.
    • OMPUsageModels.swift: Strongly-typed decodable models for OMP usage and capacity responses.
    • OMPUsageParser.swift: Usage snapshot parser and quota family aggregators.
    • OMPCLIProbe.swift: Subprocess execution wrapper.
    • OMPProviderConfig.swift & OMPProviderSettings.swift: Config and settings models.
  • Sources/CodexBar/Providers/OMP/:
    • OMPProviderImplementation.swift: UI descriptors, subprovider picker, and settings snapshot.
    • OMPSettingsStore.swift: SettingsStore extensions.
  • Sources/CodexBar/Resources/ProviderIcon-omp.svg & docs/logos/omp.svg: Template SVG icon.
  • docs/omp.md: Provider documentation.
  • Tests/CodexBarTests/OMPProviderTests.swift: Comprehensive unit tests.

Test Coverage & Verification

  • swift test --filter OMPProviderTests — 7/7 passed (descriptor configuration, combined capacity parsing, AGY filtering, Codex filtering, 5 vs 6 accounts visibility gating, settings persistence, template icon loading).
  • swift test --filter ProviderArchitectureGatekeeperTests — 48/48 passed (strict architecture gatekeeper and lexical drift tests).
  • swift test --filter ProviderIconResourcesTests — 11/11 passed (SVG template rendering and caching).
  • Verified with codexbar usage --provider omp and OMP_SUBPROVIDER=<id> across all supported subproviders.

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-18T10:33:38.869607Z c34ba87 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@renan-brasilio renan-brasilio changed the title Feat/omp provider feat(providers): add OMP provider with multi-account aggregation and subprovider selection Oct 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9fd3f1334

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge.

What this changes

Adds an opt-in OMP quota provider with multi-account aggregation, subprovider selection, account details, and CLI support.

Example: OMP reports four Antigravity accounts with 1.4 weekly account-equivalents used and one unused Codex account.

  • Before: Current main has Pi/OMP token history but no OMP quota card.
  • After: The new Combined card reports 28% weekly usage from the capacity totals.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Most earlier defects have source-level repairs, but cadence correctness, product approval, and runtime and upgrade evidence remain unresolved.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: OMP users cannot inspect its combined account quotas and backend limits through CodexBar.
Reason: Existing Pi support supplies token history rather than quota aggregation; the proposed new provider and settings need an owner decision.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this PR open under repository policy; the revision addresses most earlier findings, but two quota-cadence defects remain.

Priority: P2
Reviewed head: ec95b3a2618d476d5d530ec0025163d1e17acb8f
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should CodexBar add a separate OMP quota provider with persisted subprovider settings alongside Pi/OMP token history?
  • Recommendation: Approve the quota integration: Confirm the supported OMP CLI and settings scope, then continue with the focused implementation.
  • Why: The aggregation has distinct potential value, but no recorded maintainer decision approves the new provider, settings, or supported OMP CLI contract.

Before merge

  • Add real behavior proof - The OMP subprocess, aggregation, filtering, and app presentation have fixture tests and an unsupported verification assertion, but no observable runtime result; attach terminal output for Combined and filtered CLI usage plus screenshots of the provider card and settings, redacting account identifiers, keys, IPs, and non-public endpoints. Also demonstrate fresh installation and an upgrade from v0.77.0 with existing settings intact and OMP selections surviving restart. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve Anthropic quota durations in Combined mode (P2) - For an Anthropic limit with window.id = weekly and durationMs = 604800000, this branch still publishes windowMinutes = 300. The snapshot therefore describes a weekly quota as a five-hour window, corrupting its duration for downstream presentation and history consumers. Convert the reported duration instead of assigning 300 to every Anthropic limit.
  • Infer monthly cadence before applying the weekly fallback (P2) - The earlier monthly-label finding is only partly fixed. Select github-copilot with a monthly limit that omits durationMs, as the added Copilot fixture does: this path supplies defaultMinutes = 10080, so the revised descriptor still labels it Weekly. Infer the fallback from the matched monthly window rather than using the weekly default.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Preserve Anthropic quota durations in Combined mode — Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:265-268
  • [P2] Infer monthly cadence before applying the weekly fallback — Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:609-613

Tests

  • Low-value test Tests/CodexBarTests/OMPProviderTests.swift: Replace the direct normalizeAmount helper test with parser-level Copilot assertions in Combined and filtered modes so it catches incorrect wiring as well as arithmetic.
  • Missing end-to-end proof: No observable shipped CLI/UI run or base-failing/head-passing regression evidence covers the remaining cadence cases.
Agent review details

How this fits together

The provider framework invokes the installed OMP CLI, decodes its quota JSON, and publishes usage snapshots to the menu, history, and CodexBar CLI.

flowchart LR
  A[Provider settings] --> B[OMP fetch strategy]
  B --> C[Installed OMP CLI]
  C --> D[Quota JSON parser]
  D --> E[Usage snapshot]
  E --> F[Menu and CLI]
Loading

Technical review

Best possible solution:

If approved, retain the existing provider owners and derive quota durations consistently from upstream windows while preserving existing Pi accounting.

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

Source inspection establishes both cadence errors with supported quota shapes; no target code or tests were run during this read-only review.

Is this the best way to solve the issue?

The existing fetch strategy, subprocess runner, and settings extension mechanism fit the integration; window construction should preserve reported cadence through one consistent conversion.

Full review comments:

  • [P2] Preserve Anthropic quota durations in Combined mode — Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:265-268
    For an Anthropic limit with window.id = weekly and durationMs = 604800000, this branch still publishes windowMinutes = 300. The snapshot therefore describes a weekly quota as a five-hour window, corrupting its duration for downstream presentation and history consumers. Convert the reported duration instead of assigning 300 to every Anthropic limit.
    Confidence: 1
  • [P2] Infer monthly cadence before applying the weekly fallback — Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:609-613
    The earlier monthly-label finding is only partly fixed. Select github-copilot with a monthly limit that omits durationMs, as the added Copilot fixture does: this path supplies defaultMinutes = 10080, so the revised descriptor still labels it Weekly. Infer the fallback from the matched monthly window rather than using the weekly default.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6480977b47f6.

Provenance checked

  • Pi-family session discovery keeps the original intent (Unify pi and OMP agent sessions #2626: Unify Pi and OMP discovery under Pi while preserving dialect-specific storage and protocol behavior; this PR adds explanatory comments without changing that behavior.)
  • Standalone Pi/OMP token history keeps the original intent (Add Pi and OMP local token usage #3246: Expose opt-in local token history with separate accounting and no subscription-quota claim; the new quota integration leaves that path intact.)
  • Provider registry and palette baselines keeps the original intent (Add Munito as a provider #4531: Keep registration, branding baselines, and published provider counts aligned when adding a provider.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Policy and pinned patch: Read the complete root AGENTS.md and pinned introduced diff; no nested AGENTS.md, maintainer-notes directory, or pr-simplify skill exists in the checkout, and repository policy prohibits automatic closure. (AGENTS.md:1, ec95b3a2618d)
  • Existing capability boundary: Main documents Pi/OMP as local token history without subscription quotas; Add Pi and OMP local token usage #3246 establishes that separate accounting boundary. (docs/pi.md:10, 6480977b47f6)
  • Earlier feedback checked: Retrieved the earlier review to recover its three omitted findings and compared the reviewed head with this revision; capacity weighting, absent aggregate windows, Gemini fallback ownership, Anthropic inclusion, count normalization, Copilot percentages, metric slots, and reset selection have source-level repairs, while monthly labeling remains incomplete. (Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:272, ec95b3a2618d)
  • Anthropic duration discarded: The newly added Anthropic branch assigns windowMinutes: 300 to every limit, regardless of its reported cadence. (Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:268, ec95b3a2618d)
  • Monthly fallback remains weekly: Filtered monthly limits without durationMs receive 10080 minutes; the revised descriptor consequently still labels them Weekly. (Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift:613, ec95b3a2618d)
  • Discussion and supplied proof: The current body and contributor discussion contain a CLI-verification assertion but no terminal output, screenshots, recordings, or proof links; the re-review request adds no runtime evidence. (ec95b3a2618d)

Likely related people:

  • Peter Steinberger: Raw commit 8eb867c adds Sources/CodexBarCore/PiFamilySessionScanner.swift:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8eb867c0c5eb; files: Sources/CodexBarCore/PiFamilySessionScanner.swift)
  • Yuxin Qiao: Raw commit 81c8a1c adds Sources/CodexBarCore/Providers/Pi/PiProviderDescriptor.swift:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 81c8a1cbf9bb; files: Sources/CodexBarCore/Providers/Pi/PiProviderDescriptor.swift)

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This optional provider adds useful quota visibility but has reporting defects confined to its new paths.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-18T06:14:36.468Z sha d9fd3f1 :: needs real behavior proof before merge. :: [P2] Aggregate combined usage from capacity totals | [P2] Omit aggregate windows with no contributing quota | [P2] Select the Gemini weekly fallback when shared entries are empty | [P2] Include Anthropic reports in Combined mode | [P2] Normalize count limits before creating percentage windows | [P2] Preserve partial Copilot usage in combined metrics

Reviewed October 18, 2026, 3:11 AM ET / 07:11 UTC (Revision 2).

@renan-brasilio

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 18, 2026
@renan-brasilio

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec95b3a261

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
@renan-brasilio

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c899187d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/OMP/OMPProviderDescriptor.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
… derive xAI cadence, and stabilize section titles
@renan-brasilio

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1a00210167

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift
Comment thread Sources/CodexBarCore/Providers/OMP/OMPUsageParser.swift Outdated
Comment thread Sources/CodexBar/Providers/OMP/OMPSettingsStore.swift
@renan-brasilio

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete

Copy link
Copy Markdown
Owner

Thanks @renan-brasilio for the substantial work here. I'm closing this implementation, for two reasons.

First, new provider fetching in CodexBar goes through bundled JavaScript plugins with minimal Swift glue, and this adds a native CLI fetcher plus a separate 900-line aggregation and presentation layer. Second, that layer sums capacity across providers and changes those totals when UI items are hidden, which would show numbers that don't correspond to any single quota.

The command and response shape also look like Oh My Pi rather than Oh My Prompt. Existing Pi support covers local token history, so live OMP quotas are still a fair request. Upstream documents a bearer-authenticated GET /v1/usage on its auth broker, which could back a small plugin, but it would require users to configure a broker URL and token. If you'd like to pursue that, open an issue with that setup contract and we can agree on it before any code.

@steipete steipete closed this Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants