Skip to content

fix(qoder): show the Teams organization balance - #5140

Open
gushan1wood wants to merge 33 commits into
steipete:mainfrom
gushan1wood:fix/qoder-teams-org-balance
Open

gushan1wood wants to merge 33 commits into
steipete:mainfrom
gushan1wood:fix/qoder-teams-org-balance

Conversation

@gushan1wood

Copy link
Copy Markdown

Summary

A focused, captured-shape replacement for the closed #5107.

  • When the merged member quota is empty, request Qoder's supplemental /sash/api/v2/me/usage with the existing session.
  • Read only orgResourcePackage for the captured Teams userType, and expose it as the secondary Balance window.
  • Keep the existing Credits / Balance labels. Do not add personal add-on, extra-window, dedicated-package, or new label handling.
  • Use the supplemental refreshAt / expiresAt only for the primary plan reset; do not turn it into a subscription renewal.
  • Mark a zero-capacity plan exhausted. A positive remaining balance wins over stale used/capacity counters; a missing remaining counter falls back to isQuotaExceeded.
  • Derive the balance detail from cap - remaining so the detail and percentage agree; omit the numeric detail when isQuotaExceeded is the only exhaustion evidence.
  • Localize the balance row's credits suffix using the existing catalog string.
  • Nonempty member summaries keep their existing single-request behavior. Personal accounts keep their existing windows, labels, icon policy, and renewal behavior.

Related to #5103. The issue stays open for the remaining broader coverage.

Tests

  • swift test --filter 'Qoder' — 32 app/settings/cutover tests in 9 suites plus 9 plugin tests in 2 suites passed.
  • make check with the documented Python 3.14 — exit 0; SwiftLint 0 violations in 3247 files.
  • oxfmt, oxlint, swiftformat --lint, node Scripts/check-app-locales.mjs, and git diff --check passed.

Live proof (redacted)

Captured with the focused branch build, using a manual qoder.com cookie.

  • Member endpoint (/api/v2/me/usages/big_model_credits): HTTP 200; total_quota used/limit/remaining are all 0; the member reset is present.
  • Supplemental endpoint (/sash/api/v2/me/usage): HTTP 200; displayMode: "qoder", userType: "teams", userQuota.total: 0; orgResourcePackage.available: true with non-zero cap/used/remaining; no addOnQuota; refreshAt present; isQuotaExceeded: false.
  • Shipped CLI (CodexBar.app/Contents/Helpers/CodexBarCLI usage --provider qoder, manual source):
    • source: "manual / qoder.com"
    • rateWindowLabels: primary Credits, secondary Balance
    • primary: usedPercent: 100, detail present, plan reset present
    • secondary: positive remaining, detail present, no reset
    • subscriptionRenewsAt: absent
    • no extra windows

Base-fail/head-pass:

  • Before this fix, the member-only response exposed 0 / 0 and no organization window.
  • The focused CLI now exposes the Teams organization balance as the secondary Balance window; the percentage and detail agree, and Automatic selects the positive balance.
  • Regression coverage: QoderTeamsOrgBalanceTests (9 tests, both engines), QoderTeamsOrgBalanceBehaviorTests, and the existing Qoder suites.

Verification

Exact head: ac6032d6050c0755f5de0ad5e1002e203218186f

Compatibility

  • Data-coverage fix for the existing Qoder provider; no new provider, credential type, or config migration.
  • No unrelated changelog or test-harness changes in this PR.
  • A docs(changelog) entry will follow after approval, referencing this PR.

When the merged member quota is empty, read the captured Teams organization
resource package from the supplemental usage response and expose it as the
secondary Balance window. Keep the existing Credits and Balance labels, use
the plan refresh for the primary reset, and keep the member summary as the
fallback.

Mark zero-capacity plans exhausted, let a positive remaining balance win over
stale used/capacity counters, and localize the balance detail. A nonempty
member summary keeps its existing single-request behavior.

Related to steipete#5103
@clawsweeper

clawsweeper Bot commented Nov 21, 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 Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T23:51:08.792483Z 121461e New commits
ℹ️ 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 21, 2026
@clawsweeper

clawsweeper Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR adds a same-session supplemental lookup to show Qoder Teams organization credits when the member quota is empty.

