feat(account selection) Add relative availability routing strategy#507
feat(account selection) Add relative availability routing strategy#507egusev wants to merge 7 commits into
Conversation
|
amazing |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31aeb0f578
ℹ️ 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".
|
|
||
|
|
||
| def _relative_availability_label(state: AccountState) -> str: | ||
| return state.email or state.account_id |
There was a problem hiding this comment.
Stop emitting account emails in routing logs
Using state.email as the primary routing label causes INFO diagnostics to log raw email addresses for candidate scoring, top-k selection, and winner selection. In deployments that ship logs off-host, this introduces unnecessary PII exposure compared with using stable internal account IDs (or a redacted/hash form), and the change affects every relative-availability routing decision.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0cbd1905e
ℹ️ 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".
| "Selected account_id=%s strategy=%s sticky=%s model=%s", | ||
| selected_snapshot.id, | ||
| "Selected account=%s strategy=%s sticky=%s model=%s", | ||
| selected_snapshot.email or selected_snapshot.id, |
There was a problem hiding this comment.
Avoid logging raw account emails in selection logs
This changed the selection log payload from an internal identifier to selected_snapshot.email when present, so routine INFO logs now emit user email addresses on every account pick. In environments that forward app logs to centralized storage, this creates avoidable PII exposure and also breaks existing account_id-based log correlation. Keep the stable non-PII account ID in this hot-path log (or mask email and gate it behind debug diagnostics).
Useful? React with 👍 / 👎.
| const relativeAvailabilityPowerChanged = | ||
| relativeAvailabilityPowerValid && parsedRelativeAvailabilityPower !== settings.relativeAvailabilityPower; | ||
|
|
||
| const parsedRelativeAvailabilityTopK = Number.parseInt(relativeAvailabilityTopK, 10); |
There was a problem hiding this comment.
Reject non-integer top-k values instead of truncating
Using Number.parseInt here silently truncates decimal input (for example, 1.5 becomes 1), and the subsequent Number.isInteger check then passes, so the UI saves a different value than the user entered. That can unintentionally reduce the candidate pool and change routing behavior without clear feedback. Validate that the raw input is an integer-form value (or use strict numeric parsing) before enabling save.
Useful? React with 👍 / 👎.
# Conflicts: # app/core/balancer/logic.py
# Conflicts: # frontend/src/components/layout/status-bar.tsx
|
Maintainer cleanup: closing this as stale / no longer merge-ready against the current This PR has been open across substantial main-branch churn and is currently carrying at least one stale signal (conflicts/blocked or failing checks, outstanding If the change is still needed, please open a fresh, focused PR rebased on current |
|
Revived on a maintainer-owned branch as #765 because this PR head has maintainerCanModify=false and cannot be updated here. Keeping credit to the original implementation in the replacement PR. |
Add the relative availability account-routing strategy, which scores eligible accounts by remaining secondary-window credits over time to reset. Also persists and exposes dashboard tuning for the strategy, wires the configured power/top-K through sticky fallback selection, keeps routing diagnostics on non-PII account IDs, and adds OpenSpec, migration, backend, and frontend coverage. Revives #507.
Description
Compared with current strategies: