Skip to content

fix(accounts): sort Codex rows by plan remaining time - #3

Open
HuiCheng wants to merge 4 commits into
cursor/v1.12.12-base-db8efrom
cursor/fix-accounts-remaining-sort-db8e
Open

HuiCheng wants to merge 4 commits into
cursor/v1.12.12-base-db8efrom
cursor/fix-accounts-remaining-sort-db8e

Conversation

@HuiCheng

@HuiCheng HuiCheng commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Summary

The Codex accounts list shows paid plan remaining days but never sorts by them. sort=default is risk then filename. This PR adds sort=remaining and orders rows by the same subscriptionUntilMs the list already uses.

The branch starts at e19d8267 (upstream v1.12.12). HuiCheng main has diverged from that commit, and this environment cannot open a PR into seakee/CPA-Manager-Plus. The review base is cursor/v1.12.12-base-db8e so the diff stays the fix commits.

Scope

  • Frontend panel
  • Manager Server
  • CPA panel mode
  • Full Docker mode
  • Native packages / release
  • Docs / Wiki
  • CI / build / tooling

Changes

  • buildAccountRows stores subscriptionUntilMs from buildAccountSubscriptionPresentation.
  • sortAccountRows honors sort=remaining with unknown or free plans last.
  • The accounts sort dropdown exposes that key. Default sort is unchanged.

User Impact

On the accounts page, choose 套餐剩余时间 / Plan remaining. Ascending puts the soonest paid Codex expiry first.

Compatibility / Runtime Notes

  • CPA panel mode: same frontend sort. No API change.
  • Manager Server mode: same frontend sort. No API change.
  • Full Docker / native packages: same after the panel rebuild.

Data / Security Notes

N/A. Sort uses existing local quota and token subscription fields.

Risk / Rollback

Risk level: Low

Rollback notes: revert the commits. Other sort keys are unchanged.

Verification

  • Type check
  • Lint (changed files)
  • Tests
  • Build
  • Manual UI check (demo accounts in Chrome)
  • Docs/link check
  • Not applicable, docs-only

Commands / evidence:

# failing before the fix
npm --workspace apps/web run test -- src/features/accounts/model/accountRows.test.ts -t "sorts paid Codex rows by subscription remaining time"
AssertionError: expected [ 'free.json', 'later.json', 'sooner.json', 'unknown.json' ]
to equal [ 'sooner.json', 'later.json', 'free.json', 'unknown.json' ]

# passing after the fix
npm run type-check
npm --workspace apps/web run test -- src/features/accounts/model/accountRows.test.ts src/features/accounts/model/accountSubscriptionPresentation.test.ts src/features/accounts/model/accountsWorkspaceUrlState.test.ts src/features/accounts/AccountsPage.test.tsx src/features/demo/demoInspect.test.ts -t "remaining|sorts paid Codex|sorts the name|sorts rows by priority|sorts account cards|sorts Codex account|sorts demo Codex"
# 15 passed

# demo fixture remaining order (asc)
codex-pro-20x-01.json   2 days
codex-email-user.json   5 days
codex-fallback-02.json  12 days
codex-team-01.json      23 days

# demo UI at /#/demo/accounts?provider=codex&sort=default
# paid remaining days in list order: 2, 12, 5, 23
# after choosing Plan remaining, URL becomes sort=remaining&direction=asc
# paid remaining days in list order: 2, 5, 12, 23

Screenshots / Recordings

Default sort on the Codex demo list. Remaining days are 2, then 12, then 5.

Default sort does not order remaining days

After Plan remaining. Paid rows are 2 days, 5 days, 12 days, 23 days.

Plan remaining sort orders soonest expiry first

Docs

  • README / README_CN updated for user-visible capabilities
  • Matching docs manual and navigation updated
  • Demo fixtures, screenshots, and deep links reviewed
  • Release notes needed
  • Not needed — explanation included below

Docs decision: existing sort control. One new dropdown label. No setup or API docs.

Related

N/A

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Default account sort stays risk then filename. Paid Codex rows with
different subscriptionActiveUntil values must order by that expiry when
sort=remaining.
Wire sort=remaining to subscriptionUntilMs from the same presentation
rules the list already uses for paid Codex remaining days. Default sort
stays risk then filename.
Lock the comparator against the demo fixture remaining-day values so
sort=remaining stays ordered on the same accounts the panel shows.
Keep the sort field on the same number-or-null contract as createdAtMs.
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.

1 participant