Example: A Teams account has zero member credits and an organization package with 1,200 used of 5,000 credits.

  • Before: CodexBar shows 0 / 0 credits without the organization balance.
  • After: CodexBar adds a Balance window showing 24% used and 3,800 credits remaining, which Automatic selects.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with supplied shipped-CLI evidence and no actionable defect found; it deliberately implements only part of the broader linked issue.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The exact-head PR body reports a real manual-cookie Teams run through the shipped CLI, with successful member and supplemental responses and the resulting organization Balance window; inspected plugin and presentation tests support the remaining calculation and rendering behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Teams users see zero member credits while their Qoder dashboard shows usable organization credits.
Reason: The owner explicitly requested this narrower repair; nonempty-member enrichment and other package types remain outside its scope, and the PR correctly uses Related rather than closing the broader issue.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a maintainer-confirmed Teams bug within the requested narrower scope, with no concrete blocking defect found.

Priority: P2
Reviewed head: ac6032d6050c0755f5de0ad5e1002e203218186f

Before merge

None.

Findings

None.

Agent review details

How this fits together

The bundled Qoder plugin converts authenticated usage responses into usage snapshots, and the provider descriptor controls how the CLI, menu, and menu bar present those windows.

flowchart TD
  A[Qoder session] --> B[Member usage request]
  B --> C[Qoder plugin]
  C --> D[Supplemental Teams request]
  D --> E[Usage snapshot]
  C --> E
  E --> F[Provider presentation policy]
  F --> G[CLI and menu]
Loading

Technical review

Best possible solution:

Land the bounded Teams repair while retaining the broader coverage request in the linked issue.

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

The captured type-preserving Teams fixtures and current-main source establish the missing organization window; this read-only review ran no tests, builds, or account probes.

Is this the best way to solve the issue?

The optional same-origin lookup and existing descriptor policies fit the maintainer-requested repair without adopting the rejected personal-add-on redesign.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8c0541ec4989.

