Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: GPT-5.6 live probe (#627), VS Code model picker (#626), swarm tuning docs (#628) - #629

Merged
ndycode merged 8 commits into
mainfrom
fix/gpt-5.6-probe-vscode-models-swarm-tuning
Jul 11, 2026
Merged

ndycode merged 8 commits into
mainfrom
fix/gpt-5.6-probe-vscode-models-swarm-tuning

Conversation

@ndycode

@ndycode ndycode commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the three open issues: the live model probe still on GPT-5.5 (#627), GPT-5.6 missing from the Codex VS Code extension's model picker (#626), and the lack of tuning/troubleshooting guidance for high-parallelism 429/timeout symptoms (#628).

Closes #627. Closes #626. Closes #628.

What Changed

#627 — live quota probe → GPT-5.6

  • New DEFAULT_PROBE_MODEL (gpt-5.6-sol); QUOTA_PROBE_MODEL_CHAIN now leads with it and steps down to 5.5 → 5.4 → codex. check/report/forecast/best/fix all default their probe to it. DEFAULT_MODEL (routing/alias/pricing) stays 5.5, so GPT-5.6 remains opt-in per 2.5.0.
  • Added resolveProbeReasoningEffort(): the probe body previously hardcoded reasoning.effort: "none", which no GPT-5.6 tier accepts (and codex models never did). It now sends each probe model's cheapest supported effort (5.6 → low, 5.5 → none).
  • check now shows Model probe: gpt-5.6-sol | prompt family gpt-5.2 | tool search yes | computer use yes.

#626 — GPT-5.6 in the VS Code extension picker

  • The extension picker reads the installed config's provider.openai.models keys; 5.6 was only in codex-modern.json. Added the 17 GPT-5.6 legacy entries to config/codex-legacy.json (flattened per-effort format).
  • Fixed the installer's shallow merge, which let an existing config's models map win wholesale (so upgrades never gained new models). models now merge at the model-id level: new template models appear on upgrade, user per-id customizations are preserved.

#628 — high-parallelism tuning + doc corrections

  • Corrected two wrong documented defaults: retryAllAccountsRateLimited (truefalse) and retryAllAccountsMaxRetries (Infinity0).
  • Added a "High parallelism / swarms of agents" playbook (pidOffsetEnabled, the retryAllAccounts* trio, routingMutex in-process caveat, "more accounts ⇒ less contention") and clarified that Provider response headers timed out after 10000ms originates in the host client, not this plugin. Runtime defaults are left unchanged (documented as guidance).

Validation

  • npm run lint
  • npm test — all touched suites pass; two pre-existing, unrelated failures on the base branch (test/ci-workflows.test.ts, test/runtime-rotation-proxy.test.ts thread-goal eviction) reproduce on a clean main checkout and are not touched by this PR
  • npm run typecheck (+ npm run typecheck:scripts)
  • npm test -- test/documentation.test.ts
  • npm run build

Docs and Governance Checklist

  • README updated (if user-visible behavior changed) — not needed
  • docs/getting-started.md updated — not needed
  • docs/features.md updated — not needed
  • relevant docs/reference/* pages updated (settings.md, configuration.md, troubleshooting.md, development/CONFIG_FIELDS.md)
  • docs/upgrade.md updated — no migration behavior change
  • SECURITY.md / CONTRIBUTING.md — no change needed

Risk and Rollback

  • Risk level: low. The probe change is scoped to diagnostics and falls back to the prior chain; the installer merge only widens what is preserved; docs/config are additive. No routing/rotation/auth behavior changes.
  • Rollback plan: revert the branch; no state migration involved.

Additional Notes

  • Latent bug also fixed: codex quota probes previously sent an invalid reasoning.effort: "none".
  • Not touched (out of scope, flagged for follow-up): the duplicated model map in scripts/codex.js (legacy JS wrapper) still lacks GPT-5.6; and the base branch already has 10 Dependabot advisories unrelated to this change.

🤖 Generated with Claude Code

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

advances the live quota probe default to gpt-5.6-sol, fixes the hardcoded reasoning.effort: "none" probe body (invalid for gpt-5.6 and codex tiers), backfills 17 GPT-5.6 entries into the legacy config template, and corrects the installer's shallow model-map merge so upgrades gain new template models instead of keeping the old map wholesale.

  • probe chain (lib/quota-probe.ts, lib/runtime/quota-probe.ts): QUOTA_PROBE_MODEL_CHAIN now leads with gpt-5.6-sol; each step uses resolveProbeReasoningEffort() to send the cheapest effort the probe model actually declares rather than hardcoding "none".
  • installer merge (scripts/install-codex-auth.js): model ids are now merged at the key level — template models appear on upgrade while user per-id overrides survive; existing top-level openai options still win wholesale.
  • pidOffsetEnabled default (lib/config.ts): flipped to true so parallel codex-multi-auth-codex processes each bias toward a different account; CONFIG_FIELDS.md and configuration.md both reflect the new default, and global-sandbox.ts pins it to 0 to keep rotation-test assertions deterministic.

Confidence Score: 5/5

safe to merge — changes are scoped to diagnostics, config templates, docs, and the installer merge; no routing, rotation, or auth behavior is altered

all three code paths are well-tested: the new parity suite locks wrapper↔lib model resolution, the installer test covers the merge-upgrade scenario end-to-end, and the updated quota-probe tests verify the fallback chain ordering. the pidOffsetEnabled default flip is explicitly accounted for in global-sandbox.ts so existing test assertions stay deterministic. the probe reasoning-effort fix closes a latent invalid-request bug without touching any live traffic path.

no files require special attention — the most sensitive change (installer model merge) has direct test coverage and the merge ordering is correct in all cases

Important Files Changed

Filename Overview
lib/request/helpers/model-map.ts adds DEFAULT_PROBE_MODEL, prepends it to QUOTA_PROBE_MODEL_CHAIN, and exports resolveProbeReasoningEffort() — logic correctly walks cheapest-first preference list and remaps ultra→max in the fallback branch
lib/quota-probe.ts replaces hardcoded "none" with resolveProbeReasoningEffort(model); fixes the latent invalid-effort bug for gpt-5.6 and codex probe models
lib/runtime/quota-probe.ts same "none" → resolveProbeReasoningEffort fix as lib/quota-probe.ts, keeping the runtime and manager probe bodies in sync
lib/config.ts pidOffsetEnabled default changed false→true; correctly documented in CONFIG_FIELDS.md and configuration.md; global-sandbox.ts pins it to 0 for test determinism
scripts/install-codex-auth.js model-level merge fix is correct — template models are spread first, existing per-id entries win; the new test in install-codex-auth.test.ts exercises all three cases (new template model, user override, bespoke custom model)
scripts/codex.js adds GPT-5.6 tier constants, resolveGpt56RequestedModel, max/ultra to REASONING_FALLBACKS, ultra→max wire rewrite, and CODEX_MULTI_AUTH_WRAPPER_IMPORT_ONLY export guard; parity with lib is locked by test/codex-model-resolution.test.ts
config/codex-legacy.json adds 17 GPT-5.6 per-effort legacy entries; no none/minimal entries for any 5.6 tier, matching the declared supportedReasoningEfforts in model-map.ts
test/codex-model-resolution.test.ts new parity suite locks wrapper↔lib resolution for GPT-5.6 tier mapping, effort coercion, family bucketing, and canonicalization; uses CODEX_MULTI_AUTH_WRAPPER_IMPORT_ONLY flag correctly (set before import, deleted immediately after)
test/install-codex-auth.test.ts new merge-upgrade test verifies new template models appear, user model overrides survive, and top-level openai options are preserved
test/helpers/global-sandbox.ts pins CODEX_AUTH_PID_OFFSET_ENABLED=0 for test determinism after the default-on change; correct approach

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["check / report / forecast / best / fix\n(default model: DEFAULT_PROBE_MODEL)"] --> B["fetchCodexQuotaSnapshot(model)"]
    B --> C{"QUOTA_PROBE_MODEL_CHAIN\n[gpt-5.6-sol, gpt-5.5, gpt-5.4, gpt-5.3-codex]"}
    C --> D["resolveProbeReasoningEffort(model)\npick cheapest effort model declares"]
    D --> E{"gpt-5.6 tier?"}
    E -- "yes (no none/minimal)" --> F["effort = low"]
    E -- "no (gpt-5.5 supports none)" --> G["effort = none"]
    F --> H["POST /v1/responses\nreasoning: { effort }"]
    G --> H
    H --> I{Response?}
    I -- "200 OK" --> J["return quota snapshot"]
    I -- "unsupported model error" --> K["next model in chain"]
    K --> D
    I -- "chain exhausted" --> L["return CodexUnavailableError"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["check / report / forecast / best / fix\n(default model: DEFAULT_PROBE_MODEL)"] --> B["fetchCodexQuotaSnapshot(model)"]
    B --> C{"QUOTA_PROBE_MODEL_CHAIN\n[gpt-5.6-sol, gpt-5.5, gpt-5.4, gpt-5.3-codex]"}
    C --> D["resolveProbeReasoningEffort(model)\npick cheapest effort model declares"]
    D --> E{"gpt-5.6 tier?"}
    E -- "yes (no none/minimal)" --> F["effort = low"]
    E -- "no (gpt-5.5 supports none)" --> G["effort = none"]
    F --> H["POST /v1/responses\nreasoning: { effort }"]
    G --> H
    H --> I{Response?}
    I -- "200 OK" --> J["return quota snapshot"]
    I -- "unsupported model error" --> K["next model in chain"]
    K --> D
    I -- "chain exhausted" --> L["return CodexUnavailableError"]
Loading

Reviews (3): Last reviewed commit: "test: fix two Windows-checkout-only test..." | Re-trigger Greptile

ndycode and others added 3 commits July 11, 2026 05:49
The diagnostic live probe used by `check`, `report`, `forecast`, `best`, and
`fix` still led with GPT-5.5. Introduce a dedicated `DEFAULT_PROBE_MODEL`
(`gpt-5.6-sol`) and lead `QUOTA_PROBE_MODEL_CHAIN` with it, so the probe reports
the current GPT-5.6 family while stepping down to 5.5/5.4/codex for accounts
without 5.6 entitlement. `DEFAULT_MODEL` (routing/alias/pricing default) stays on
5.5, keeping GPT-5.6 opt-in per 2.5.0.

The probe body hardcoded `reasoning.effort: "none"`, which no GPT-5.6 tier
accepts (and which codex models never accepted either). Add
`resolveProbeReasoningEffort()` so each probe model gets its cheapest supported
effort (5.6 -> low, 5.5 -> none), instead of sending a value the backend rejects.

`check` now reports:
  Model probe: gpt-5.6-sol | prompt family gpt-5.2 | tool search yes | computer use yes

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The Codex VS Code extension builds its model picker from the installed config's
`provider.openai.models` keys, whereas the CLI resolves any model via the code
model map. GPT-5.6 was only added to `codex-modern.json`, so legacy-config users
never saw it. Two fixes:

- Add the GPT-5.6 tiers to `config/codex-legacy.json` in the flattened
  per-effort format (Sol/Terra low..ultra, Luna low..max), matching the modern
  template's variants.
- Fix the installer's shallow merge (`{ ...template, ...existing }`), which let
  an existing config's `models` map win wholesale, so upgrades never gained
  newly shipped models. Merge `models` at the model-id level: new template
  models appear on upgrade while the user's per-id customizations are preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address the "constant rate-limited / very slow / headers timed out" report for
large parallel-agent swarms:

- Fix two wrong documented defaults: `retryAllAccountsRateLimited` (`true` ->
  `false`) and `retryAllAccountsMaxRetries` (`Infinity` -> `0`), matching
  DEFAULT_PLUGIN_CONFIG.
- Add a "High parallelism / swarms of agents" playbook to troubleshooting.md and
  a matching concurrency section to configuration.md: `pidOffsetEnabled`, the
  `retryAllAccounts*` trio, `routingMutex` (in-process-only caveat), and the
  "more accounts => less contention" structural note.
- Clarify that `Provider response headers timed out after 10000ms` is emitted by
  the host client's provider layer, not this plugin (whose `fetchTimeoutMs`
  defaults to 60000).

Also note in configuration.md that the legacy template now ships the GPT-5.6
tiers (#626).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

adds gpt-5.6 model templates, centralizes probe-model and reasoning-effort selection, updates command defaults and installer merging, refreshes regression coverage, and documents concurrency and retry settings.

Changes

gpt-5.6 model templates

Layer / File(s) Summary
gpt-5.6 model definitions
config/codex-legacy.json:18, docs/configuration.md:164
adds oauth-backed sol, terra, and luna gpt-5.6 tiers with shared limits and tier-specific reasoning settings, and documents modern versus legacy template representations.

probe model and reasoning resolution

Layer / File(s) Summary
probe model selection and effort resolution
lib/request/helpers/model-map.ts:105, lib/request/helpers/model-map.ts:662, lib/quota-probe.ts:391, lib/runtime/quota-probe.ts:50
uses gpt-5.6-sol as the leading probe model and selects a supported non-ultra reasoning effort for each probe request.
quota probe regression coverage
test/quota-probe.test.ts:33, test/runtime-quota-probe.test.ts:4
updates default and fallback expectations for the new probe model and resolved model ordering.

command probe defaults and regression coverage

Layer / File(s) Summary
command and cache defaults
lib/codex-manager/commands/forecast.ts:17, lib/codex-manager/commands/report.ts:28, lib/codex-manager/help.ts:1, lib/codex-manager/quota-cache-helpers.ts:13, lib/codex-manager/repair-commands.ts:43, lib/codex-manager/commands/best.ts:3
switches forecast, report, best, fix, and live quota probe defaults from DEFAULT_MODEL to DEFAULT_PROBE_MODEL.
command behavior tests
test/codex-manager-cli.test.ts:3, test/codex-manager-forecast-command.test.ts:8, test/codex-manager-help.test.ts:7, test/codex-manager-report-command.test.ts:7
updates help, parsing, quota calls, report model selection, and multi-workspace expectations for the probe model. no windows-specific regression coverage is added.

template-preserving installer merge

Layer / File(s) Summary
model-id merge and upgrade validation
scripts/install-codex-auth.js:211, test/install-codex-auth.test.ts:153
merges template and existing openai models by model id while preserving customized models and top-level settings; the upgrade test verifies those behaviors.

high-concurrency and retry documentation

Layer / File(s) Summary
concurrency, retry, and timeout guidance
docs/configuration.md:134, docs/development/CONFIG_FIELDS.md:69, docs/reference/settings.md:151, docs/troubleshooting.md:85
documents multi-process routing, changed retry defaults, rate-limit symptoms, mutex scope, and host-client timeout behavior. concurrency risks are documented; no cross-process mutex implementation is changed.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant command as codex command
  participant probe as quota probe
  participant resolver as resolveProbeReasoningEffort
  participant api as codex api
  command->>probe: request quota snapshot
  probe->>resolver: resolve effort for selected model
  resolver-->>probe: return supported reasoning effort
  probe->>api: send quota request
  api-->>probe: return quota snapshot
  probe-->>command: return model and quota data
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning the title is related, but it misses the required <type(scope)> form and exceeds the 72-character limit. rename it to a lowercase conventional-commit like fix(codex): update live probe and docs, and keep the summary under 72 characters.
✅ Passed checks (3 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.
Description check ✅ Passed the description follows the required template and covers summary, changes, validation, docs, risk, and notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gpt-5.6-probe-vscode-models-swarm-tuning
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/gpt-5.6-probe-vscode-models-swarm-tuning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment on lines +685 to +696
export function resolveProbeReasoningEffort(
model: string | undefined,
): WireReasoningEffort {
const profile = getModelProfile(model);
for (const effort of PROBE_REASONING_EFFORT_PREFERENCE) {
if (profile.supportedReasoningEfforts.includes(effort)) {
return effort;
}
}
const fallback = profile.defaultReasoningEffort;
return fallback === "ultra" ? "max" : fallback;
}

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 missing vitest coverage for resolveProbeReasoningEffort

test/model-map.test.ts doesn't import or exercise resolveProbeReasoningEffort at all — confirmed by grep. the two paths that currently lack coverage are: (1) the ultra → max remap in the fallback branch, and (2) any model whose supportedReasoningEfforts contains none of the 7 preference entries (triggering the fallback at all). given the 80%+ threshold and that this function is now on the hot path for every quota probe, a few direct tests in test/model-map.test.ts would close the gap (e.g. sol → "low", gpt-5.5 → "none", a synthetic model with only "ultra" efforts → "max").

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/request/helpers/model-map.ts
Line: 685-696

Comment:
**missing vitest coverage for `resolveProbeReasoningEffort`**

`test/model-map.test.ts` doesn't import or exercise `resolveProbeReasoningEffort` at all — confirmed by grep. the two paths that currently lack coverage are: (1) the `ultra → max` remap in the fallback branch, and (2) any model whose `supportedReasoningEfforts` contains none of the 7 preference entries (triggering the fallback at all). given the 80%+ threshold and that this function is now on the hot path for every quota probe, a few direct tests in `test/model-map.test.ts` would close the gap (e.g. sol → `"low"`, gpt-5.5 → `"none"`, a synthetic model with only `"ultra"` efforts → `"max"`).

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex

…robe (#627)

`runBestCommand` resolved its probe model with `|| DEFAULT_MODEL`, the lone
live-probe command still falling back to 5.5 instead of the shared probe model.
Its arg default already resolves to GPT-5.6, so this only bit an empty
`--model`, but align it with report/forecast/fix for consistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/configuration.md`:
- Line 142: Fix the broken troubleshooting reference in the configuration
documentation by either adding a matching “High parallelism / swarms of agents”
heading and playbook to docs/troubleshooting.md or updating the link to an
existing anchor; ensure the referenced anchor resolves correctly.
- Around line 138-140: The authoritative settings references still contain
outdated high-concurrency defaults and omit newly documented options. Update the
entries in the settings reference and CONFIG_FIELDS documentation for
retryAllAccountsRateLimited and retryAllAccountsMaxRetries to use false and 0,
and add pidOffsetEnabled and routingMutex with their corresponding environment
variables and defaults, matching docs/configuration.md.

In `@docs/reference/settings.md`:
- Around line 151-153: Correct the retry settings documentation to match the
runtime behavior in the all-accounts retry gate: document that
retryAllAccountsMaxWaitMs=0 means unlimited wait rather than no wait, and
clarify that retries are only enabled when retryAllAccountsMaxRetries is greater
than 0. Update the related effect text to mention both requirements and the
timeout risk.

In `@docs/troubleshooting.md`:
- Line 97: Document the routingMutex setting in docs/reference/settings.md and
docs/development/CONFIG_FIELDS.md, including its configuration location, default
value, and single-process scope, or update the troubleshooting guidance to use
the supported mechanism. Extend test/documentation.test.ts to verify this
documented contract and ensure the reference inventories include the new
setting.
- Around line 94-95: Update the troubleshooting guidance around adding accounts
and pidOffsetEnabled to avoid stating that 429 errors are inevitable with a
specific account-to-agent ratio; use qualified wording such as “can become
likely” or “often increases contention,” while preserving the recommendation to
add accounts and use process-specific account selection.

In `@lib/request/helpers/model-map.ts`:
- Around line 662-697: Add focused Vitest unit coverage for the exported
resolveProbeReasoningEffort function in a model-map test file. Assert
gpt-5.6-sol resolves to low, a pre-5.6 general model resolves to none, a
-pro/-mini/-nano model without none/low selects its cheapest supported effort,
and a synthetic profile with defaultReasoningEffort set to ultra falls back to
max; ensure the change cites the affected Vitest test.

In `@test/install-codex-auth.test.ts`:
- Around line 153-201: Update the temp-root teardown in
test/install-codex-auth.test.ts to use the existing removeWithRetry() helper
instead of rmSync, covering Windows EBUSY, EPERM, and ENOTEMPTY failures. Extend
the upgrade test “adds newly shipped template models on upgrade while preserving
user model customizations” with a same-ID collision for gpt-5.5 containing
different template and user sub-fields, then assert the resulting model
preserves the user fields while incorporating template fields, covering the
shallow per-ID merge implemented by the install logic.

In `@test/quota-probe.test.ts`:
- Around line 33-36: Update the quota probe tests around the DEFAULT_PROBE_MODEL
and DEFAULT_MODEL attempts to inspect fetchMock’s request body, parse the second
argument body, and assert reasoning.effort is "low" for the probe model and
"none" for the default model. Preserve the existing model and instruction
assertions while adding these deterministic Vitest regression checks covering
resolveProbeReasoningEffort.

In `@test/runtime-quota-probe.test.ts`:
- Around line 4-7: Add assertions in the runtime quota probe tests covering the
sent request body's reasoning.effort value, matching the equivalent assertions
in test/quota-probe.test.ts. Update the cases around the DEFAULT_MODEL,
DEFAULT_PROBE_MODEL, and fetchRuntimeCodexQuotaSnapshot probe body construction
to verify the expected effort is included.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 23f91572-ee0f-475f-947d-e9af9d753d4a

📥 Commits

Reviewing files that changed from the base of the PR and between 261be5f and 56104e0.

📒 Files selected for processing (21)
  • config/codex-legacy.json
  • docs/configuration.md
  • docs/development/CONFIG_FIELDS.md
  • docs/reference/settings.md
  • docs/troubleshooting.md
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • lib/runtime/quota-probe.ts
  • scripts/install-codex-auth.js
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-report-command.test.ts
  • test/install-codex-auth.test.ts
  • test/quota-probe.test.ts
  • test/runtime-quota-probe.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: CodeRabbit
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (21)
docs/development/**/*.md

📄 CodeRabbit inference engine (docs/DOCUMENTATION.md)

Update development docs when architecture, config flow, or GitHub-facing metadata guidance changes

docs/development/**/*.md: Verify every command snippet in documentation is runnable and cross-check path references against runtime modules
Confirm cross-links are valid in documentation

Files:

  • docs/development/CONFIG_FIELDS.md
docs/**/*.md

📄 CodeRabbit inference engine (docs/STYLE_GUIDE.md)

docs/**/*.md: User-facing documentation should follow the page template: Title and one-line lead, Quick path commands, Core operational workflow, Troubleshooting or failure handling, and Related links
Use short sections and scan-friendly tables in documentation where they improve clarity
Prefer direct, actionable language in documentation
Use runnable command examples in documentation
Explain expected outcomes after critical commands in documentation
Keep terminology consistent with runtime names in documentation
Avoid speculative language when behavior is deterministic in documentation
Put the user problem in the first paragraph before implementation detail
Use descriptive page titles such as codex-multi-auth Features instead of generic titles on public docs
Do not repeat keyword lists in every section; search terms should appear only where they help a developer understand the page
Canonical command family is codex-multi-auth ...
Canonical runtime root is ~/.codex/multi-auth
Runtime rotation must be described as default-on unless the release policy changes
Legacy command/path references belong only in migration contexts in documentation
Compatibility aliases (codex multi auth, codex multi-auth, codex multiauth) belong only in command reference, troubleshooting, or migration contexts
Keep command flags aligned with runtime usage text in documentation
Avoid non-runnable command snippets in documentation
Avoid conflicting path guidance across documentation
Avoid legacy-first onboarding language in documentation

Files:

  • docs/development/CONFIG_FIELDS.md
  • docs/reference/settings.md
  • docs/configuration.md
  • docs/troubleshooting.md
docs/development/CONFIG_FIELDS.md

📄 CodeRabbit inference engine (docs/development/RUNBOOK_ADD_CONFIG_FIELD.md)

Update docs/development/CONFIG_FIELDS.md with field inventory details when adding new configuration fields

Maintain full field inventory in docs/development/CONFIG_FIELDS.md

Files:

  • docs/development/CONFIG_FIELDS.md
docs/development/**/{DOCUMENTATION,ARCHITECTURE,CONFIG_FIELDS}.md

📄 CodeRabbit inference engine (docs/development/TESTING.md)

Keep feature matrix in documentation in sync with implemented features

Files:

  • docs/development/CONFIG_FIELDS.md
!{dist,dist/**}/**

📄 CodeRabbit inference engine (AGENTS.md)

Source code lives in root index.ts, lib/, and scripts/ directories; dist/ is generated output and should not be edited

Files:

  • docs/development/CONFIG_FIELDS.md
  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • test/runtime-quota-probe.test.ts
  • docs/reference/settings.md
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • docs/configuration.md
  • lib/runtime/quota-probe.ts
  • scripts/install-codex-auth.js
  • lib/codex-manager/commands/report.ts
  • config/codex-legacy.json
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • docs/troubleshooting.md
  • test/quota-probe.test.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • test/codex-manager-cli.test.ts
**

⚙️ CodeRabbit configuration file

**: # PROJECT KNOWLEDGE BASE

Generated: 2026-04-25
Commit: a87e005
Validated: 2026-06-10 against commit 98d9819 (repo audit; claims re-checked against the tree, content not regenerated)
Branch: main
Package version: 2.5.0

OVERVIEW

codex-multi-auth is a Codex CLI-first OAuth account manager and optional forwarding wrapper for the official Codex CLI. The installed codex-multi-auth entrypoint handles account-management commands locally, codex-multi-auth-codex forwards official Codex commands through this package's wrapper when explicitly used, and runtime rotation can route live Responses traffic through a localhost account-rotation proxy by default. The plugin-host entrypoint remains exported for compatibility, but the primary product surface is the account manager, optional wrapper, storage, runtime proxy, and repair tooling.

STRUCTURE

./
├── scripts/
│   ├── codex.js              # codex-multi-auth-codex wrapper, official CLI forwarder, shadow CODEX_HOME/runtime proxy setup
│   ├── codex-multi-auth.js   # standalone package CLI entrypoint
│   ├── codex-routing.js      # auth command and compatibility alias routing
│   ├── codex-bin-resolver.js # official Codex binary discovery
│   ├── codex-app-router.js   # persistent localhost router for packaged Codex app bind
│   └── codex-app-launcher.js # reversible user-level app launcher routing helper
├── index.ts                  # optional plugin-host runtime entry
├── lib/                      # core runtime logic (see lib/AGENTS.md)
│   ├── auth/                 # OAuth flow, PKCE, callback server
│   ├── runtime/              # Codex CLI/app integration helpers, app bind, live sync, runtime observability
│   ├── request/              # request transform, SSE, failover, backoff
│   ├── storage/              # path resolution, migrations, backups, restore, import/export
│   ├── codex-cli/            # Codex CLI state sync and writer helpers
│   ├── codex-manager/        # command modules and settin...

Files:

  • docs/development/CONFIG_FIELDS.md
  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • test/runtime-quota-probe.test.ts
  • docs/reference/settings.md
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • docs/configuration.md
  • lib/runtime/quota-probe.ts
  • scripts/install-codex-auth.js
  • lib/codex-manager/commands/report.ts
  • config/codex-legacy.json
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • docs/troubleshooting.md
  • test/quota-probe.test.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • test/codex-manager-cli.test.ts
docs/**

⚙️ CodeRabbit configuration file

docs/**: # Documentation Architecture

Canonical governance for repository documentation quality and consistency.


Documentation Layers

Layer Audience Primary goal
Product entry New operators and search visitors Explain the project quickly, prioritize the right concepts first, and complete first successful login/check
User operations Daily users Configure, run, recover, and report issues safely
Reference Power users and maintainers Exact command, setting, and path lookup
Development Contributors and maintainers Internal architecture, flow, tests, and ownership

Source of Truth Map

Scope File
Project entry README.md
Docs portal docs/README.md
Daily operator landing docs/index.md
Onboarding docs/getting-started.md
FAQ docs/faq.md
Public architecture overview docs/architecture.md
Feature map docs/features.md
Configuration guide docs/configuration.md
Troubleshooting guide docs/troubleshooting.md
Privacy and data handling docs/privacy.md
Upgrade and migration docs/upgrade.md
Command reference docs/reference/commands.md
Public API contract docs/reference/public-api.md
Error contract reference docs/reference/error-contracts.md
Settings reference docs/reference/settings.md
Storage path reference docs/reference/storage-paths.md
Docs style contract docs/STYLE_GUIDE.md
Docs governance (this file) docs/DOCUMENTATION.md
Architecture internals docs/development/ARCHITECTURE.md
Runtime rotation implementation guide docs/development/ARCHITECTURE.md
GitHub metadata guidance docs/development/GITHUB_DISCOVERABILITY.md
IA/findability audit (2026-03-01) docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md
Config fields internals docs/development/CONFIG_FIELDS.md
Config flow internals `docs/development/CONF...

Files:

  • docs/development/CONFIG_FIELDS.md
  • docs/reference/settings.md
  • docs/configuration.md
  • docs/troubleshooting.md

⚙️ CodeRabbit configuration file

keep README, SECURITY, and docs consistent with actual CLI flags and workflows. whenever behavior changes, require updated upgrade notes and mention new npm scripts.

Files:

  • docs/development/CONFIG_FIELDS.md
  • docs/reference/settings.md
  • docs/configuration.md
  • docs/troubleshooting.md
docs/development/**

⚙️ CodeRabbit configuration file

docs/development/**: # Architecture

Runtime architecture for the Codex CLI wrapper, local OAuth account manager, default-on Responses rotation proxy, and optional plugin-host bridge.


Design Goals

  1. Keep account management simple for end users (codex-multi-auth ...).
  2. Preserve official Codex CLI behavior for non-auth commands.
  3. Route live account rotation by default while keeping explicit opt-out controls.
  4. Keep runtime rotation local, reversible, and compatible with official Codex state files.
  5. Preserve stateless backend request compatibility (store: false) unless explicit background-response compatibility is enabled.
  6. Keep plugin-host integration available without making it the default user path.

System Diagram

Terminal user
  |
  | codex-multi-auth ...
  v
scripts/codex-multi-auth.js
  |- normalizes bare manager subcommands to auth subcommands
  |- handles account-manager subcommands through lib/codex-manager.ts
  |- writes/reads ~/.codex/multi-auth/*
  |- syncs active account to official Codex CLI files

Terminal user
  |
  | codex-multi-auth-codex exec/review/resume/app/...
  v
scripts/codex.js
  |- handles auth subcommands locally
  |- discovers official Codex binary
  |- injects file-backed auth store unless caller opted out
  |- optionally creates shadow CODEX_HOME for runtime rotation
  v
Official Codex CLI

Runtime rotation enabled
  |
  v
shadow CODEX_HOME/config.toml
  |- model_provider = "codex-multi-auth-runtime-proxy"
  |- provider base_url = localhost proxy
  v
lib/runtime-rotation-proxy.ts
  |- validates local client token
  |- selects/refreshes managed account
  |- forwards Responses/model requests to official backend
  |- rotates on rate limit/auth/network/server failure
  |- persists runtime observability and selected-account mirrors

Packaged Codex app bind
  |
  v
lib/runtime/app-bind.ts + scripts/codex-app-router.js
  |- backs up real ~/.codex/config.toml
  |- writes provider config for persiste...

Files:

  • docs/development/CONFIG_FIELDS.md
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Write Vitest test suites with globals enabled (describe, it, expect)
Maintain 80%+ coverage threshold across statements, branches, functions, and lines
Use removeWithRetry() for Windows filesystem cleanup instead of bare fs.rm to handle EBUSY, EPERM, and ENOTEMPTY errors
Do not rely on dist/ in tests; use source files instead
Do not skip tests without justification
Relax lint rules for test files as configured in eslint.config.js

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error TypeScript escape hatches

Files:

  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • test/codex-manager-cli.test.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

Do not hardcode OAuth ports; use existing constants/helpers for port configuration

Files:

  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • lib/runtime/quota-probe.ts
  • scripts/install-codex-auth.js
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • test/codex-manager-cli.test.ts
{scripts,test}/**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

Do not use bare recursive delete logic in Windows-sensitive scripts/tests without retry handling for transient EBUSY/EPERM/ENOTEMPTY errors

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • scripts/install-codex-auth.js
  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
**/*.{js,ts,mjs,cjs}

📄 CodeRabbit inference engine (README.md)

**/*.{js,ts,mjs,cjs}: Store multi-account OAuth credentials and configuration under ~/.codex/multi-auth/ directory structure with separate files for settings, accounts, flagged accounts, quota cache, runtime observability, usage ledger, policies, profiles, and budget guards
Allow override of the multi-auth root storage directory via the CODEX_MULTI_AUTH_DIR environment variable, defaulting to ~/.codex/multi-auth/ if not set
Implement runtime account rotation through a loopback-only local proxy that is enabled by default and can be disabled via CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0 environment variable
Respect opt-out flags for automatic Codex app bind installation (CODEX_MULTI_AUTH_APP_BIND_INSTALL=0) and launcher routing installation (CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0), performing these only on first CLI run when opted in
Use request timeout and stream stall timeout environment variable overrides (CODEX_AUTH_FETCH_TIMEOUT_MS and CODEX_AUTH_STREAM_STALL_TIMEOUT_MS) when making OAuth or API requests
Support stateful Responses background: true mode as an opt-in feature via CODEX_AUTH_BACKGROUND_RESPONSES=1 or backgroundResponses settings field only when explicitly enabled
Implement bounded outbound request budgets per session to prevent a single prompt from walking the entire account pool indefinitely
Disable whole-pool replay by default when every account is rate-limited and trigger short cooldowns instead of aggressive rotation after repeated cross-account 5xx error bursts
Stagger proactive account refresh operations to reduce background refresh bursts across the account pool
For the codex-multi-auth-codex wrapper, handle auth ... subcommands locally and forward all other commands to the official Codex CLI without modification
Implement account selection and switching with health-aware logic that considers account quota, cooldown state, and recent runtime metrics
Support project-scoped account storage under `~/.codex/multi-auth/...

Files:

  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • lib/runtime/quota-probe.ts
  • scripts/install-codex-auth.js
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
  • test/codex-manager-cli.test.ts
test/**

⚙️ CodeRabbit configuration file

tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior. reject changes that mock real secrets or skip assertions.

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
lib/**/*.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/**/*.ts: All public exports should flow through lib/index.ts or documented package subpaths
Module dependencies must stay acyclic and follow the layering: types/constants → storage → accounts → runtime → manager/CLI; lower layers must never import from higher ones
Shared types/helpers must belong in the lower layer with higher layers re-exporting for surface compatibility instead of lower layers importing back from facades like lib/storage.ts
Never suppress type errors

Files:

  • lib/codex-manager/help.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
lib/**

⚙️ CodeRabbit configuration file

focus on auth rotation, windows filesystem IO, and concurrency. verify every change cites affected tests (vitest) and that new queues handle EBUSY/429 scenarios. check for logging that leaks tokens or emails.

Files:

  • lib/codex-manager/help.ts
  • lib/codex-manager/quota-cache-helpers.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/request/helpers/model-map.ts
docs/reference/**/*.md

📄 CodeRabbit inference engine (docs/DOCUMENTATION.md)

Update relevant command/settings/path references in reference documentation when runtime changes occur

New flags/settings/paths must be reflected in docs/reference/*

docs/reference/**/*.md: Document dashboard display settings under dashboardDisplaySettings and runtime compatibility settings under pluginConfig; store them in ~/.codex/multi-auth/settings.json, or under CODEX_MULTI_AUTH_DIR when set.
Account-list settings must control status/current badges, last-used text, quota details, fetch status, row highlighting, sorting, pinning, quick-switch numbering, and layout mode according to their documented keys.
menuStatuslineFields controls which per-account summary fields appear and their order; supported fields include last-used, limits, and status.
Menu behavior settings must define action auto-return timing, pause-on-key behavior, automatic quota fetching, and quota-cache TTL.
Color settings must document the overall theme preset, accent color, and menu focus style.
Experimental sync operations must always show a preview before applying changes; blocked target states must not apply changes; destination active selection and destination-only accounts must be preserved.
Named backup export must prompt for a filename, append .json when omitted, reject separators, traversal (..), .rotate., .tmp, and .wal suffixes, and fail safely on collisions without overwriting by default.
Live account synchronization must watch account storage for external changes and use the documented debounce and polling intervals.
Session affinity must keep sessions sticky to recent accounts within the configured TTL and maximum cache-entry limit.
Account scheduling must support hybrid load spreading and sequential drain-first scheduling.
Preemptive quota protection must defer requests when 5-hour or 7-day remaining quota reaches the configured thresholds, while respecting the maximum deferral window.
All-accounts-rate-limited retries must be opt-in and bounded...

Files:

  • docs/reference/settings.md
docs/reference/**

⚙️ CodeRabbit configuration file

docs/reference/**: # Command Reference

Complete command, flag, and hotkey reference for codex-multi-auth.


Canonical Command Family

Primary operations use codex-multi-auth ....

Compatibility forms are supported for migrations and wrapper-routed environments:

  • codex-multi-auth auth ...
  • codex-multi-auth-codex auth ...
  • codex auth ... when this package's wrapper has explicitly been installed or aliased as codex
  • codex multi auth ...
  • codex multi-auth ...
  • codex multiauth ...

Start Here

Command Description
codex-multi-auth login Open interactive auth dashboard
codex-multi-auth status Print short runtime/account summary
codex-multi-auth check Run quick account health check

Daily Use

Command Description
codex-multi-auth list List saved accounts and active account
codex-multi-auth switch <index> Set active account by index and pin it for runtime routing
codex-multi-auth unpin Clear the manual pin set by switch and resume hybrid rotation
codex-multi-auth forecast Forecast best account by readiness/risk
codex-multi-auth best Pick and optionally sync the best account (clears any manual pin)
codex-multi-auth account ... Manage local account policy metadata
codex-multi-auth workspace <account> [workspace] List an account's tracked workspaces, or set its active workspace

Sticky session affinity: switch, unpin, and best all bump an
affinityGeneration counter in storage that the runtime rotation proxy
observes via the same mtime-cached read path it uses for the manual pin.
When the proxy sees a higher generation than its in-memory tracker, it
drops every entry in its session-affinity store. Net effect: a manual
change reaches the next desktop-app request even mid-conversation, instead
of being shadowed for up to 20 minutes by a per-thread account lock that
would otherwise glue t...

Files:

  • docs/reference/settings.md
{lib/runtime/**,lib/request/**}/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

Do not expose account emails or tokens in runtime proxy client response headers or logs

Files:

  • lib/runtime/quota-probe.ts
  • lib/request/helpers/model-map.ts
docs/troubleshooting.md

📄 CodeRabbit inference engine (docs/DOCUMENTATION.md)

Update docs/troubleshooting.md with new failure signatures or recovery steps

Files:

  • docs/troubleshooting.md
test/**/codex-manager-cli.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test CLI settings management across 5 panels with Q cancel handling in codex-manager-cli.test.ts

Files:

  • test/codex-manager-cli.test.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Resolve runtime configuration in this precedence order: valid unified `settings.json` `pluginConfig`, fallback `CODEX_MULTI_AUTH_CONFIG_PATH` configuration, then hardcoded defaults; apply environment-variable overrides afterward.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Resolve dashboard display values from persisted `dashboardDisplaySettings`, followed by normalized defaults.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Keep `menuAutoFetchLimits`, `menuSortEnabled`, `liveAccountSync`, `sessionAffinity`, `proactiveRefreshGuardian`, and `preemptiveQuotaEnabled` enabled by default.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Treat `CODEX_MULTI_AUTH_FORCE_ACCOUNT` and `codex-multi-auth-codex --account` as ephemeral per-invocation account pins; the CLI flag takes precedence over the environment variable, and pinning must fail hard when the runtime rotation proxy is disabled.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Keep runtime rotation proxy behavior localhost-only and preserve request bodies and streaming responses while replacing outbound authentication with the selected managed account.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: When rotating accounts, remove hop-by-hop headers, private account metadata headers, and stale decoded `content-encoding` headers from client responses.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Return a structured pool-exhaustion error pointing users to `codex-multi-auth rotation status` when every account is unavailable.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Do not rotate to another account when an upstream or token-refresh endpoint explicitly revokes an OAuth token; return the error directly and apply the configured token-invalidation cooldown.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Use `hybrid` scheduling by default; support `sequential` drain-first scheduling, and ensure manual account pins take precedence over sequential scheduling.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: In sequential scheduling mode, intentionally ignore per-session affinity after the active account changes.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: For high-concurrency multi-process workloads, use `pidOffsetEnabled` to distribute account selection; keep retry and wait budgets bounded; use `routingMutex=enabled` only to serialize selection within one process.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Use more managed accounts as the structural solution for workloads with many concurrent agents; do not treat client-side timeout issues such as `Provider response headers timed out after 10000ms` as configurable by this plugin.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: For Microsoft/Outlook SSO invalidation cascades, increase the token-invalidation cooldown, re-login the account, or exclude it from rotation with `codex-multi-auth switch`.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Do not patch official Codex app files; use the persistent localhost router, backed-up Codex configuration, and supported startup or launcher integration for desktop app binding.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Package install/update self-healing must be opt-out configurable through `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0` and `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0`, with corresponding force-enable values of `1`.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Treat deprecated selectors such as `gpt-5-codex` and `gpt-5.1-codex*` as compatibility aliases, retrying them against the current documented Codex model after an unsupported-model response; only fall back to `gpt-5.4` after a real unsupported-model response.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:29.723Z
Learning: Validate effective configuration with `codex-multi-auth status`, `list`, `check`, and `forecast --live`.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Use `backgroundResponses` only when stateful background Responses API requests are intentional; enabling it forces `store=true`, preserves input item IDs, and disables stateless-only defaults such as fast-session trimming.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Test one known `background: true` request end to end before enabling `backgroundResponses` across shared automation.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Do not manually edit lease/state files while the CLI is running.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Treat backup/WAL artifacts and transient Windows `EPERM`/`EBUSY` rename failures as normal storage-recovery behavior.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Runtime rotation controls must be separated by layer: persisted settings use `pluginConfig.codexRuntimeRotationProxy`, process overrides use `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY`, wrapper helpers use their dedicated environment variables, and packaged app binding uses app-bind variables.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Use `CODEX_AUTH_SCHEDULING_STRATEGY` to override account scheduling per process; supported strategies are `hybrid` and `sequential`/`drain-first`.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Use temp-file-plus-rename semantics for storage writes and lease/state coordination for cross-process refreshes.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:35.282Z
Learning: Use `fs.watch` with polling fallback for live account synchronization to handle Windows watcher edge cases.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `codex-multi-auth doctor --fix`, `check`, and `forecast --live` as the initial recovery sequence; run `login` if the account pool remains unusable.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `where` on Windows and `which` on macOS/Linux to verify the official CLI and multi-auth binaries; confirm versions, status, and the globally installed package.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `codex-multi-auth ...` as the canonical account-manager command family; `codex-multi-auth-codex ...` is an optional forwarding wrapper, and the package does not publish a global `codex` binary.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Replace the obsolete `ndycode/codex-multi-auth` package with the unscoped `codex-multi-auth` package.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use browser-first OAuth normally; use `--device-auth` for remote, SSH, container, or headless environments, and use `--manual` only when device authentication is unavailable.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: If OAuth callback port `1455` is occupied, stop the conflicting process and rerun `codex-multi-auth login`.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Re-login affected accounts when authentication errors indicate malformed payloads, reused refresh tokens, or expired tokens.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: After switching accounts, rerun `codex-multi-auth switch <index>` and restart the session if stale Codex CLI state keeps the wrong account active.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Run `doctor --fix` and add a fresh account when the entire account pool is stale or damaged.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Enable runtime rotation with `codex-multi-auth rotation enable` or the `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=1` environment variable; remove an explicit `=0` override when necessary.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use the forwarding wrapper and verify its installation when forwarded sessions do not expose the local provider; help and non-requesting commands do not demonstrate rotation routing.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: When the rotation pool is exhausted, inspect `rotation status` and `forecast --live` before taking corrective action.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Keep `minRotationIntervalMs` at least `60000` to reduce OAuth token invalidation caused by rapid account rotation.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: For Microsoft/Outlook SSO invalidation, re-login, optionally set `CODEX_AUTH_TOKEN_INVALIDATION_COOLDOWN_MS=600000`, or disable the account from the rotation pool.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `rotation bind-app` to install packaged-app routing and `rotation unbind-app` or `rotation disable` to restore native Codex routing.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `codex-multi-auth history` and `history show <id>` to find sessions across providers; provider changes can hide sessions from native `/resume`, and unbinding or disabling rotation restores the native view.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Configure model reasoning speed with `model_reasoning_effort` in `~/.codex/config.toml` or via the CLI `-c` flag; app binding only routes Responses traffic.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: For high parallelism, add accounts, enable `pidOffsetEnabled`, and optionally enable bounded `retryAllAccountsRateLimited` retries with maximum retry and wait limits.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use `routingMutex: "enabled"` to serialize account selection within one process; do not expect it to coordinate separate agent processes.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Distinguish the host client's approximately 10-second provider-header timeout from this plugin's `fetchTimeoutMs` and `streamStallTimeoutMs`; configure the host timeout separately and tune plugin timeouts only for plugin timeout errors.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Run `codex-multi-auth list` in a worktree to migrate legacy path keys into repository-shared storage; use project-scoped storage when repositories must not share accounts.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Use the documented diagnostics commands, including `list`, `status`, `check`, `verify-flagged --json`, `forecast --live`, `fix --dry-run`, `report --live --json`, and `doctor --json`, when collecting troubleshooting data.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: A soft reset removes the local accounts, flagged accounts, and settings files under `~/.codex/multi-auth`, then requires logging in again.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: For complete uninstall, run `codex-multi-auth uninstall` before `npm uninstall -g codex-multi-auth`; use `--dry-run`, `--json`, and `--clear-accounts` according to the desired cleanup scope.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-07-10T21:51:50.878Z
Learning: Include report and doctor JSON output, CLI versions, global package listing, and the failing command with full terminal output in bug reports.
📚 Learning: 2026-06-04T06:14:18.093Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 510
File: test/scheduling-strategy-config.test.ts:1-1
Timestamp: 2026-06-04T06:14:18.093Z
Learning: In ndycode/codex-multi-auth, do not flag explicit imports from "vitest" (e.g., describe, it, expect, beforeEach/afterEach, etc.) in test files as issues—even if the Vitest config sets `globals: true`. The repo’s established convention is to keep these imports for consistency with neighboring tests; removing them would make files outliers.

Applied to files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-04T06:14:24.975Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 510
File: test/runtime-rotation-proxy.test.ts:2478-2491
Timestamp: 2026-06-04T06:14:24.975Z
Learning: In ndycode/codex-multi-auth test files (e.g. `test/*.test.ts`), when creating V3 storage fixtures for accounts, it’s an intentional convention to use `as never` for deliberately minimal stored-account objects that only include `refreshToken`, `addedAt`, and `lastUsed`. Do not treat `as never` here as a type-safety problem: optional/other fields are expected to be populated by the runtime during execution, and the cast is used solely to keep the fixture minimal and consistent across existing tests.

Applied to files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/runtime-quota-probe.test.ts
  • test/install-codex-auth.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
🪛 LanguageTool
docs/troubleshooting.md

[style] ~92-~92: Specify a number, remove phrase, use “a few”, or use “some”
Context: ...e a swarm of 10-20 deep agents) against a small number of accounts concentrates rate-limit pressu...

(SMALL_NUMBER_OF)

🔇 Additional comments (19)
docs/development/CONFIG_FIELDS.md (1)

69-71: LGTM!

scripts/install-codex-auth.js (1)

211-229: 🗄️ Data Integrity & Integration

the merge is correct: template models seed the map, existing entries win per id, and the map is only reassigned when non-empty. one thing worth calling out is that this id-level merge is shallow — { ...templateModels, ...existingModels } at scripts/install-codex-auth.js:226 means a user's saved entry for a known model shadows the whole template entry, so field-level template updates (new variants, revised limits) on an already-present model id are dropped on upgrade. that matches the comment and issue #626 intent (new-model shadowing was the bug), so this is a behavior confirmation rather than a defect.

please confirm this shallow-per-id behavior is the desired contract and that refreshing fields on existing model ids is intentionally out of scope.

config/codex-legacy.json (1)

18-442: LGTM!

docs/configuration.md (1)

164-164: LGTM!

lib/codex-manager/help.ts (1)

1-3: LGTM!

lib/codex-manager/quota-cache-helpers.ts (1)

13-16: LGTM!

Also applies to: 30-30

test/codex-manager-cli.test.ts (1)

3-6: LGTM!

Also applies to: 3267-3267, 7558-7563, 10138-10139

test/codex-manager-forecast-command.test.ts (1)

8-8: LGTM!

Also applies to: 130-130

test/codex-manager-help.test.ts (1)

7-7: LGTM!

Also applies to: 99-101, 118-125

test/codex-manager-report-command.test.ts (1)

7-7: LGTM!

Also applies to: 535-535

lib/codex-manager/commands/forecast.ts (2)

218-218: see the fallbackModels concern flagged on lib/request/helpers/model-map.ts:105-119.

requestedModel now defaults to DEFAULT_PROBE_MODEL and flows into deps.fetchCodexQuotaSnapshot({..., model: probeModel}) at forecast.ts:334-338 with no fallbackModels — same pattern called out there for the whole cohort.


17-17: LGTM!

Also applies to: 139-139, 152-152

lib/codex-manager/commands/report.ts (2)

314-314: see the fallbackModels concern flagged on lib/request/helpers/model-map.ts:105-119.

requestedModel defaults to DEFAULT_PROBE_MODEL and flows into deps.fetchCodexQuotaSnapshot({..., model: modelInspection.normalized}) at report.ts:450-454 with no fallbackModels.


28-28: LGTM!

Also applies to: 132-132, 146-146

lib/codex-manager/repair-commands.ts (2)

1200-1200: see the fallbackModels concern flagged on lib/request/helpers/model-map.ts:105-119.

probeModel defaults to DEFAULT_PROBE_MODEL and is passed to fetchCodexQuotaSnapshot at repair-commands.ts:1277-1281 and :1368-1372 with no fallbackModels, same pattern as forecast/report.


43-43: LGTM!

Also applies to: 145-145, 197-197

lib/quota-probe.ts (1)

3-6: LGTM!

Also applies to: 391-393

lib/runtime/quota-probe.ts (1)

4-7: LGTM!

Also applies to: 50-52

lib/request/helpers/model-map.ts (1)

105-119: 🎯 Functional Correctness

this is not an issue. lib/quota-probe.ts:201-209 already appends DEFAULT_QUOTA_PROBE_MODELS whenever fallbackModels is omitted, so the explicit gpt-5.6-sol default still falls through the full probe chain. the forecast --live, report --live, and fix --live call sites do not need extra fallback wiring.

			> Likely an incorrect or invalid review comment.

Comment thread docs/configuration.md Outdated
Comment on lines +138 to +140
- `pidOffsetEnabled` (default `false`, env `CODEX_AUTH_PID_OFFSET_ENABLED`): gives each process a small deterministic account-selection bias so separate processes prefer different accounts instead of all selecting the same one. This is the primary lever for the multi-process swarm case.
- `retryAllAccountsRateLimited` (default `false`), with `retryAllAccountsMaxRetries` (default `0`) and `retryAllAccountsMaxWaitMs` (default `0`): when every account is momentarily rate-limited, wait for the soonest quota window and retry instead of returning pool-exhaustion immediately. Keep the retry/wait budgets bounded so a blocking wait does not exceed the host client's own request timeout.
- `routingMutex` (default `legacy`, env `CODEX_AUTH_ROUTING_MUTEX`): set to `enabled` to serialize account selection *within a single process*. It has no effect across separate agent processes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

synchronize the high-concurrency settings across reference docs.

docs/configuration.md:138-140 documents retryAllAccountsRateLimited=false and retryAllAccountsMaxRetries=0, while docs/reference/settings.md and docs/development/CONFIG_FIELDS.md still declare true and Infinity. update those authoritative references to the new defaults, and add pidOffsetEnabled and routingMutex with their environment overrides.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/configuration.md` around lines 138 - 140, The authoritative settings
references still contain outdated high-concurrency defaults and omit newly
documented options. Update the entries in the settings reference and
CONFIG_FIELDS documentation for retryAllAccountsRateLimited and
retryAllAccountsMaxRetries to use false and 0, and add pidOffsetEnabled and
routingMutex with their corresponding environment variables and defaults,
matching docs/configuration.md.

Source: Path instructions

Comment thread docs/configuration.md
- `retryAllAccountsRateLimited` (default `false`), with `retryAllAccountsMaxRetries` (default `0`) and `retryAllAccountsMaxWaitMs` (default `0`): when every account is momentarily rate-limited, wait for the soonest quota window and retry instead of returning pool-exhaustion immediately. Keep the retry/wait budgets bounded so a blocking wait does not exceed the host client's own request timeout.
- `routingMutex` (default `legacy`, env `CODEX_AUTH_ROUTING_MUTEX`): set to `enabled` to serialize account selection *within a single process*. It has no effect across separate agent processes.

The structural fix is more accounts: with N accounts and M ≫ N concurrent agents, roughly `M/N` agents share each account, so rate-limit pressure only drops as N grows. See [High parallelism / swarms of agents](troubleshooting.md#high-parallelism--swarms-of-agents) for the full playbook, including the host-client-side `Provider response headers timed out after 10000ms` timeout (which this plugin cannot change).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

fix the broken high-parallelism troubleshooting link.

docs/configuration.md:142 links to troubleshooting.md#high-parallelism--swarms-of-agents, but the supplied docs/troubleshooting.md has no matching heading. add the referenced playbook or point to an existing anchor.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/configuration.md` at line 142, Fix the broken troubleshooting reference
in the configuration documentation by either adding a matching “High parallelism
/ swarms of agents” heading and playbook to docs/troubleshooting.md or updating
the link to an existing anchor; ensure the referenced anchor resolves correctly.

Source: Path instructions

Comment on lines +151 to +153
| `retryAllAccountsRateLimited` | `false` | When every account is rate-limited, wait for the soonest quota window and retry instead of failing immediately. Off by default; enable it (with a bounded `retryAllAccountsMaxRetries`/`retryAllAccountsMaxWaitMs`) for high-parallelism workloads — see [High parallelism / swarms of agents](../troubleshooting.md#high-parallelism--swarms-of-agents) |
| `retryAllAccountsMaxWaitMs` | `0` | Maximum wait budget for all-accounts-rate-limited retries (`0` = no wait) |
| `retryAllAccountsMaxRetries` | `0` | Maximum retry attempts for all-accounts-rate-limited loops (`0` = no retry) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

correct the maxWaitMs=0 semantics.

docs/reference/settings.md:152 says 0 = no wait, but the runtime retry gate at index.ts:2920-2945 treats 0 as unlimited wait. With retries enabled, this can block until the quota window and trigger host-side timeouts. The effect text should also clarify that retries require retryAllAccountsMaxRetries > 0.

as per path instructions, reference settings must match implemented runtime behavior.

proposed correction
-| `retryAllAccountsRateLimited` | `false` | When every account is rate-limited, wait for the soonest quota window and retry instead of failing immediately. Off by default; enable it (with a bounded `retryAllAccountsMaxRetries`/`retryAllAccountsMaxWaitMs`) for high-parallelism workloads — see [High parallelism / swarms of agents](../troubleshooting.md#high-parallelism--swarms-of-agents) |
-| `retryAllAccountsMaxWaitMs` | `0` | Maximum wait budget for all-accounts-rate-limited retries (`0` = no wait) |
+| `retryAllAccountsRateLimited` | `false` | When enabled and `retryAllAccountsMaxRetries > 0`, retry after all accounts are rate-limited. Off by default. |
+| `retryAllAccountsMaxWaitMs` | `0` | Maximum wait budget for all-accounts-rate-limited retries (`0` = unlimited) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `retryAllAccountsRateLimited` | `false` | When every account is rate-limited, wait for the soonest quota window and retry instead of failing immediately. Off by default; enable it (with a bounded `retryAllAccountsMaxRetries`/`retryAllAccountsMaxWaitMs`) for high-parallelism workloads — see [High parallelism / swarms of agents](../troubleshooting.md#high-parallelism--swarms-of-agents) |
| `retryAllAccountsMaxWaitMs` | `0` | Maximum wait budget for all-accounts-rate-limited retries (`0` = no wait) |
| `retryAllAccountsMaxRetries` | `0` | Maximum retry attempts for all-accounts-rate-limited loops (`0` = no retry) |
| `retryAllAccountsRateLimited` | `false` | When enabled and `retryAllAccountsMaxRetries > 0`, retry after all accounts are rate-limited. Off by default. |
| `retryAllAccountsMaxWaitMs` | `0` | Maximum wait budget for all-accounts-rate-limited retries (`0` = unlimited) |
| `retryAllAccountsMaxRetries` | `0` | Maximum retry attempts for all-accounts-rate-limited loops (`0` = no retry) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/settings.md` around lines 151 - 153, Correct the retry
settings documentation to match the runtime behavior in the all-accounts retry
gate: document that retryAllAccountsMaxWaitMs=0 means unlimited wait rather than
no wait, and clarify that retries are only enabled when
retryAllAccountsMaxRetries is greater than 0. Update the related effect text to
mention both requirements and the timeout risk.

Source: Path instructions

Comment thread docs/troubleshooting.md Outdated
Comment thread docs/troubleshooting.md
- **Add more accounts.** This is the only structural fix. With 2 accounts and ~20 agents, ~10 agents share each account, so `429`s are inevitable no matter how you tune. Contention falls roughly linearly as you add accounts.
- **`pidOffsetEnabled: true`** — gives each process a small deterministic account-selection bias so different processes lean toward different accounts instead of all hammering the same one. This is the primary knob for the multi-process swarm case (off by default).
- **`retryAllAccountsRateLimited: true`** with a bounded **`retryAllAccountsMaxRetries`** and **`retryAllAccountsMaxWaitMs`** — when every account is momentarily rate-limited, the proxy waits for the soonest quota window and retries instead of returning pool-exhaustion immediately (which otherwise cascades into agent failures). Keep the wait bounded: a long blocking wait can itself trip the host client's 10s header timeout.
- **`routingMutex: "enabled"`** — serializes account selection *within a single process*. Useful when one process issues many concurrent requests, but it does **not** coordinate across separate agent processes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

document where routingMutex is configured.

The new guidance recommends routingMutex: "enabled", but docs/reference/settings.md and docs/development/CONFIG_FIELDS.md do not define its location, default, or process scope. Add the setting to the reference inventories, or replace this with the supported configuration mechanism. Cover the documented contract in test/documentation.test.ts.

as per path instructions, new settings must be reflected in reference documentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/troubleshooting.md` at line 97, Document the routingMutex setting in
docs/reference/settings.md and docs/development/CONFIG_FIELDS.md, including its
configuration location, default value, and single-process scope, or update the
troubleshooting guidance to use the supported mechanism. Extend
test/documentation.test.ts to verify this documented contract and ensure the
reference inventories include the new setting.

Source: Path instructions

Comment on lines +662 to +697
// Cheapest-first ordering used to pick a quota-probe reasoning effort. `ultra`
// is intentionally absent: it never reaches the wire (upstream rewrites it to
// `max`) and would only ever be a more expensive choice than `max` anyway.
const PROBE_REASONING_EFFORT_PREFERENCE = [
"none",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max",
] as const satisfies readonly WireReasoningEffort[];

/**
* Resolve the cheapest reasoning effort a probe model actually supports.
*
* A quota probe only needs the response's quota headers, so it wants the
* lowest-cost effort. The probe body cannot simply hardcode `none`: no GPT-5.6
* tier accepts `none`/`minimal`, so probing GPT-5.6 with `none` is rejected
* upstream (issue #627). This returns `none` for the pre-5.6 general models,
* `low` for GPT-5.6, and each model's cheapest supported effort otherwise.
* Never returns `ultra`.
*/
export function resolveProbeReasoningEffort(
model: string | undefined,
): WireReasoningEffort {
const profile = getModelProfile(model);
for (const effort of PROBE_REASONING_EFFORT_PREFERENCE) {
if (profile.supportedReasoningEfforts.includes(effort)) {
return effort;
}
}
const fallback = profile.defaultReasoningEffort;
return fallback === "ultra" ? "max" : fallback;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

resolveProbeReasoningEffort has no dedicated unit test.

this is a new exported function with real branching logic (cheapest-first scan + ultramax fallback), and it directly gates whether probes get rejected upstream (gpt-5.6 rejects none/minimal). the provided test diffs in test/quota-probe.test.ts and test/runtime-quota-probe.test.ts only assert snapshot.model and instruction-fetch call args — nothing asserts the reasoning.effort value sent per model. add a focused test (e.g. in a model-map test file) covering: gpt-5.6-sollow, a pre-5.6 general model → none, a -pro/-mini/-nano tier with no none/low support → its cheapest supported tier, and a synthetic profile whose defaultReasoningEffort is "ultra" to exercise the ultramax fallback branch, which otherwise looks unreachable given today's model profiles.

as per path instructions, "verify every change cites affected tests (vitest)" for lib/**.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/request/helpers/model-map.ts` around lines 662 - 697, Add focused Vitest
unit coverage for the exported resolveProbeReasoningEffort function in a
model-map test file. Assert gpt-5.6-sol resolves to low, a pre-5.6 general model
resolves to none, a -pro/-mini/-nano model without none/low selects its cheapest
supported effort, and a synthetic profile with defaultReasoningEffort set to
ultra falls back to max; ensure the change cites the affected Vitest test.

Source: Path instructions

Comment on lines +153 to +201
it("adds newly shipped template models on upgrade while preserving user model customizations", async () => {
const home = mkdtempSync(path.join(tmpdir(), "codex-install-merge-"));
tempRoots.push(home);
const appData = path.join(home, "AppData", "Roaming");
const localAppData = path.join(home, "AppData", "Local");
const env = {
...process.env,
HOME: home,
USERPROFILE: home,
APPDATA: appData,
LOCALAPPDATA: localAppData,
};
const configDir = path.join(appData, "Codex");
const configPath = path.join(configDir, "Codex.json");
// An already-initialized config from before the GPT-5.6 tiers shipped: it
// has a user-customized known model and a bespoke custom model, but no 5.6.
const initialConfig = {
plugin: ["codex-multi-auth"],
provider: {
openai: {
options: { reasoningEffort: "high" },
models: {
"gpt-5.5": { name: "My customized 5.5" },
"my-custom-model": { name: "Bespoke" },
},
},
},
};

mkdirSync(configDir, { recursive: true });
writeFileSync(configPath, `${JSON.stringify(initialConfig, null, 2)}\n`, "utf8");

await execFileAsync(process.execPath, [scriptPath, "--modern", "--no-cache-clear"], {
env,
windowsHide: true,
});

const written = JSON.parse(readFileSync(configPath, "utf8")) as {
provider: { openai: { options?: Record<string, unknown>; models: Record<string, { name?: string }> } };
};
const models = written.provider.openai.models;
// Newly shipped template model now appears after the upgrade.
expect(models["gpt-5.6-sol"]).toBeDefined();
// The user's bespoke model and their override of a known model are preserved.
expect(models["my-custom-model"]?.name).toBe("Bespoke");
expect(models["gpt-5.5"]?.name).toBe("My customized 5.5");
// Existing top-level openai settings still win.
expect(written.provider.openai.options?.reasoningEffort).toBe("high");
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP 'removeWithRetry|fs\.rm|rmSync|tempRoots' test/install-codex-auth.test.ts -C2

Repository: ndycode/codex-multi-auth

Length of output: 2056


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,120p' test/install-codex-auth.test.ts
printf '\n---\n'
sed -n '150,230p' test/install-codex-auth.test.ts
printf '\n---\n'
sed -n '200,260p' scripts/install-codex-auth.js

Repository: ndycode/codex-multi-auth

Length of output: 9081


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '"gpt-5\.5"|gpt-5\.6-sol|models\s*:' scripts/install-codex-auth.js test/install-codex-auth.test.ts -C 3

Repository: ndycode/codex-multi-auth

Length of output: 1831


use retryable cleanup for install-codex-auth temp roots

  • test/install-codex-auth.test.ts:34-40 still tears down tempRoots with rmSync(..., { recursive: true, force: true }); switch this to removeWithRetry() so windows EBUSY / EPERM / ENOTEMPTY doesn’t leave AppData behind.
  • test/install-codex-auth.test.ts:153-201 should also cover a same-id collision case, e.g. gpt-5.5 in both template and user config with different sub-fields, to pin the shallow per-id merge in scripts/install-codex-auth.js:211-229.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/install-codex-auth.test.ts` around lines 153 - 201, Update the temp-root
teardown in test/install-codex-auth.test.ts to use the existing
removeWithRetry() helper instead of rmSync, covering Windows EBUSY, EPERM, and
ENOTEMPTY failures. Extend the upgrade test “adds newly shipped template models
on upgrade while preserving user model customizations” with a same-ID collision
for gpt-5.5 containing different template and user sub-fields, then assert the
resulting model preserves the user fields while incorporating template fields,
covering the shallow per-ID merge implemented by the install logic.

Source: Path instructions

Comment thread test/quota-probe.test.ts
Comment on lines +33 to +36
import {
DEFAULT_MODEL,
DEFAULT_PROBE_MODEL,
} from "../lib/request/helpers/model-map.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

model-swap assertions look correct, but nothing here locks in the reasoning-effort selection.

both tests only check snapshot.model / getCodexInstructionsMock args, not the reasoning.effort field of the request body actually sent. since fetchMock is a mock, assert the second argument's body (parsed) has reasoning.effort === "low" on the DEFAULT_PROBE_MODEL attempt and "none" on the DEFAULT_MODEL attempt — this is the exact contract resolveProbeReasoningEffort is supposed to guarantee and it's currently untested end-to-end.

as per path instructions, "test/**: tests must stay deterministic and use vitest. demand regression cases..." — this is exactly the kind of regression case worth locking in given test/quota-probe.test.ts:102-114.

Also applies to: 91-91, 102-114, 130-130, 144-147

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/quota-probe.test.ts` around lines 33 - 36, Update the quota probe tests
around the DEFAULT_PROBE_MODEL and DEFAULT_MODEL attempts to inspect fetchMock’s
request body, parse the second argument body, and assert reasoning.effort is
"low" for the probe model and "none" for the default model. Preserve the
existing model and instruction assertions while adding these deterministic
Vitest regression checks covering resolveProbeReasoningEffort.

Source: Path instructions

Comment on lines +4 to +7
import {
DEFAULT_MODEL,
DEFAULT_PROBE_MODEL,
} from "../lib/request/helpers/model-map.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

same gap as test/quota-probe.test.ts: no assertion on the sent reasoning.effort.

mechanically the model-swap here is fine, but see the note on test/quota-probe.test.ts:102-114 — add the equivalent body assertion here too since fetchRuntimeCodexQuotaSnapshot builds its probe body independently.

Also applies to: 49-49, 97-97

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/runtime-quota-probe.test.ts` around lines 4 - 7, Add assertions in the
runtime quota probe tests covering the sent request body's reasoning.effort
value, matching the equivalent assertions in test/quota-probe.test.ts. Update
the cases around the DEFAULT_MODEL, DEFAULT_PROBE_MODEL, and
fetchRuntimeCodexQuotaSnapshot probe body construction to verify the expected
effort is included.

Source: Path instructions

ndycode and others added 4 commits July 11, 2026 06:32
…test (#626)

The `codex-multi-auth-codex` wrapper re-implements the model map (it runs before
the TypeScript build) and never gained the 2.5.0 GPT-5.6 work, so a
`gpt-5.6-*` request through the wrapper mis-bucketed its family, mis-coerced
reasoning effort, and canonicalized to gpt-5.5. Mirror lib faithfully:

- Add the `max`/`ultra` effort fallbacks (without auto-aliasing them onto
  general models, matching lib's REASONING_VARIANTS).
- Add the Sol/Terra/Luna tiers, their supported-effort sets, effort aliases
  (none/minimal excluded; ultra Sol/Terra only), and a `resolveGpt56*` fallback
  so unrecognised 5.6 ids resolve to a 5.6 tier instead of silently to 5.5.
- Rewrite `ultra` -> `max` on the wire, and bucket 5.6 into the gpt-5.2 family.
- No 5.6 unsupported-model fallback chain (deliberate, matches lib).

To make the wrapper testable without launching Codex, guard the top-level
`main()` behind an import-only flag and export the model helpers. New
test/codex-model-resolution.test.ts pins the behaviour and asserts wrapper<->lib
parity across a model x effort matrix so this duplication cannot drift again.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
#628)

`pidOffsetEnabled` gives each `codex-multi-auth-codex` process a small
deterministic account-selection bias so parallel agents spread across accounts
instead of all hammering one and cascading into 429s. It was purpose-built for
the multi-process swarm case but shipped off by default; turn it on.

It is a no-op for single-account pools, and a manual pin plus health/quota
scoring still take precedence over the small offset. Tests pin it off in the
global sandbox for deterministic account-selection assertions (its own behaviour
is covered by rotation.test.ts); the production default is asserted in
plugin-config.test.ts. Docs updated, plus an upgrade-path troubleshooting entry
for stale model pickers (#626).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…kend

Live probing against a real ChatGPT (pro) account shows the `/codex/responses`
quota headers return HTTP 200 for `gpt-5.6-sol` with effort `none` OR `low`, so
the earlier "GPT-5.6 rejects none upstream" wording was inaccurate. The probe
still resolves the cheapest effort each model *declares* (5.6 tiers and codex
models omit `none`), which keeps the probe consistent with normal request
routing (getReasoningConfig) and within each model's documented range — a
correctness/alignment improvement, not a rejection workaround. Behaviour and
tests are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Neither is a product bug; both only fail on Windows dev checkouts and pass in
the project's Linux CI:

- ci-workflows.test.ts: extractJobBlock's `:\n` job-boundary regex never matches
  CRLF (`:\r\n`) checkouts, so it over-captures to EOF and the `not.toContain`
  assertion picks up a neighbouring job. Normalize CRLF->LF on read.
- runtime-rotation-proxy.test.ts: the 513-sequential-loopback-request eviction
  test exceeds the 5s default timeout on slower machines. Give it 30s; the
  assertions are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ndycode
ndycode merged commit d56e050 into main Jul 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant