-
Notifications
You must be signed in to change notification settings - Fork 1
feat: inject codex cli account selection during live rotation #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7d9b3a8
bff0095
761073a
f3a8145
d27d90d
eab19c0
7ca8395
167ff02
3d4a634
7497e08
3b53173
3ca4818
6a613c1
7894130
26d338b
5c629b6
5336b19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,6 +274,11 @@ type SettingsHubAction = | |
| type ExperimentalSettingsAction = | ||
| | { type: "sync" } | ||
| | { type: "backup" } | ||
| | { type: "open-rotation-quota" } | ||
| | { type: "toggle-direct-cli-injection" } | ||
| | { type: "toggle-session-affinity" } | ||
| | { type: "toggle-preemptive-quota" } | ||
| | { type: "toggle-pool-retry" } | ||
| | { type: "toggle-refresh-guardian" } | ||
| | { type: "decrease-refresh-interval" } | ||
| | { type: "increase-refresh-interval" } | ||
|
|
@@ -1071,6 +1076,10 @@ function backendSettingsSnapshot( | |
| config: PluginConfig, | ||
| ): Record<string, unknown> { | ||
| const snapshot: Record<string, unknown> = {}; | ||
| const directInjectionDefault = | ||
| BACKEND_DEFAULTS.codexCliDirectInjection ?? true; | ||
| snapshot.codexCliDirectInjection = | ||
| config.codexCliDirectInjection ?? directInjectionDefault; | ||
| for (const option of BACKEND_TOGGLE_OPTIONS) { | ||
| snapshot[option.key] = | ||
| config[option.key] ?? BACKEND_DEFAULTS[option.key] ?? false; | ||
|
|
@@ -1130,7 +1139,7 @@ function buildBackendSettingsPreview( | |
| const threshold5h = | ||
| config.preemptiveQuotaRemainingPercent5h ?? | ||
| BACKEND_DEFAULTS.preemptiveQuotaRemainingPercent5h ?? | ||
| 5; | ||
| 10; | ||
| const threshold7d = | ||
| config.preemptiveQuotaRemainingPercent7d ?? | ||
| BACKEND_DEFAULTS.preemptiveQuotaRemainingPercent7d ?? | ||
|
|
@@ -1171,6 +1180,9 @@ function buildBackendSettingsPreview( | |
|
|
||
| function buildBackendConfigPatch(config: PluginConfig): Partial<PluginConfig> { | ||
| const patch: Partial<PluginConfig> = {}; | ||
| if (typeof config.codexCliDirectInjection === "boolean") { | ||
| patch.codexCliDirectInjection = config.codexCliDirectInjection; | ||
| } | ||
| for (const option of BACKEND_TOGGLE_OPTIONS) { | ||
| const value = config[option.key]; | ||
| if (typeof value === "boolean") { | ||
|
|
@@ -2452,7 +2464,24 @@ async function promptBackendSettings( | |
| if (!result || result.type === "cancel") return null; | ||
| if (result.type === "save") return draft; | ||
| if (result.type === "reset") { | ||
| draft = cloneBackendPluginConfig(BACKEND_DEFAULTS); | ||
| draft = cloneBackendPluginConfig({ | ||
| ...BACKEND_DEFAULTS, | ||
| codexCliDirectInjection: draft.codexCliDirectInjection, | ||
| proactiveRefreshGuardian: draft.proactiveRefreshGuardian, | ||
| proactiveRefreshIntervalMs: draft.proactiveRefreshIntervalMs, | ||
| sessionAffinity: draft.sessionAffinity, | ||
| retryAllAccountsRateLimited: draft.retryAllAccountsRateLimited, | ||
| preemptiveQuotaEnabled: draft.preemptiveQuotaEnabled, | ||
| preemptiveQuotaRemainingPercent5h: | ||
| draft.preemptiveQuotaRemainingPercent5h ?? | ||
| BACKEND_DEFAULTS.preemptiveQuotaRemainingPercent5h, | ||
| preemptiveQuotaRemainingPercent7d: | ||
| draft.preemptiveQuotaRemainingPercent7d ?? | ||
| BACKEND_DEFAULTS.preemptiveQuotaRemainingPercent7d, | ||
| preemptiveQuotaMaxDeferralMs: | ||
| draft.preemptiveQuotaMaxDeferralMs ?? | ||
| BACKEND_DEFAULTS.preemptiveQuotaMaxDeferralMs, | ||
| }); | ||
|
Comment on lines
+2467
to
+2484
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. backend reset should not preserve visible backend toggles.
proposed fix if (result.type === "reset") {
draft = cloneBackendPluginConfig({
...BACKEND_DEFAULTS,
codexCliDirectInjection: draft.codexCliDirectInjection,
proactiveRefreshGuardian: draft.proactiveRefreshGuardian,
proactiveRefreshIntervalMs: draft.proactiveRefreshIntervalMs,
- sessionAffinity: draft.sessionAffinity,
- retryAllAccountsRateLimited: draft.retryAllAccountsRateLimited,
- preemptiveQuotaEnabled: draft.preemptiveQuotaEnabled,
});
for (const category of BACKEND_CATEGORY_OPTIONS) {
focusByCategory[category.key] =As per coding guidelines, 🤖 Prompt for AI Agents |
||
| for (const category of BACKEND_CATEGORY_OPTIONS) { | ||
| focusByCategory[category.key] = | ||
| getBackendCategoryInitialFocus(category); | ||
|
|
@@ -2540,6 +2569,31 @@ async function promptExperimentalSettings( | |
| value: { type: "backup" }, | ||
| color: "green", | ||
| }, | ||
| { | ||
| label: `${formatDashboardSettingState(draft.codexCliDirectInjection !== false)} ${UI_COPY.settings.experimentalDirectCliInjection}`, | ||
| value: { type: "toggle-direct-cli-injection" }, | ||
| color: "green", | ||
| }, | ||
| { | ||
| label: `${formatDashboardSettingState(draft.sessionAffinity !== false)} ${UI_COPY.settings.experimentalManualSessionLock}`, | ||
| value: { type: "toggle-session-affinity" }, | ||
| color: "yellow", | ||
| }, | ||
| { | ||
| label: `${formatDashboardSettingState(draft.retryAllAccountsRateLimited !== false)} ${UI_COPY.settings.experimentalPoolFallback}`, | ||
| value: { type: "toggle-pool-retry" }, | ||
| color: "green", | ||
| }, | ||
| { | ||
| label: `${formatDashboardSettingState(draft.preemptiveQuotaEnabled !== false)} ${UI_COPY.settings.experimentalQuotaRotation}`, | ||
| value: { type: "toggle-preemptive-quota" }, | ||
| color: "yellow", | ||
| }, | ||
| { | ||
| label: UI_COPY.settings.experimentalRotationQuotaSettings, | ||
| value: { type: "open-rotation-quota" }, | ||
| color: "green", | ||
| }, | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| label: `${formatDashboardSettingState(draft.proactiveRefreshGuardian ?? false)} ${UI_COPY.settings.experimentalRefreshGuard}`, | ||
| value: { type: "toggle-refresh-guardian" }, | ||
|
|
@@ -2581,11 +2635,54 @@ async function promptExperimentalSettings( | |
| theme: ui.theme, | ||
| selectedEmphasis: "minimal", | ||
| onInput: (raw) => | ||
| raw.toLowerCase() === "q" ? { type: "back" } : undefined, | ||
| raw.toLowerCase() === "q" | ||
| ? { type: "back" } | ||
| : raw.toLowerCase() === "o" | ||
| ? { type: "open-rotation-quota" } | ||
| : undefined, | ||
| }, | ||
| ); | ||
| if (!action || action.type === "back") return null; | ||
| if (action.type === "save") return draft; | ||
| if (action.type === "open-rotation-quota") { | ||
| const category = getBackendCategory("rotation-quota"); | ||
| if (!category) continue; | ||
| const categoryResult = await promptBackendCategorySettings( | ||
| draft, | ||
| category, | ||
| "preemptiveQuotaEnabled", | ||
| ); | ||
| draft = categoryResult.draft; | ||
| continue; | ||
| } | ||
| if (action.type === "toggle-direct-cli-injection") { | ||
| draft = { | ||
| ...draft, | ||
| codexCliDirectInjection: !(draft.codexCliDirectInjection !== false), | ||
| }; | ||
| continue; | ||
| } | ||
| if (action.type === "toggle-session-affinity") { | ||
| draft = { | ||
| ...draft, | ||
| sessionAffinity: !(draft.sessionAffinity !== false), | ||
| }; | ||
| continue; | ||
| } | ||
| if (action.type === "toggle-preemptive-quota") { | ||
| draft = { | ||
| ...draft, | ||
| preemptiveQuotaEnabled: !(draft.preemptiveQuotaEnabled !== false), | ||
| }; | ||
| continue; | ||
| } | ||
| if (action.type === "toggle-pool-retry") { | ||
| draft = { | ||
| ...draft, | ||
| retryAllAccountsRateLimited: !(draft.retryAllAccountsRateLimited !== false), | ||
| }; | ||
| continue; | ||
| } | ||
| if (action.type === "toggle-refresh-guardian") { | ||
| draft = { | ||
| ...draft, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.