Provenance checked

  • Qoder session candidates, regional routing, and member parsing keeps the original intent (b94c5fd: The plugin cutover preserved origin-bound session candidate iteration and regional manual-cookie binding.)
  • Zero-capacity member exhaustion changes intended behavior with a stated reason (5c8c0c5: The earlier repair accepted valid zero quotas and defaulted their usage to exhausted while allowing a supplied percentage; this PR explicitly makes zero capacity exhausted for the captured Teams response.)
  • Descriptor-owned usage presentation keeps the original intent (refactor: move usage presentation policy into provider descriptors #2688: Provider-specific presentation belongs beside provider metadata, with shared consumers using descriptor policy.)
  • Localized provider detail rendering keeps the original intent (fix(i18n): localize provider usage details in Simplified Chinese #3084: Snapshots retain canonical semantic text while user-facing localization happens at the presentation boundary.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 94efcfd adds Sources/CodexBarCore/Resources/Plugins/qoder.js:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 94efcfdf4a4b; files: Sources/CodexBarCore/Resources/Plugins/qoder.js)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Change distribution Production +143/-31; tests +507/-1; documentation +13/-1 Most added lines are endpoint fixtures and focused regression coverage; production changes remain in existing plugin and presentation owners.

Root-cause cluster

Relationship: partial_overlap
Canonical: #5103
Summary: This PR implements the captured empty-member Teams case within the broader accepted Qoder coverage issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: The fix restores visibility of usable organization credits for a bounded Teams-account scenario.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The fix restores visibility of usable organization credits for a bounded Teams-account scenario.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

Reviewed November 21, 2026, 12:05 AM ET / 05:05 UTC.

sfxsalem and others added 16 commits November 20, 2026 21:15
Sort switcher buttons without changing active highlighting or stacked-card order, with a regression against the rendered buttons.

Co-authored-by: Salem Sfaxi <42436939+sfxsalem@users.noreply.github.com>
Share Claude account presentation with Overview, preserve the ambient Fleet fallback, and refresh hosted charts when account ownership changes.

Co-authored-by: Craig Davison <5341072+davisonio@users.noreply.github.com>
Keep one combined This Mac cost section across segmented, stacked, and compact layouts, without copying it into account cards or moving it below Plan Usage.

Co-authored-by: michael0903 <83710802+michael0903@users.noreply.github.com>
Limit displayed grant details to the first 24 rows so larger responses retain their reported balance and spend.

Co-authored-by: Yuxin Qiao <104957188+Yuxin-Qiao@users.noreply.github.com>
Decode saved Codex file details once, preserve completed-scan coverage, and keep provider locks in application support. Add localized `dashboard --no-cost` and honor explicit `/usage` all-account requests while preserving default collection and authentication.

Co-authored-by: Daniel JB Clark <djbclark@gmail.com>
Use the official MiMo Token Plan API through the bundled plugin and expose Grok's existing prepaid balance in the menu bar. Keep quota, cash balance, and account sources separate.
Expose the already parsed available balance in provider cost snapshots without adding requests or authentication sources.

Co-authored-by: Fatih C. Akyon <34196005+fcakyon@users.noreply.github.com>
Read the identified operator's fixed-origin key endpoint, preserve reservation-aware and zero-dollar limits, and register the provider across the app, CLI, catalogs, and docs.

Co-authored-by: Joseph Perla <claude@jperla.com>
Read verified Standard and Select billing-period allowances even when the legacy status is not_applicable, keeping their exact credit counts and dates separate from optional workspace credits. Localize the new display and preserve bounded, cancellable requests.

Co-authored-by: Alex Palei <apalei@gmail.com>
Accept enterprise-paid workspace output without fabricating a balance or quota, and preserve any independently reported Free or subscription usage.

Co-authored-by: Greg Meyer <greg.meyer@ofbasis.com>
Price native Ultrafast usage at published, date-aware rates and preserve its tier through parsing, pricing, recovery and cached history.
Project retained Codex cost reports to the requested history period without discarding the wider cached history.

Co-authored-by: Yuxin Qiao <104957188+Yuxin-Qiao@users.noreply.github.com>
Read Tokscale JSON caches for Cursor local spend fallback while preserving snapshot deduplication and Manual credential boundaries.

Co-authored-by: Vincent Peng <mail@vincentpeng.me>
Give the cost history model stack full width so its scrollbar aligns with the menu edge.

Co-authored-by: Soohan Park <725psh@gmail.com>
Show point labels, values and units when hovering plugin detail-chart bars, reusing the shared bar selection.

Co-authored-by: tangwz <tangwz.com@gmail.com>
davisonio and others added 16 commits November 21, 2026 01:15
Restore the README introduction to the complete provider list and keep the generator accurate.

Co-authored-by: Craig Davison <5341072+davisonio@users.noreply.github.com>
Point provider-status instructions to General, Refreshing.

Co-authored-by: Nuno Hespanhol <nuno.hespanhol@gmail.com>
Add a pinned compact state to the existing Linux Quick View window, with expand and pin controls and accessibility text.

Co-authored-by: WizLiang <1749460483@qq.com>
Update Commander 0.3.1, SweetCookieKit 0.6.0, swift-crypto 5.1.2, swift-log 1.17.2 and swift-asn1 1.7.4, setup-node 7.1.0 and the release Sparkle signer 2.10.1. Keep browser imports gated, add Chrome Dev to the shared browser order, and keep the app and widget pins synchronized. Map Chrome Dev for Cursor interactive login.
Keep successful balance-only results as current-scope unavailable publications, so DeepSeek and xAI no longer trigger a second provider fetch when Usage & Spend fills missing data, and repeated unavailable results no longer advance the dashboard recovery counter. Missing publications, changed credentials or account scope, failed refreshes, and confirmed-empty spend keep their existing behavior. Refs steipete#5057.
Pass retry and deadline callbacks explicitly instead of binding closures into TaskLocal values, which crashed optimized Linux builds in plugin HTTP requests. Add an optimized Linux usage/serve smoke regression covering Hugging Face, OpenRouter, and z.ai. Fixes steipete#5154, steipete#5190, steipete#5210.

Co-authored-by: Remy Huang <me@remya.top>
Constrain the pinned capsule geometry and avoid X11 edge expansion while dragging, restoring expanded resize limits afterwards. Cover the size contract in QML tests.

Co-authored-by: WizLiang <1749460483@qq.com>
Re-publish the compact X11 shape after geometry and desktop updates without moving the window. Adopts steipete#5226 with a QML recovery regression.

Co-authored-by: WizLiang <1749460483@qq.com>
Render one centered tray track when a provider reports one quota window, while keeping a real second window at 0% visible. Share the existing renderer with a pixel regression.

Co-authored-by: WizLiang <1749460483@qq.com>
Let manual cookies and the documented PERPLEXITY_COOKIE / PERPLEXITY_SESSION_TOKEN sessions pass the Linux CLI browser-support gate while keeping Off authoritative. Add Linux gate coverage and CLI documentation.

Co-authored-by: Fguarien <503361+Fguarien@users.noreply.github.com>
Merge current main with the captured-shape Teams repair, keep credit localization in the provider, and cover timeout and cancellation fallback. Preserve the existing zero-capacity member response unless a Teams balance is accepted.

Co-authored-by: gushan1wood <8131302+gushan1wood@users.noreply.github.com>

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

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.