Skip to content

fix: Preserve same-email proxy subscriptions - #12585

Open
Xanacas wants to merge 4 commits into
pingdotgg:mainfrom
Xanacas:bug/preserve-proxy-quota-accounts
Open

Xanacas wants to merge 4 commits into
pingdotgg:mainfrom
Xanacas:bug/preserve-proxy-quota-accounts

Conversation

@Xanacas

@Xanacas Xanacas commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Personal and company team subscriptions can share an email address. T3 merged their CLIProxy quota snapshots into one account, hiding a subscription in Limits even with a single environment selected.

Keep distinct hub account IDs separate when a provider/email matches multiple subscriptions. Apply the same ambiguity check to /usage-limits and reset-credit routing, including when one account's quota probe fails. Repeated snapshots of the same hub account across environments still merge.

Native logins expose no subscription ID, so an ambiguous native login stays separate instead of being assigned to an arbitrary hub account. This can leave a duplicate native entry until stronger identity is available.

Validation: 33 focused usage-limit tests pass, targeted lint passes, and the shared package typecheck passes. Browser-verified against an isolated server with two synthetic same-email Claude accounts: both quota segments survive environment selection, and their popovers show the corresponding values. No browser errors. Screenshots below compare the original merge logic with the fix using the same fixture. No UI component changes.

Implemented by OpenAI Codex in the Codex harness; reviewed with Claude Fable 5.1 through local Claude Code.

Before:

Before: only one subscription survives the email merge

After:

After: both subscriptions retain their quota windows

Summary by CodeRabbit

  • Bug Fixes
    • Usage limits now keep native and hub subscriptions separate when they share an email address.
    • Credits are routed to the correct subscription when account identities are ambiguous.
    • Hub subscriptions with similar source and account identifiers remain distinct.
    • A failed account check removes only the affected account from limit collection while preserving it in provider usage reports.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 19, 2026
Comment thread packages/shared/src/usageLimits.ts Outdated
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8f9ca4d3-7961-4385-9a88-bb485615c9db

📥 Commits

Reviewing files that changed from the base of the PR and between 1b844da and 3a6c0ca.

📒 Files selected for processing (1)
  • packages/shared/src/usageLimits.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change keeps ambiguous hub accounts separate during limit collection and provider reporting. It encodes source and account identities, prevents ambiguous credit matching, and adds tests for probe failures and colon-collision identifiers.

Changes

Hub Account Separation

Layer / File(s) Summary
Account identity detection and collection
packages/shared/src/usageLimits.ts
The code detects hub driver/email keys that map to multiple hub identities. Ambiguous hub accounts use encoded source-scoped keys, while unambiguous accounts retain shared email keys.
Provider reporting and regression coverage
packages/shared/src/usageLimits.ts, packages/shared/src/usageLimits.test.ts
Provider reporting does not match ambiguous hub credits to native accounts or suppress ambiguous hub rows. Tests cover separate credit balances, probe-failure filtering, and distinct keys for colon-collision identifiers.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: preserving separate proxy subscriptions that share an email address.
Description check ✅ Passed The description explains the problem, solution, affected routing paths, validation, and UI impact. It includes before-and-after screenshots and states that no UI components changed. The template check…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp

macroscopeapp Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — This is a focused, tested fix to usage-limit account aggregation that preserves distinct same-email proxy subscriptions without schema or deployment changes. An unresolved High-severity comment identifies an identity-key collision edge case that remains a separate blocking correctness concern.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant