Skip to content

feat(accounts): add account priorities - #545

Closed
cani1989 wants to merge 21 commits into
Soju06:mainfrom
cani1989:codex/issue-540-account-priority
Closed

cani1989 wants to merge 21 commits into
Soju06:mainfrom
cani1989:codex/issue-540-account-priority

Conversation

@cani1989

@cani1989 cani1989 commented May 4, 2026 •

Copy link
Copy Markdown

fixes #540

Summary

  • add account priority levels (gold, silver, bronze) end-to-end across API, DB, proxy selection, and dashboard/account views
  • keep priorities behind a settings toggle so the feature can be enabled or disabled without changing account data
  • add a per-account priority editor in the accounts page and priority-aware sorting in the dashboard/accounts list

Why

Priority-aware selection makes it possible to prefer certain accounts before falling back to usage/reset-based ordering. The settings toggle keeps the new behavior opt-in, while still letting admins assign and change priorities independently of routing strategy.

Validation

  • npm test -- --run src/features/accounts/components/accounts-page.test.tsx
  • npm test -- --run src/features/dashboard/components/account-cards.test.tsx src/features/dashboard/components/account-card.test.tsx
  • backend integration/unit coverage added for account priority updates, dashboard ordering, settings persistence, and load-balancer selection

@cani1989 cani1989 changed the title Add account priorities feat(accounts): add account priorities May 4, 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: 59cd4febe4

ℹ️ 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 app/modules/accounts/repository.py Resolved
@cani1989 cani1989 mentioned this pull request May 4, 2026
@Komzpa

Komzpa commented May 6, 2026 •

Copy link
Copy Markdown
Collaborator

I checked this against a smaller manual account-routing change for the same operator need: #553. There is real overlap in the core routing feature:

  • this PR adds per-account gold / silver / bronze priority
  • feat(accounts): add manual routing policy #553 uses explicit routing intent: burn_first / normal / preserve
  • both approaches select from the manually preferred eligible pool before the normal usage/reset/capacity strategy

The main difference is scope. This PR also includes reset-display/account-list work, quota display appearance settings, Docker/dev-deploy changes, and dashboard sorting. Those may be useful, but they make the routing behavior harder to review as one unit.

For mergeability, I think the account-routing part should be either split into a focused PR, or kept here with a clear OpenSpec delta for the selection contract:

  • manual priority applies after hard eligibility gates
  • it does not bypass model plan or additional-quota filtering
  • preserved/low-priority accounts are fallback-only while other eligible accounts exist

One naming note: UI labels like Burn first, Normal, Preserve may be clearer than medal labels, because “gold” can read as either “best account” or “most valuable account to protect”.

@Komzpa

Komzpa commented May 16, 2026

Copy link
Copy Markdown
Collaborator

@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: e2b67dd6f6

ℹ️ 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 scripts/deploy-dev.ps1
$escapedCommand = $Command.Replace('"', '\"')
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
$startInfo.FileName = "ssh"
$startInfo.Arguments = "$DevHost `"$escapedCommand`""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prevent shell expansion in SSH command wrapper

Invoke-Ssh wraps remote commands in double quotes without escaping $/`/\, so any command string containing shell metacharacters is reinterpreted by the local or remote shell. In this commit, $targetBranch is interpolated into the rebuild command, and valid branch names can include characters like $; that can deploy the wrong branch (e.g. $USER expansion) or execute unintended shell fragments. Use a safer transport (argument array/heredoc/single-quoted remote command with explicit escaping) before passing user- or git-derived values.

Useful? React with 👍 / 👎.

@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label May 16, 2026
@Komzpa

Komzpa commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Closing this older broad priority PR in favor of the narrower #553 review path.

#553 now carries the manual routing-policy version of this behavior and explicitly fixes #428/#540 with a smaller, current branch. This PR is conflict/dirty and still has current-head Codex findings, so keeping both open makes the queue ambiguous without preserving a separate merge unit.

If any dashboard sorting/reset-display behavior from this branch is still wanted after #553 lands, it should come back as a separate scoped follow-up.

@Komzpa Komzpa closed this May 17, 2026
@cani1989
cani1989 deleted the codex/issue-540-account-priority branch May 27, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 codex: needs work [@codex review] raised an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Account priority

2 participants