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

Skip to content

Fix live account checks and default probe model - #506

Merged
ndycode merged 10 commits into
ndycode:mainfrom
Chummy26:fix/gpt55-default-live-probes
Jun 3, 2026
Merged

ndycode merged 10 commits into
ndycode:mainfrom
Chummy26:fix/gpt55-default-live-probes

Conversation

@Chummy26

@Chummy26 Chummy26 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • set gpt-5.5 as the default live/quota probe model, while keeping legacy Codex fallback compatibility
  • report Codex-unavailable accounts as signed-in only instead of working
  • include the Codex plugin manifest in the packed package and keep icon packaging covered by tests
  • update integrations/default prompt handling and README examples to match the new default

Verification

  • npm test -- --run test/codex-manager-cli.test.ts test/codex-manager-help.test.ts test/quota-probe.test.ts test/codex-manager-integrations-command.test.ts
  • npm test -- --run test/codex-prompts.test.ts test/documentation.test.ts test/runtime-rotation-proxy.test.ts
  • npm test -- --run test/runtime-quota-probe.test.ts test/runtime-account-check.test.ts test/repair-commands.test.ts test/package-bin.test.ts test/check-pack-budget.test.ts test/plugin-manifest.test.ts
  • npm run typecheck
  • npm run pack:check

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

this pr promotes gpt-5.5 as the default live/quota probe model, unifies both the manager and runtime probe fallback chains into a single QUOTA_PROBE_MODEL_CHAIN constant, corrects the misleading "signed in and working" label for codex-unavailable accounts, adds exact-file validation for the plugin manifest in npm pack budgets, and hardens --model flag parsing across all command modules to reject flag-like next-arg values.

  • default probe model + chain unification: DEFAULT_MODEL = \"gpt-5.5\" and QUOTA_PROBE_MODEL_CHAIN = [gpt-5.5, gpt-5.4, gpt-5.3-codex, ...] exported from model-map.ts; both lib/quota-probe.ts and lib/runtime/quota-probe.ts now import the same list, eliminating drift between the manager and runtime probe paths.
  • live account status semantics: CodexUnavailableError and probe-skip paths now land in signedInOnly (not ok), and the live summary shows codexAvailable | signed in only | need re-login instead of a single "working" bucket, making plan-access failures visible at a glance.
  • pack budget + plugin manifest: .codex-plugin/plugin.json added to package.json files field and to REQUIRED_FILES (exact-path check); README.md and LICENSE migrated from prefix-match to exact-match, closing a bug where README.md.bak could satisfy the README requirement.

Confidence Score: 5/5

safe to merge; all changed paths have corresponding test coverage and the runtime-rotation fallback model logic is correctly preserved

the logic change is well-contained — a constant rename, a label correction, and a pack-budget exact-file gate. the probe chain unification eliminates an existing drift risk. the two minor observations (dead ok tracking in live mode, missing absence-tests for README/LICENSE) don't affect runtime correctness

lib/codex-manager.ts (dead ok counter in live path) and test/check-pack-budget.test.ts (no test for absent README.md or LICENSE)

Important Files Changed

Filename Overview
lib/request/helpers/model-map.ts adds DEFAULT_MODEL = gpt-5.5 and QUOTA_PROBE_MODEL_CHAIN as single source of truth for the ordered probe fallback list; clean change
lib/codex-manager.ts live summary switched to codexAvailable/signedInOnly/failed counters; ok variable is still incremented in live mode but never displayed or used in the live path
lib/quota-probe.ts switches DEFAULT_QUOTA_PROBE_MODELS to import QUOTA_PROBE_MODEL_CHAIN; probe now leads with gpt-5.5 and includes gpt-5.4 before legacy codex models
lib/runtime/quota-probe.ts QUOTA_PROBE_MODELS unified with manager probe via shared QUOTA_PROBE_MODEL_CHAIN; eliminates drift between runtime and manager probe chains
lib/runtime-rotation-proxy.ts model-less /codex/responses requests correctly fall back to CURRENT_CODEX_MODEL (gpt-5.3-codex) rather than DEFAULT_MODEL to preserve codex family bucketing; comment explains the rationale
scripts/check-pack-budget-lib.js adds REQUIRED_FILES array with exact-path matching for plugin.json, README.md, and LICENSE; fixes a prior bug where README.md.bak could satisfy README.md via prefix matching
test/check-pack-budget.test.ts adds tests for exact-file match enforcement for plugin.json and the .bak-sibling corner case; README.md and LICENSE absence paths remain untested under the new exact-file logic
lib/integration-generators.ts removes local DEFAULT_MODEL = gpt-5.3-codex constant; imports shared DEFAULT_MODEL (gpt-5.5) from model-map instead
package.json adds .codex-plugin/plugin.json to the files array so the plugin manifest is included in npm pack output

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[runHealthCheck liveProbe=true] --> B{usable token?}
    B -- yes --> C{accountId present?}
    B -- no --> D[queuedRefresh]
    D -- success --> C
    D -- fail + sessionValid --> E[warnings++ signedInOnly++]
    D -- fail session dead --> F[failed++]
    C -- no --> G[ok++ warnings++ signedInOnly++ tone=warning]
    C -- yes --> H[fetchCodexQuotaSnapshot via QUOTA_PROBE_MODEL_CHAIN]
    H --> I{probe result}
    I -- success --> J[ok++ codexAvailable++ tone=success]
    I -- CodexUnavailableError --> K[ok++ warnings++ signedInOnly++ tone=warning]
    I -- other error --> K
    E --> M[live summary]
    F --> M
    J --> M
    K --> M
    G --> M
    M --> N[codexAvailable - signed in only - need re-login]
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
lib/codex-manager.ts:2204-2207
**`ok` counter is dead code in live probe mode**

in live mode the result summary uses `codexAvailable`, `signedInOnly`, and `failed` exclusively — `ok` is still incremented but never read or displayed in that path. the variable isn't harmful, but it adds cognitive load when tracing the live-mode counter semantics. consider dropping `ok += 1` from the fresh-token and refresh-success branches when `liveProbe` is true, or adding a brief comment that `ok` is only meaningful in non-live mode.

### Issue 2 of 2
test/check-pack-budget.test.ts:857-873
**missing vitest coverage for absent README.md and LICENSE under new exact-match logic**

`README.md` and `LICENSE` moved from `REQUIRED_PREFIXES` (prefix match) to `REQUIRED_FILES` (exact `Array.includes`). the new tests only cover `.codex-plugin/plugin.json` absence and the `.bak`-sibling edge case. there are no cases that drop `README.md` or `LICENSE` from the paths list and assert the validation throws — so a regression that silently drops them from `REQUIRED_FILES` wouldn't be caught.

Reviews (10): Last reviewed commit: "refactor(#506): single probe-chain const..." | Re-trigger Greptile

@Chummy26
Chummy26 requested a review from ndycode as a code owner June 3, 2026 06:13
@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 Jun 3, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

pr centralizes DEFAULT_MODEL across cli and runtime, tightens --model parsing, replaces inline quota-probe lists with a shared chain, extends runHealthCheck with codexAvailable/signedInOnly and tone-aware rendering, adds .codex-plugin/plugin.json to package files, and updates tests.

Changes

model upgrade and health-check metrics

Layer / File(s) Summary
shared default imports and model-map
lib/request/helpers/model-map.ts:84, lib/codex-manager.ts:132, lib/runtime-rotation-proxy.ts:36, lib/integration-generators.ts:1, lib/prompts/codex.ts:8
introduces QUOTA_PROBE_MODEL_CHAIN, DEFAULT_MODEL, and CURRENT_CODEX_MODEL and consumes them across modules.
cli defaults and parse validation
lib/codex-manager/help.ts:1, lib/codex-manager/commands/best.ts:3, lib/codex-manager/commands/forecast.ts:17, lib/codex-manager/commands/report.ts:28, lib/codex-manager/forecast-report-commands.ts:22, lib/codex-manager/repair-commands.ts:43, lib/codex-manager/commands/integrations.ts:71, lib/codex-manager/commands/models.ts:46, README.md:199, test/codex-manager-help.test.ts:94, test/repair-commands.test.ts:165
help text and defaults now reference DEFAULT_MODEL; --model parsing rejects missing, blank, or flag-like values for both --model <value> and --model=<value> forms and preserves explicit modelProvided semantics.
quota probe and runtime defaults
lib/quota-probe.ts:57, lib/runtime/quota-probe.ts:4, lib/runtime-rotation-proxy.ts:729, lib/integration-generators.ts:17, lib/prompts/codex.ts:237
quota-probe candidates and runtime family fallbacks now derive from shared constants (QUOTA_PROBE_MODEL_CHAIN, CURRENT_CODEX_MODEL, DEFAULT_MODEL).
live health-check metrics and per-account tone rendering
lib/codex-manager.ts:2183, lib/codex-manager.ts:2204, lib/codex-manager.ts:2240, lib/codex-manager.ts:2273, lib/codex-manager.ts:2381, lib/codex-manager.ts:2471
runHealthCheck adds codexAvailable and signedInOnly counters, classifies missing account-id and CodexUnavailableError as signed-in-only, uses tone-aware markers in per-account output, and updates live summary formatting to include the new counters.
package manifest and pack validation
package.json:123, scripts/check-pack-budget-lib.js:16
adds .codex-plugin/plugin.json to published files, introduces REQUIRED_FILES to require exact plugin manifest and updates pack validation to error on missing exact paths.

test coverage and updates

Layer / File(s) Summary
unit and integration tests updated for defaults
test/quota-probe.test.ts:88, test/runtime-quota-probe.test.ts:46, test/codex-prompts.test.ts:121, test/codex-manager-integrations-command.test.ts:19
adds/updates tests asserting DEFAULT_MODEL is used when model is omitted and that prompt selection aligns with updated families.
codex-manager cli tests and auth-report expectations
test/codex-manager-cli.test.ts:746, test/codex-manager-help.test.ts:118, test/codex-manager-forecast-command.test.ts:141, test/codex-manager-report-command.test.ts:96, test/repair-commands.test.ts:165
updates tests to expect DEFAULT_MODEL defaults, adds negative parsing tests rejecting flag-like/blank model values, and adds live-probe behavior tests (CodexUnavailableError and signed-in-only classification).
package validation and docs tests
test/check-pack-budget.test.ts:111, test/package-bin.test.ts:17, test/documentation.test.ts:340
adds negative tests for missing plugin manifest, updates fixtures to include .codex-plugin/plugin.json, and updates README example assertions to use DEFAULT_MODEL.

sequence diagram(s)

sequenceDiagram
  participant cli as cli
  participant manager as lib/codex-manager
  participant probe as quota-probe
  participant runtime as runtime-rotation-proxy
  cli->>manager: parse --model (defaults to DEFAULT_MODEL)
  manager->>probe: fetchCodexQuotaSnapshot(model=DEFAULT_MODEL)
  probe-->>manager: quota snapshot or error
  manager->>runtime: use CURRENT_CODEX_MODEL for family fallback when needed
  manager->>cli: render per-account rows with healthTone and codexAvailable/signedInOnly counters
Loading

estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

possibly related PRs

suggested labels

bug

suggested reviewers

  • ndycode

notes and reviewer flags:

  • missing regression test: add a focused regression that verifies final formatted summary when liveProbe is true includes codexAvailable and signedInOnly counters and tone selection. see lib/codex-manager.ts:2471 and test/codex-manager-cli.test.ts:3280-3352.
  • windows edge cases: pack validation now requires exact .codex-plugin/plugin.json path. confirm scripts/check-pack-budget-lib.js:16-30 and test/check-pack-budget.test.ts:111 handle windows path separators and case sensitivity.
  • concurrency risks: runHealthCheck introduces per-run counters and parallel per-account probes. inspect concurrent updates around lib/codex-manager.ts:2183 and lib/codex-manager.ts:2381 to ensure counters remain local and are not mutated across parallel tasks.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title follows conventional commits format (fix: lowercase imperative) and is 47 characters, well under 72-char limit, accurately summarizing the main changes.
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 PR description comprehensively documents changes: default model unification (gpt-5.5), live account status semantics fix, pack budget validation with exact-file matching, and CLI parsing hardening.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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 and usage tips.

Set gpt-5.5 as the default live/quota probe model while keeping legacy Codex fallback compatibility.

Report Codex-unavailable accounts as signed-in only instead of working, and package the plugin manifest/icon.
Comment thread lib/codex-manager.ts Outdated
@Chummy26
Chummy26 force-pushed the fix/gpt55-default-live-probes branch from 0175d1c to 49857fd Compare June 3, 2026 06:20
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

let me handle this real quick, will release on next ver :)

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
lib/codex-manager/commands/forecast.ts (1)

175-185: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

reject flag-like values after --model.

lib/codex-manager/commands/forecast.ts:175-185 currently accepts the next flag as the model value. codex-multi-auth forecast --model --json will silently consume --json, drop json mode, and then fall back through resolveNormalizedModel() instead of reporting a missing value. please reject next args that start with -, the same way lib/codex-manager/help.ts:85-104 already does for --org, and add a regression for this exact case in the forecast command tests.

🤖 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/codex-manager/commands/forecast.ts` around lines 175 - 185, The argument
parsing for --model (both short "-m" branch and "--model=" fallback) must reject
flag-like values: when handling the "-m" form, check the next token (args[i+1])
and if it is missing or startsWith("-") return { ok: false, message: "Missing
value for --model" } instead of consuming it; similarly, for the "--model=" case
ensure the extracted value isn't a flag-like string (startsWith("-")) and reject
it; mirror the validation behavior used in help.ts for --org and add a
unit/integration test reproducing "codex-multi-auth forecast --model --json" to
assert it fails with the missing-value error rather than consuming --json.
lib/codex-manager.ts (1)

2537-2554: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

reject flag-like values after --model.

lib/codex-manager.ts:2537-2554 treats the next token as a model unconditionally. codex-multi-auth best --model --live will consume --live as the model and surface the wrong error path instead of reporting a missing value. please reject next args that start with -, matching the stricter handling already used in lib/codex-manager/help.ts:85-104, and cover it through the actual best command path.

🤖 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/codex-manager.ts` around lines 2537 - 2554, The parser block handling the
"--model" / "-m" flags treats the next token unconditionally as the model and
should reject flag-like values; when taking const value = args[i+1] (for
"--model" or "-m") verify value exists and does NOT startWith("-") and otherwise
return the missing-value error, and for the "--model=" branch also reject values
that begin with "-" after trimming; update the logic that sets options.model and
options.modelProvided (and increments i) accordingly to mirror the stricter
validation used in the help parsing (help.ts lines handling flags) so flag-like
tokens like "--live" are not consumed as model names.
test/runtime-quota-probe.test.ts (1)

50-95: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

add a regression assertion for probe model attempt order

this test only checks the final winning model. please also assert the first attempt is gpt-5.5 and fallback is gpt-5.4, so a default-model regression cannot pass silently. see test/runtime-quota-probe.test.ts:50 and test/runtime-quota-probe.test.ts:93.

proposed test hardening
 it("falls back to the next model when the first one is unsupported", async () => {
+		const getCodexInstructions = vi.fn(async (model: string) => `instructions:${model}`);
 		const fetchImpl = vi
 			.fn()
 			.mockResolvedValueOnce(
@@
 		const snapshot = await fetchRuntimeCodexQuotaSnapshot({
@@
-			getCodexInstructions: async (model: string) => `instructions:${model}`,
+			getCodexInstructions,
@@
 		expect(snapshot.model).toBe("gpt-5.4");
 		expect(fetchImpl).toHaveBeenCalledTimes(2);
+		expect(getCodexInstructions).toHaveBeenNthCalledWith(1, "gpt-5.5");
+		expect(getCodexInstructions).toHaveBeenNthCalledWith(2, "gpt-5.4");
 	});

As per coding guidelines test/**: tests must stay deterministic and demand regression cases that reproduce behavior changes.

🤖 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 50 - 95, The test must also
assert the probe attempted gpt-5.5 first and then fell back to gpt-5.4 to
prevent silent default-model regressions; update the test around
fetchRuntimeCodexQuotaSnapshot to inspect fetchImpl call arguments (or the
mocked getCodexInstructions inputs) and add two expectations: that the first
fetch/generation used instructions:gpt-5.5 and the second used
instructions:gpt-5.4 (i.e., verify fetchImpl.mock.calls[0] includes
"instructions:gpt-5.5" and fetchImpl.mock.calls[1] includes
"instructions:gpt-5.4" or assert the getCodexInstructions mock was called with
"gpt-5.5" then "gpt-5.4"). Ensure you reference the existing fetchImpl and
getCodexInstructions used in the fetchRuntimeCodexQuotaSnapshot invocation.
🤖 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 `@lib/codex-manager.ts`:
- Around line 2398-2402: When sessionLikelyValid is true and liveProbe is set,
don't increment signedInOnly immediately; first attempt a live probe using
fetchCodexQuotaSnapshot with the existing account.accessToken and only count as
signed-in-only if that probe fails; update the logic around sessionLikelyValid /
liveProbe / signedInOnly to fall back to the current token before treating
refresh failures as unavailable. Also add a regression test covering the
scenario where token refresh fails transiently but the existing accessToken
still allows fetchCodexQuotaSnapshot (i.e., refresh error + usable token + live
probe) to ensure codexAvailable is correctly counted.

In `@scripts/check-pack-budget-lib.js`:
- Around line 16-18: The REQUIRED_PREFIXES array currently mixes exact file
paths with directory prefixes causing validatePackMetadata() to use startsWith
for everything; change the design by splitting REQUIRED_PREFIXES into two
constants (e.g., REQUIRED_FILES for exact paths like ".codex-plugin/plugin.json"
and REQUIRED_PREFIXES for directory prefixes like "dist/"), update
validatePackMetadata() to check equality for items in REQUIRED_FILES and
startsWith for items in REQUIRED_PREFIXES, and add a regression test in
test/check-pack-budget.test.ts (around the existing test at line ~112) that
ensures ".codex-plugin/plugin.json.bak" does not satisfy the exact-file
requirement.

In `@test/codex-manager-help.test.ts`:
- Around line 92-100: The test exercises the helper parseBestArgs but the
shipped "best" command uses a duplicated parser in lib/codex-manager.ts, so
either dedupe by exporting/centralizing parseBestArgs and have the command use
that single implementation (replace the duplicate parser in the command wiring
with a call to parseBestArgs), or add an integration test that exercises the
actual command path (call runBestCommand or invoke the CLI entry that wires the
"best" command) to cover the parser used at runtime; update imports/usages so
parseBestArgs is the single source of truth or add tests invoking
runBestCommand/CLI to prevent future drift.

---

Outside diff comments:
In `@lib/codex-manager.ts`:
- Around line 2537-2554: The parser block handling the "--model" / "-m" flags
treats the next token unconditionally as the model and should reject flag-like
values; when taking const value = args[i+1] (for "--model" or "-m") verify value
exists and does NOT startWith("-") and otherwise return the missing-value error,
and for the "--model=" branch also reject values that begin with "-" after
trimming; update the logic that sets options.model and options.modelProvided
(and increments i) accordingly to mirror the stricter validation used in the
help parsing (help.ts lines handling flags) so flag-like tokens like "--live"
are not consumed as model names.

In `@lib/codex-manager/commands/forecast.ts`:
- Around line 175-185: The argument parsing for --model (both short "-m" branch
and "--model=" fallback) must reject flag-like values: when handling the "-m"
form, check the next token (args[i+1]) and if it is missing or startsWith("-")
return { ok: false, message: "Missing value for --model" } instead of consuming
it; similarly, for the "--model=" case ensure the extracted value isn't a
flag-like string (startsWith("-")) and reject it; mirror the validation behavior
used in help.ts for --org and add a unit/integration test reproducing
"codex-multi-auth forecast --model --json" to assert it fails with the
missing-value error rather than consuming --json.

In `@test/runtime-quota-probe.test.ts`:
- Around line 50-95: The test must also assert the probe attempted gpt-5.5 first
and then fell back to gpt-5.4 to prevent silent default-model regressions;
update the test around fetchRuntimeCodexQuotaSnapshot to inspect fetchImpl call
arguments (or the mocked getCodexInstructions inputs) and add two expectations:
that the first fetch/generation used instructions:gpt-5.5 and the second used
instructions:gpt-5.4 (i.e., verify fetchImpl.mock.calls[0] includes
"instructions:gpt-5.5" and fetchImpl.mock.calls[1] includes
"instructions:gpt-5.4" or assert the getCodexInstructions mock was called with
"gpt-5.5" then "gpt-5.4"). Ensure you reference the existing fetchImpl and
getCodexInstructions used in the fetchRuntimeCodexQuotaSnapshot invocation.
🪄 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: bc871d17-1a6b-4d0e-ad4c-7241a8ae9524

📥 Commits

Reviewing files that changed from the base of the PR and between c02494b and 0175d1c.

📒 Files selected for processing (24)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/runtime-quota-probe.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (13)
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/codex-manager-integrations-command.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/best.ts
  • test/quota-probe.test.ts
  • lib/runtime/quota-probe.ts
  • test/codex-manager-help.test.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/codex-manager.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/best.ts
  • test/quota-probe.test.ts
  • lib/runtime/quota-probe.ts
  • test/codex-manager-help.test.ts
  • scripts/check-pack-budget-lib.js
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/codex-manager.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/codex-manager-integrations-command.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (README.md)

Implement whole-pool replay as disabled by default when every account is rate-limited

Use bounded outbound request budgets so one prompt cannot walk through the entire account pool indefinitely

Trigger cooldown instead of continuing aggressive rotation when repeated cross-account 5xx bursts occur

Stagger proactive refresh to reduce background refresh bursts across the account pool

Set runtime rotation as enabled by default for request-bearing wrapper-launched Codex sessions

Perform best-effort daily npm version checks during normal forwarded Codex startup, printing manual notices only on interactive TTY or when CODEX_MULTI_AUTH_DEBUG=1

Never run npm install or update commands automatically; only notify users to run npm install -g codex-multi-auth@latest manually

Make non-destructive settings changes in the Experimental section: sync previews before apply, preserve destination-only accounts, and fail safely on filename collisions

Files:

  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/best.ts
  • test/quota-probe.test.ts
  • lib/runtime/quota-probe.ts
  • test/codex-manager-help.test.ts
  • scripts/check-pack-budget-lib.js
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/codex-manager.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-integrations-command.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.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
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/best.ts
  • lib/runtime/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • lib/codex-manager.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/commands/best.ts
  • lib/runtime/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • lib/codex-manager.ts
scripts/*.js

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors

Files:

  • scripts/check-pack-budget-lib.js
lib/runtime-rotation-proxy.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/runtime-rotation-proxy.ts: Runtime rotation code must preserve pass-through semantics except for auth/provider headers that intentionally change
Runtime proxy client-facing headers must not expose account emails or tokens
Runtime rotation should fail open to normal official Codex forwarding when startup helpers are unavailable
Never add account emails/tokens to runtime proxy client responses

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

Files:

  • lib/runtime-rotation-proxy.ts
package.json

📄 CodeRabbit inference engine (SECURITY.md)

package.json: Pin hono to 4.12.18 or higher (but below 4.12.0-4.12.1) to avoid GHSA-xh87-mx6m-69f3 authentication bypass vulnerability
Pin rollup to ^4.59.0 or higher to avoid vulnerable versions below 4.59.0 in Vite and Vitest transitive dependencies

Files:

  • package.json
test/**/documentation.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test documentation parity including command flags, config precedence, changelog policy, and governance rules

Files:

  • test/documentation.test.ts
test/**/codex-manager-cli.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test CLI settings with question cancellation across all 5 panels and EBUSY/concurrent race conditions

Files:

  • test/codex-manager-cli.test.ts
🧠 Learnings (34)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth doctor --fix` to automatically repair Codex CLI multi-account install and routing issues
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Validate configuration after making changes to settings with `codex-multi-auth status`, `codex-multi-auth check`, and `codex-multi-auth forecast --live`
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Use `CODEX_MULTI_AUTH_DIR` environment variable to override the default settings and accounts root directory
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Keep OAuth credentials local and only use loopback-only runtime rotation for account switching in forwarded Codex sessions
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Do not patch official Codex app binaries; instead use reversible packaged Codex app bind and user-level launcher routing helpers
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Enable `backgroundResponses` in settings only for callers that intentionally send `background: true` requests
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Keep `codex` command owned by the official OpenAI install path; use `codex-multi-auth-codex` wrapper only when intentionally choosing wrapper-launched sessions
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Maintain session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Document error contracts using strict Codex-oriented request/prompt compatibility and runtime handling
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Run `codex-multi-auth doctor --fix` followed by `codex-multi-auth check` and `codex-multi-auth forecast --live` as the primary recovery sequence
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:14:10.413Z
Learning: Use `codex-multi-auth login --device-auth` for remote or headless shells instead of browser-based login
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{builder,error,response}*.test.{ts,js} : Write unit tests for invalidation body builder covering all message-extraction branches: top-level message, nested error.message, top-level-wins priority, blank-to-nested fallback, non-JSON body, and no-usable-message fallback

Applied to files:

  • test/codex-manager-integrations-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`

Applied to files:

  • lib/codex-manager/commands/best.ts
  • README.md
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models

Applied to files:

  • lib/codex-manager/commands/best.ts
  • README.md
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-prompts.test.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Applied to files:

  • lib/codex-manager/commands/best.ts
  • test/quota-probe.test.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/prompts/codex.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Include outputs from `codex-multi-auth report --json`, `codex-multi-auth doctor --json`, version commands, and full terminal output when opening bug reports for codex-multi-auth issues

Applied to files:

  • README.md
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth doctor --fix` to automatically repair Codex CLI multi-account install and routing issues

Applied to files:

  • README.md
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/runtime-observability.json : Store runtime observability metrics in `~/.codex/multi-auth/runtime-observability.json` and expose them via `codex-multi-auth status` and `codex-multi-auth report --json` commands

Applied to files:

  • README.md
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Provide machine-readable JSON output from diagnostic commands via `--json` flags for `status`, `report`, `verify-flagged`, `check`, `doctor`, `monitor`, and `why-selected` to enable automation

Applied to files:

  • README.md
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,401}*.test.{ts,js} : Write unit tests covering upstream-401 invalidation path (401 to client, ~5-minute cooldown, clears affinity, no rotation) and regression guard for generic 401 rotation

Applied to files:

  • test/quota-probe.test.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/quota-cache.json : Implement quota caching in `~/.codex/multi-auth/quota-cache.json` for account quota forecasting and health-aware selection

Applied to files:

  • test/quota-probe.test.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-constants.ts : Use canonical runtime provider id `codex-multi-auth-runtime-proxy` in runtime constants

Applied to files:

  • lib/runtime/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*resolver*.js : The Codex bin resolver must skip any PATH candidate inside its own wrapper directory

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/rotation.ts : Runtime rotation is default-on through `codexRuntimeRotationProxy`; respect `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0` opt-out

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-rotation-proxy.ts : Do not expose account emails or tokens in runtime proxy client response headers or logs

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/proxy*.{js,ts,tsx} : Bind runtime rotation proxy and local bridge to loopback-only with no opt-out; never forward inbound client credentials (`authorization`, `x-api-key`, `cookie`, `proxy-authorization`) upstream alongside the managed token

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: The runtime rotation proxy is loopback-only, uses per-process client token, and forwards only Responses API and model discovery requests

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/**/.codex/multi-auth/settings.json : Settings JSON file must conform to the canonical shape including `version`, `dashboardDisplaySettings`, and `pluginConfig` objects

Applied to files:

  • package.json
  • test/check-pack-budget.test.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Implement three distinct global binaries: `codex-multi-auth` for primary account management, `codex-multi-auth-codex` as optional forwarding wrapper, and `codex-multi-auth-app-launcher` as optional desktop launcher helper

Applied to files:

  • package.json
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/logs/codex-plugin/** : Store application logs in `~/.codex/multi-auth/logs/codex-plugin/` directory for debugging and diagnostics

Applied to files:

  • package.json
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Canonical package name is `codex-multi-auth` and canonical command family is `codex-multi-auth ...`

Applied to files:

  • package.json
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth uninstall` before running `npm uninstall -g codex-multi-auth` to ensure complete cleanup of residual artifacts including plugin entries, cached modules, OS launchers, and app-bind state

Applied to files:

  • package.json
📚 Learning: 2026-06-03T06:06:38.259Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/README.md:0-0
Timestamp: 2026-06-03T06:06:38.259Z
Learning: Applies to docs/**/*.md : Documentation files must follow the directory structure and navigation hierarchy defined in the codex-multi-auth documentation portal, with primary sections organized as: Start Here, Daily Use, Release History, Repair, Reference, Maintainer Docs, and Governance

Applied to files:

  • package.json
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to docs/**/*.md : Maintain command-line help and documentation in markdown files at `docs/` directory with reference sections for commands, public API, error contracts, settings, and storage paths

Applied to files:

  • test/documentation.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/request/request-transformer.ts : Forward non-auth commands to official Codex CLI without reimplementing general Codex commands in the wrapper

Applied to files:

  • test/documentation.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/cache*.{js,ts,tsx} : Verify cached Codex instructions with SHA-256 digest; discard tampered cache, treat legacy entries without recorded digest as unverified, and never fast-path serve or drive conditional revalidation on unverified bytes

Applied to files:

  • test/codex-prompts.test.ts
  • test/package-bin.test.ts
  • lib/prompts/codex.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*cache*.js : Codex CLI state cache must honor forceRefresh even with a load in flight, guarded by load generation to prevent stale reads from overwriting fresh snapshots

Applied to files:

  • test/codex-prompts.test.ts
  • lib/prompts/codex.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{refresh,error,builder,auth}*.test.{ts,js} : Write unit tests covering refresh-endpoint invalidation returning code: "token_invalidated" routed through shared body builder

Applied to files:

  • test/codex-prompts.test.ts
  • test/codex-manager-cli.test.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{config,rotation,schema}*.test.{ts,js} : Write tests for minRotationIntervalMs sliding-anchor and sticky-window coverage; schema and config coverage for new knobs with min(0), allows-zero, rejects-string validation

Applied to files:

  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/fetch*.{js,ts,tsx} : Bound prompt and release-metadata fetches with connect and body timeouts that actually cancel stalled body reads

Applied to files:

  • lib/prompts/codex.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*forecast*.js : Forecast recommendations must exclude policy-blocked and token-exhausted accounts, returning no recommendation with a clear reason when none are available

Applied to files:

  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Keep recommended defaults enabled: `menuAutoFetchLimits`, `menuSortEnabled`, `liveAccountSync`, `sessionAffinity`, `proactiveRefreshGuardian`, and `preemptiveQuotaEnabled`

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*status*.js : Account status tone determination must consider the entire detail string, not just segments within parentheses, to ensure failed health checks always render as failures

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-02T04:49:43.051Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: SECURITY.md:0-0
Timestamp: 2026-06-02T04:49:43.051Z
Learning: Implement refresh-token lifecycle management and account health isolation in OAuth credential handling

Applied to files:

  • lib/codex-manager.ts
🔇 Additional comments (12)
lib/codex-manager/commands/report.ts (1)

130-130: LGTM!

Also applies to: 144-144, 308-308

lib/codex-manager/forecast-report-commands.ts (1)

106-106: LGTM!

Also applies to: 120-120, 130-130, 171-171

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

145-145: LGTM!

Also applies to: 197-197, 1200-1200

README.md (1)

199-199: LGTM!

test/documentation.test.ts (1)

339-339: LGTM!

test/quota-probe.test.ts (1)

87-101: LGTM!

lib/quota-probe.ts (1)

56-62: LGTM!

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

6-7: LGTM!

lib/prompts/codex.ts (1)

8-8: LGTM!

Also applies to: 237-242, 469-469

lib/runtime-rotation-proxy.ts (1)

35-35: LGTM!

Also applies to: 656-656

test/codex-prompts.test.ts (1)

121-150: LGTM!

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

748-748: LGTM!

Also applies to: 1775-1775, 2972-2972, 3058-3058, 3104-3104, 3248-3250, 3259-3330, 3381-3381, 7129-7129, 7342-7342, 7347-7347, 9909-9917

Comment thread lib/codex-manager.ts
Comment thread scripts/check-pack-budget-lib.js Outdated
Comment thread test/codex-manager-help.test.ts

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/runtime/quota-probe.ts (1)

5-11: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

add the fallback regression for the two new probe models.

lib/runtime/quota-probe.ts:5-11 prepends gpt-5.5 and gpt-5.4, but the supplied vitest coverage only proves the happy path in test/runtime-quota-probe.test.ts:18. please add a case where both new models return an unsupported-model body and the loop still falls through to gpt-5.3-codex; otherwise this retry chain can regress silently. Based on learnings: "Deprecated Codex selectors such as gpt-5-codex and gpt-5.1-codex* must be treated as compatibility aliases and retried on current documented Codex models".

🤖 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/runtime/quota-probe.ts` around lines 5 - 11, The QUOTA_PROBE_MODELS array
was extended with "gpt-5.5" and "gpt-5.4" but no regression test was added to
ensure the probe falls back when those models return an unsupported-model
response; add a test in test/runtime-quota-probe.test.ts that stubs the probe
responses for "gpt-5.5" and "gpt-5.4" to return an unsupported-model body and
asserts the loop continues and ultimately probes "gpt-5.3-codex" (verifying the
compatibility alias retry behavior for deprecated codex selectors like
gpt-5-codex/gpt-5.1-codex is preserved). Ensure the test targets the probe logic
that iterates QUOTA_PROBE_MODELS and verifies fallback behavior rather than only
the happy path.
🤖 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 `@lib/codex-manager.ts`:
- Around line 701-702: Export a single canonical DEFAULT_LIVE_PROBE_MODEL
constant from the shared codex-manager entry point (or a new codex-manager
constants module) and replace all hard-coded "gpt-5.5" fallbacks with an import
of that constant; specifically change occurrences like cachedEntry?.model ??
"gpt-5.5" and the identical fallbacks in the
best/forecast/report/repair-commands command code to use
DEFAULT_LIVE_PROBE_MODEL so help text, JSON output, and cache fallback behavior
all reference the same exported value.

In `@lib/codex-manager/help.ts`:
- Line 1: Replace the locally defined DEFAULT_LIVE_PROBE_MODEL in
lib/codex-manager/help.ts with the canonical export from the shared model
mapping module: remove the const DEFAULT_LIVE_PROBE_MODEL = "gpt-5.5" and import
the shared DEFAULT_LIVE_PROBE_MODEL (or equivalent exported name) from the
project's model mapping module so help.ts uses that single source of truth;
update any references in help.ts to use the imported symbol.
- Line 152: Add a regression test that ensures printBestUsage prints the same
default model as parseBestArgs: write a unit test that spies on console.log,
calls printBestUsage(), and asserts the logged usage string includes the value
of DEFAULT_LIVE_PROBE_MODEL (the same constant used by parseBestArgs and
exported in lib/codex-manager/help.ts), and also add an assertion that
parseBestArgs([]) yields modelProvided: false and model equal to
DEFAULT_LIVE_PROBE_MODEL to lock the wiring between printing and parsing;
reference the functions printBestUsage and parseBestArgs in the test so future
changes to defaults will fail the test if they drift.

---

Outside diff comments:
In `@lib/runtime/quota-probe.ts`:
- Around line 5-11: The QUOTA_PROBE_MODELS array was extended with "gpt-5.5" and
"gpt-5.4" but no regression test was added to ensure the probe falls back when
those models return an unsupported-model response; add a test in
test/runtime-quota-probe.test.ts that stubs the probe responses for "gpt-5.5"
and "gpt-5.4" to return an unsupported-model body and asserts the loop continues
and ultimately probes "gpt-5.3-codex" (verifying the compatibility alias retry
behavior for deprecated codex selectors like gpt-5-codex/gpt-5.1-codex is
preserved). Ensure the test targets the probe logic that iterates
QUOTA_PROBE_MODELS and verifies fallback behavior rather than only the happy
path.
🪄 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: c728be45-25ba-4f98-9998-432a00b0da6e

📥 Commits

Reviewing files that changed from the base of the PR and between 0175d1c and 49857fd.

📒 Files selected for processing (24)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/runtime-quota-probe.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (12)
package.json

📄 CodeRabbit inference engine (SECURITY.md)

package.json: Pin hono to 4.12.18 or higher (but below 4.12.0-4.12.1) to avoid GHSA-xh87-mx6m-69f3 authentication bypass vulnerability
Pin rollup to ^4.59.0 or higher to avoid vulnerable versions below 4.59.0 in Vite and Vitest transitive dependencies

Files:

  • package.json
lib/**/*.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/**/*.ts: All public exports should flow through lib/index.ts or documented package subpaths
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/best.ts
  • lib/integration-generators.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/prompts/codex.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • lib/codex-manager/commands/best.ts
  • lib/integration-generators.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • test/package-bin.test.ts
  • lib/runtime-rotation-proxy.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • lib/codex-manager/commands/best.ts
  • scripts/check-pack-budget-lib.js
  • lib/integration-generators.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • test/package-bin.test.ts
  • lib/runtime-rotation-proxy.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.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/commands/best.ts
  • lib/integration-generators.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/prompts/codex.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
scripts/*.js

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors

Files:

  • scripts/check-pack-budget-lib.js
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/package-bin.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-cli.test.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/package-bin.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.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/package-bin.test.ts
  • test/codex-manager-help.test.ts
  • test/quota-probe.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/documentation.test.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-cli.test.ts
lib/runtime-rotation-proxy.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/runtime-rotation-proxy.ts: Runtime rotation code must preserve pass-through semantics except for auth/provider headers that intentionally change
Runtime proxy client-facing headers must not expose account emails or tokens
Runtime rotation should fail open to normal official Codex forwarding when startup helpers are unavailable
Never add account emails/tokens to runtime proxy client responses

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

Files:

  • lib/runtime-rotation-proxy.ts
test/**/documentation.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test documentation parity including command flags, config precedence, changelog policy, and governance rules

Files:

  • test/documentation.test.ts
test/**/codex-manager-cli.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test CLI settings with question cancellation across all 5 panels and EBUSY/concurrent race conditions

Files:

  • test/codex-manager-cli.test.ts
🧠 Learnings (60)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/quota-cache.json : Implement quota caching in `~/.codex/multi-auth/quota-cache.json` for account quota forecasting and health-aware selection
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Installation must support multiple methods: standard npm global install, migration from legacy scoped package `ndycode/codex-multi-auth`, and verification via version commands
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Storage paths should use `~/.codex/multi-auth/` as the root directory, with customization available via `CODEX_MULTI_AUTH_DIR` environment variable
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Runtime environment overrides should be supported via environment variables including `CODEX_MULTI_AUTH_DIR`, `CODEX_MODE`, `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY`, `CODEX_TUI_V2`, and others as documented
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Account storage files must include `openai-codex-accounts.json`, `openai-codex-flagged-accounts.json`, `quota-cache.json`, and `runtime-observability.json` at the configured root path
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Project-scoped accounts must be stored under `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json`
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Commands should be organized into three categories: start-here commands (`login`, `status`, `check`), daily-use commands (`list`, `switch`, `forecast`), and advanced commands (`report`, `fix`, `doctor`, etc.)
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Dashboard hotkeys must include navigation (`Up`/`Down`), selection (`Enter`), quick-switch (`1-9`), search (`/`), help toggle (`?`), and cancel (`Q`)
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Reliability behavior must include: disabled whole-pool replay when all accounts are rate-limited, bounded outbound request budget per prompt, short cooldown on repeated cross-account 5xx bursts, and staggered proactive refresh
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Responses background mode must remain opt-in via `backgroundResponses` setting in configuration or `CODEX_AUTH_BACKGROUND_RESPONSES=1` environment variable
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Runtime rotation must be enabled by default for request-bearing wrapper-launched Codex sessions, with explicit disable via `codex-multi-auth rotation disable` command
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Installed wrappers must perform best-effort daily npm version checks during normal forwarded Codex startup, printing manual notices only on interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`, never automatically running npm install
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Experimental features in Settings menu must be non-destructive by default: sync previews before apply, preserve destination-only accounts, and fail safely on backup filename collisions
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: Official package documentation must include: getting-started guide, features overview, configuration reference, troubleshooting guide, commands reference, public API contract, error contracts, settings reference, storage paths reference, upgrade guide, and privacy policy
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: The package must publish three distinct global binaries: `codex-multi-auth` (primary account manager), `codex-multi-auth-codex` (optional forwarding wrapper), and `codex-multi-auth-app-launcher` (optional desktop launcher helper)
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T06:25:07.919Z
Learning: The package must not publish a global `codex` binary; the official Codex CLI must own the `codex` command
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Use `npm i -g codex-multi-auth` as the standard installation command; migrate users from legacy scoped prerelease `ndycode/codex-multi-auth` with `npm uninstall -g ndycode/codex-multi-auth && npm i -g codex-multi-auth`

Applied to files:

  • package.json
  • README.md
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Canonical package name is `codex-multi-auth` and canonical command family is `codex-multi-auth ...`

Applied to files:

  • package.json
  • README.md
  • test/documentation.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-constants.ts : Use canonical runtime provider id `codex-multi-auth-runtime-proxy` in runtime constants

Applied to files:

  • package.json
  • README.md
  • lib/runtime/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • test/runtime-quota-probe.test.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Implement three distinct global binaries: `codex-multi-auth` for primary account management, `codex-multi-auth-codex` as optional forwarding wrapper, and `codex-multi-auth-app-launcher` as optional desktop launcher helper

Applied to files:

  • package.json
  • README.md
  • test/documentation.test.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/openai-codex-accounts.json : Store account credentials in `~/.codex/multi-auth/openai-codex-accounts.json` with support for per-project scoping at `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json`

Applied to files:

  • package.json
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth rotation bind-app` to enable multi-account routing in packaged Codex applications

Applied to files:

  • package.json
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth uninstall` before running `npm uninstall -g codex-multi-auth` to ensure complete cleanup of residual artifacts including plugin entries, cached modules, OS launchers, and app-bind state

Applied to files:

  • package.json
  • README.md
  • test/documentation.test.ts
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth doctor --fix` to automatically repair Codex CLI multi-account install and routing issues

Applied to files:

  • package.json
  • README.md
  • lib/codex-manager/repair-commands.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Perform best-effort daily npm version checks during normal forwarded Codex startup and print manual notice only on interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`, never automatically run npm install commands

Applied to files:

  • package.json
  • README.md
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Uninstall old scoped package `ndycode/codex-multi-auth` before installing the new unscoped `codex-multi-auth` package

Applied to files:

  • package.json
  • README.md
  • test/documentation.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/scripts/mcodex.js : The mcodex launcher must be written in Node.js with zero bash dependency to ensure cross-platform compatibility on Windows and WSL environments

Applied to files:

  • package.json
  • test/documentation.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*resolver*.js : The Codex bin resolver must skip any PATH candidate inside its own wrapper directory

Applied to files:

  • package.json
  • scripts/check-pack-budget-lib.js
  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
  • test/documentation.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/scripts/mcodex.js : The launcher must canonicalize symlinks on direct-run to ensure it runs correctly when invoked through an npm-created symlink bin

Applied to files:

  • package.json
  • scripts/check-pack-budget-lib.js
  • test/documentation.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/cache*.{js,ts,tsx} : Verify cached Codex instructions with SHA-256 digest; discard tampered cache, treat legacy entries without recorded digest as unverified, and never fast-path serve or drive conditional revalidation on unverified bytes

Applied to files:

  • package.json
  • scripts/check-pack-budget-lib.js
  • test/package-bin.test.ts
  • lib/runtime-rotation-proxy.ts
  • test/check-pack-budget.test.ts
  • test/codex-prompts.test.ts
  • lib/prompts/codex.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/scripts/mcodex.js : POSIX tools like tmux and watch must be invoked as argv arrays instead of shell string interpolation to avoid shell dependency issues

Applied to files:

  • package.json
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to scripts/codex.js : Set up runtime rotation proxy through shadow CODEX_HOME and forward non-auth commands to official Codex

Applied to files:

  • package.json
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to scripts/codex-app-launcher.js : App launcher routing must not patch official Codex app binaries; use app bind or launcher helpers instead

Applied to files:

  • package.json
  • test/documentation.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to scripts/codex.js : Handle shadow CODEX_HOME with temporary provider config, state sync-back, and lock cleanup while preserving official state

Applied to files:

  • package.json
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`

Applied to files:

  • README.md
  • lib/codex-manager/commands/best.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/codex-manager/commands/report.ts
  • test/runtime-quota-probe.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models

Applied to files:

  • README.md
  • lib/codex-manager/commands/best.ts
  • lib/runtime/quota-probe.ts
  • lib/quota-probe.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-prompts.test.ts
  • test/runtime-quota-probe.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Include outputs from `codex-multi-auth report --json`, `codex-multi-auth doctor --json`, version commands, and full terminal output when opening bug reports for codex-multi-auth issues

Applied to files:

  • README.md
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/runtime-observability.json : Store runtime observability metrics in `~/.codex/multi-auth/runtime-observability.json` and expose them via `codex-multi-auth status` and `codex-multi-auth report --json` commands

Applied to files:

  • README.md
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Provide machine-readable JSON output from diagnostic commands via `--json` flags for `status`, `report`, `verify-flagged`, `check`, `doctor`, `monitor`, and `why-selected` to enable automation

Applied to files:

  • README.md
📚 Learning: 2026-06-03T06:06:38.259Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/README.md:0-0
Timestamp: 2026-06-03T06:06:38.259Z
Learning: Applies to docs/**/*.md : Documentation files must follow the directory structure and navigation hierarchy defined in the codex-multi-auth documentation portal, with primary sections organized as: Start Here, Daily Use, Release History, Repair, Reference, Maintainer Docs, and Governance

Applied to files:

  • README.md
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Local project-owned state defaults to `~/.codex/multi-auth`; official Codex state remains under `~/.codex`

Applied to files:

  • README.md
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Applied to files:

  • lib/codex-manager/commands/best.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/quota-probe.ts
  • lib/codex-manager/repair-commands.ts
  • test/quota-probe.test.ts
  • lib/codex-manager/commands/forecast.ts
  • test/documentation.test.ts
  • lib/codex-manager/commands/report.ts
  • test/runtime-quota-probe.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/path*.{js,ts,tsx} : Reject NUL-byte paths in `resolvePath` as a defense-in-depth measure

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/quota-cache.json : Implement quota caching in `~/.codex/multi-auth/quota-cache.json` for account quota forecasting and health-aware selection

Applied to files:

  • lib/runtime/quota-probe.ts
  • test/quota-probe.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{config,rotation,schema}*.test.{ts,js} : Write tests for minRotationIntervalMs sliding-anchor and sticky-window coverage; schema and config coverage for new knobs with min(0), allows-zero, rejects-string validation

Applied to files:

  • test/package-bin.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{builder,error,response}*.test.{ts,js} : Write unit tests for invalidation body builder covering all message-extraction branches: top-level message, nested error.message, top-level-wins priority, blank-to-nested fallback, non-JSON body, and no-usable-message fallback

Applied to files:

  • test/package-bin.test.ts
  • test/codex-manager-help.test.ts
  • test/check-pack-budget.test.ts
  • test/codex-prompts.test.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/rotation.ts : Runtime rotation is default-on through `codexRuntimeRotationProxy`; respect `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0` opt-out

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-rotation-proxy.ts : Do not expose account emails or tokens in runtime proxy client response headers or logs

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/proxy*.{js,ts,tsx} : Bind runtime rotation proxy and local bridge to loopback-only with no opt-out; never forward inbound client credentials (`authorization`, `x-api-key`, `cookie`, `proxy-authorization`) upstream alongside the managed token

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: The runtime rotation proxy is loopback-only, uses per-process client token, and forwards only Responses API and model discovery requests

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/account*.{js,ts,tsx} : Implement atomic, self-healing account store with checksummed WAL and temp-and-rename writes that self-heal on read when encountering torn writes

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*routing*.js : Account selection with routingMutex enabled must run inside a single reentrant mutex acquisition to prevent concurrent requests from reading the same cursor

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/config*.{js,ts,tsx} : Remove synchronous `Atomics.wait` sleeps from config load and logger directory-creation paths; use retry logic without freezing the event loop

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/account*.{js,ts,tsx} : Retry account-store WAL/temp writes, cleanup, backup operations, quota-cache, flagged-store, and export operations using shared transient-lock taxonomy (EBUSY/EPERM/ENOTEMPTY/EACCES/EAGAIN) on Windows

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to index.ts : Export optional plugin-host runtime entry for compatibility; primary product surface is account manager, wrapper, storage, runtime proxy, and repair tooling

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/storage*.{js,ts,tsx} : Validate stored message/part record ids before using them to build filesystem paths; quarantine parseable-but-unsafe ids (e.g., `../poison`) or non-numeric `time.created` values to prevent path-traversal attacks

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Maintain session affinity, live account sync, proactive refresh, and preemptive quota deferral controls for reliable multi-account routing

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{rotation,scheduler,timing,auth}*.{ts,js} : Implement minRotationIntervalMs sticky window (configurable sliding anchor via CODEX_AUTH_MIN_ROTATION_INTERVAL_MS or minRotationIntervalMs, default 60s) to boost the last-served account and reduce presenting different OAuth tokens from the same IP

Applied to files:

  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/request/request-transformer.ts : Forward non-auth commands to official Codex CLI without reimplementing general Codex commands in the wrapper

Applied to files:

  • test/codex-manager-help.test.ts
  • test/documentation.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,401}*.test.{ts,js} : Write unit tests covering upstream-401 invalidation path (401 to client, ~5-minute cooldown, clears affinity, no rotation) and regression guard for generic 401 rotation

Applied to files:

  • test/quota-probe.test.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/**/.codex/multi-auth/settings.json : Settings JSON file must conform to the canonical shape including `version`, `dashboardDisplaySettings`, and `pluginConfig` objects

Applied to files:

  • test/check-pack-budget.test.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to docs/**/*.md : Maintain command-line help and documentation in markdown files at `docs/` directory with reference sections for commands, public API, error contracts, settings, and storage paths

Applied to files:

  • test/documentation.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{refresh,error,builder,auth}*.test.{ts,js} : Write unit tests covering refresh-endpoint invalidation returning code: "token_invalidated" routed through shared body builder

Applied to files:

  • test/codex-prompts.test.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*cache*.js : Codex CLI state cache must honor forceRefresh even with a load in flight, guarded by load generation to prevent stale reads from overwriting fresh snapshots

Applied to files:

  • test/codex-prompts.test.ts
  • lib/prompts/codex.ts
  • lib/codex-manager.ts
  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/fetch*.{js,ts,tsx} : Bound prompt and release-metadata fetches with connect and body timeouts that actually cancel stalled body reads

Applied to files:

  • lib/prompts/codex.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{401,auth,handler,rotation,oauth}*.{ts,js} : Detect explicit token-invalidation responses in 401 handlers by reading response body and checking for invalidation phrases (e.g., 'invalidated oauth token', 'authentication token has been invalidated')

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,handler,401,rotation}*.{ts,js} : Distinguish token invalidation 401s from generic expired-token 401s; continue rotating for generic 401s (expired tokens, wrong credentials) but stop on explicit invalidation detection

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*{verify,bearer}*.js : Bearer token verification hot path writes to lastUsedAt must be debounced to keep steady-state verification in-memory

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,config,handler}*.{ts,js} : Apply a long cooldown (5 minutes via CODEX_AUTH_TOKEN_INVALIDATION_COOLDOWN_MS or tokenInvalidationCooldownMs) on invalidated accounts

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{error,builder,response,auth}*.{ts,js} : Emit consistent client error contract: { error: { message, code: "token_invalidated" } } for both invalidation exit paths (refresh-failure and upstream-401) through a single shared builder

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*.js : The styleQuotaSummary function must clamp out-of-range percentages to valid bounds

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*status*.js : Account status tone determination must consider the entire detail string, not just segments within parentheses, to ensure failed health checks always render as failures

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Keep recommended defaults enabled: `menuAutoFetchLimits`, `menuSortEnabled`, `liveAccountSync`, `sessionAffinity`, `proactiveRefreshGuardian`, and `preemptiveQuotaEnabled`

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-02T04:49:43.051Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: SECURITY.md:0-0
Timestamp: 2026-06-02T04:49:43.051Z
Learning: Implement refresh-token lifecycle management and account health isolation in OAuth credential handling

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*forecast*.js : Forecast recommendations must exclude policy-blocked and token-exhausted accounts, returning no recommendation with a clear reason when none are available

Applied to files:

  • test/codex-manager-cli.test.ts
🔇 Additional comments (19)
scripts/check-pack-budget-lib.js (1)

17-17: duplicate: exact manifest path is still validated as a prefix match.

same previously raised issue. this still allows suffix spoof paths to satisfy the check and is not covered by the new regression at test/check-pack-budget.test.ts:112.

Also applies to: 103-106

package.json (1)

3-3: LGTM!

Also applies to: 117-117, 123-123, 133-133

test/check-pack-budget.test.ts (1)

99-100: LGTM!

Also applies to: 112-128, 135-136, 161-162, 176-177

test/package-bin.test.ts (1)

17-23: LGTM!

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

748-748: LGTM!

Also applies to: 1775-1775, 2972-2972, 3058-3058, 3104-3104, 3248-3250, 3259-3330, 3381-3381, 7129-7129, 7342-7342, 7347-7347, 9909-9917

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

92-100: LGTM!

README.md (2)

199-199: LGTM!


386-387: LGTM!

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

18-18: LGTM!

test/runtime-quota-probe.test.ts (2)

45-45: LGTM!


93-93: LGTM!

lib/codex-manager.ts (1)

2406-2410: still skips the live probe after a refresh failure.

lib/codex-manager.ts:2406 still increments signedInOnly when sessionLikelyValid is true, so a transient refresh failure can undercount codexAvailable and overcount signedInOnly without ever probing the current access token. this is the same issue already raised for this path, and it still needs the current-token probe plus a vitest regression in test/codex-manager-cli.test.ts.

test/documentation.test.ts (1)

339-339: validated changed expectations are consistent with the new defaults.

checked test/documentation.test.ts:339 and test/documentation.test.ts:582; no blocking issues found.

Also applies to: 582-582

lib/quota-probe.ts (1)

56-62: fallback model order change looks safe.

checked lib/quota-probe.ts:56-62; behavior matches the live-probe default rollout with no additional risk introduced.

lib/integration-generators.ts (1)

1-1: shared default-model import is the right direction.

checked lib/integration-generators.ts:1; no issues.

lib/prompts/codex.ts (1)

8-8: default-model unification and prewarm update look correct.

checked lib/prompts/codex.ts:8, lib/prompts/codex.ts:241, and lib/prompts/codex.ts:469; no blocking concerns.

Also applies to: 237-241, 469-469

lib/runtime-rotation-proxy.ts (1)

355-395: concurrency and auth-ordering updates look sound in the touched paths.

checked lib/runtime-rotation-proxy.ts:355-395, lib/runtime-rotation-proxy.ts:560-574, lib/runtime-rotation-proxy.ts:729, lib/runtime-rotation-proxy.ts:1596-1605, and lib/runtime-rotation-proxy.ts:1740-1788; no blocking issues identified.

Also applies to: 408-447, 560-574, 729-729, 1596-1605, 1740-1788

test/quota-probe.test.ts (1)

87-101: good regression coverage for default probe model.

checked test/quota-probe.test.ts:87-101; this is deterministic and covers the intended default-model behavior.

test/codex-prompts.test.ts (1)

121-150: default prompt-family regression guard is solid.

checked test/codex-prompts.test.ts:121-150; coverage is appropriate for the model-default change.

Comment thread lib/codex-manager.ts Outdated
Comment thread lib/codex-manager/help.ts Outdated
Comment thread lib/codex-manager/help.ts
…nings column, consolidate default model

Addresses CodeRabbit + Greptile review of ndycode#506:

- --model/-m and --model= now reject a flag-like next token (starts with '-')
  instead of silently consuming it, across ALL parse sites: best (codex-manager.ts),
  forecast, report, and forecast-report-commands (x2). 'forecast --model --json' /
  'best --model --live' now report "Missing value for --model" instead of eating
  the next flag. Added regression tests for both.
- live-check summary: dropped the 'warnings' column, which is identical to
  'signed in only' in live-probe mode (every increment site bumps both), so it
  added no information.
- consolidated the default probe model to the canonical DEFAULT_MODEL export
  (lib/request/helpers/model-map.ts) instead of scattered hardcoded 'gpt-5.5'
  literals and local DEFAULT_LIVE_PROBE_MODEL copies in the command layer, so the
  default has a single source of truth. Value-neutral (DEFAULT_MODEL is 'gpt-5.5').
- updated a stale report-command test asserting the old gpt-5.3-codex default.

Full suite: 4352 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
lib/codex-manager/help.ts (1)

185-210: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

parseBestArgs is missing the flag-like --model value validation.

forecast.ts:177-179 and forecast-report-commands.ts:147,188 both reject values starting with - to prevent flag-like strings (e.g., --model --json) from being consumed as the model name. parseBestArgs only checks !value but accepts --json as a model value when the user types codex-multi-auth best --model --json.

this violates the pr objective "reject flag-like --model values across all parse sites" and creates inconsistent cli behavior across best/forecast/report commands.

🔧 add flag-like value rejection
 if (arg === "--model" || arg === "-m") {
   const value = args[i + 1];
-  if (!value) {
+  if (!value || value.startsWith("-")) {
     return {
       ok: false,
       reason: "error",
       message: "Missing value for --model",
     };
   }
   options.model = value;
   options.modelProvided = true;
   i += 1;
   continue;
 }
 if (arg.startsWith("--model=")) {
   const value = arg.slice("--model=".length).trim();
-  if (!value) {
+  if (!value || value.startsWith("-")) {
     return {
       ok: false,
       reason: "error",
       message: "Missing value for --model",
     };
   }
   options.model = value;
   options.modelProvided = true;
   continue;
 }

also add regression tests in test/codex-manager-help.test.ts mirroring test/codex-manager-forecast-command.test.ts:137-150 to lock this behavior.

🤖 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/codex-manager/help.ts` around lines 185 - 210, parseBestArgs currently
accepts a value for --model that starts with '-' (e.g., --json) because it only
checks for empty value; update the parsing branches that handle "--model" / "-m"
and "--model=" in parseBestArgs to reject flag-like values by checking if the
resolved value startsWith("-") and, if so, return the same error object used
elsewhere ("ok:false, reason:'error', message:'Missing value for --model'")
instead of accepting it; also add regression tests in
test/codex-manager-help.test.ts that mirror
test/codex-manager-forecast-command.test.ts:137-150 to assert that flag-like
model values are rejected for the best command.
lib/codex-manager/repair-commands.ts (1)

215-230: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

parseFixArgs is missing the flag-like --model value validation.

lib/codex-manager/commands/forecast.ts:177-179 and lib/codex-manager/forecast-report-commands.ts:147,188 both reject --model values starting with -, but parseFixArgs only checks !value. this lets codex-multi-auth fix --model --json consume --json as the model name instead of treating it as a separate flag.

the pr objective says "reject flag-like --model values across all parse sites" and the layer description includes the fix command, but this validation is missing here.

🔧 add flag-like value rejection
 if (argValue === "--model" || argValue === "-m") {
   const value = args[i + 1];
-  if (!value) {
+  if (!value || value.startsWith("-")) {
     return { ok: false, message: "Missing value for --model" };
   }
   options.model = value;
   i += 1;
   continue;
 }
 if (argValue.startsWith("--model=")) {
   const value = argValue.slice("--model=".length).trim();
-  if (!value) {
+  if (!value || value.startsWith("-")) {
     return { ok: false, message: "Missing value for --model" };
   }
   options.model = value;
   continue;
 }

also add regression tests in the fix command test suite mirroring test/codex-manager-forecast-command.test.ts:137-150.

🤖 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/codex-manager/repair-commands.ts` around lines 215 - 230, parseFixArgs
currently only checks for a missing value when handling "--model"/"-m" and
"--model=" but allows flag-like values (strings starting with "-"), which causes
flags like "--json" to be consumed as the model. In parseFixArgs, after
computing value (for both the "--model" branch and the "--model=" branch), add a
validation that rejects values starting with "-" (e.g., if value.startsWith("-")
return { ok: false, message: "Missing value for --model" } or similar consistent
error) before setting options.model; reference argValue, parseFixArgs, and
options.model to locate the spots. Also add regression tests to the fix command
test suite mirroring the existing tests in
test/codex-manager-forecast-command.test.ts:137-150 to assert that flag-like
values for --model are rejected.
lib/codex-manager/commands/report.ts (1)

131-131: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

remove hardcoded default model from help text.

lib/codex-manager/commands/report.ts:131 hardcodes gpt-5.5 while parse/runtime now use DEFAULT_MODEL. wire help text to the same constant to avoid drift on the next model bump.

🤖 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/codex-manager/commands/report.ts` at line 131, The help text in the
report command hardcodes "gpt-5.5"; update the option help to reference the
shared DEFAULT_MODEL constant instead. In lib/codex-manager/commands/report.ts,
replace the literal "gpt-5.5" in the option string (the line that reads like " 
--model, -m        Probe model for live mode (default: gpt-5.5)") to include
DEFAULT_MODEL (e.g., build the string with the constant), and if DEFAULT_MODEL
is not already imported, import it from the module that defines it so the help
stays in sync with runtime defaults.
♻️ Duplicate comments (1)
lib/codex-manager/help.ts (1)

3-3: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

the local constant creates an unnecessary layer of indirection.

lib/codex-manager/help.ts:3 defines DEFAULT_LIVE_PROBE_MODEL just to assign it DEFAULT_MODEL. past review already flagged this: "use a single source of truth for the live probe default." either use DEFAULT_MODEL directly in lines 154 and 167, or import a canonical DEFAULT_LIVE_PROBE_MODEL from model-map.ts if that distinction matters across the codebase.

♻️ remove the indirection
-import { DEFAULT_MODEL } from "../request/helpers/model-map.js";
-
-const DEFAULT_LIVE_PROBE_MODEL = DEFAULT_MODEL;
+import { DEFAULT_MODEL } from "../request/helpers/model-map.js";

 export function printBestUsage(): void {
   console.log(
     [
       "Usage:",
       "  codex-multi-auth best [--live] [--json] [--model <model>]",
       "",
       "Options:",
       "  --live, -l         Probe live quota headers via Codex backend before switching",
       "  --json, -j         Print machine-readable JSON output",
-      `  --model, -m        Probe model for live mode (default: ${DEFAULT_LIVE_PROBE_MODEL})`,
+      `  --model, -m        Probe model for live mode (default: ${DEFAULT_MODEL})`,
       "",
       "Behavior:",
       "  - Chooses the healthiest account using forecast scoring",
       "  - Switches to the recommended account when it is not already active",
     ].join("\n"),
   );
 }
 
 export function parseBestArgs(args: string[]): ParsedBestArgs {
   const options: BestCliOptions = {
     live: false,
     json: false,
-    model: DEFAULT_LIVE_PROBE_MODEL,
+    model: DEFAULT_MODEL,
     modelProvided: false,
   };
🤖 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/codex-manager/help.ts` at line 3, Remove the unnecessary indirection:
delete the local constant DEFAULT_LIVE_PROBE_MODEL and replace its usages with
the canonical DEFAULT_MODEL (i.e., use DEFAULT_MODEL directly where
DEFAULT_LIVE_PROBE_MODEL is referenced), or if a distinct default is required
across the codebase, import the canonical DEFAULT_LIVE_PROBE_MODEL from
model-map.ts instead of defining it locally; update all references (places
currently referencing DEFAULT_LIVE_PROBE_MODEL) to use the chosen symbol so
there is a single source of truth.
🤖 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 `@lib/codex-manager/commands/report.ts`:
- Around line 168-174: The parser currently validates the split-arg form for
--model by checking value.startsWith("-") on the raw token, which lets quoted or
whitespace-only tokens slip through; in the argument-parsing loop (the branch
handling arg === "--model" || arg === "-m") trim the token first (const value =
args[i+1].trim()), then validate against empty string and leading "-" and only
after that assign to options.model and increment i; also add regression tests in
test/codex-manager-report-command.test.ts covering --model "   " and --model " 
-x" to assert deterministic failure handling.

In `@test/codex-manager-report-command.test.ts`:
- Around line 520-524: The test hardcodes "gpt-5.5" when asserting
deps.fetchCodexQuotaSnapshot; instead import and use the shared live-probe
default model constant exported by the codex manager (the same constant
lib/codex-manager uses for its live probe default) and replace the literal model
value in the toHaveBeenCalledWith assertion with that constant (i.e., import the
exported shared default and use model: <LIVE_PROBE_DEFAULT_MODEL_CONSTANT> in
the expectation).

---

Outside diff comments:
In `@lib/codex-manager/commands/report.ts`:
- Line 131: The help text in the report command hardcodes "gpt-5.5"; update the
option help to reference the shared DEFAULT_MODEL constant instead. In
lib/codex-manager/commands/report.ts, replace the literal "gpt-5.5" in the
option string (the line that reads like "  --model, -m        Probe model for
live mode (default: gpt-5.5)") to include DEFAULT_MODEL (e.g., build the string
with the constant), and if DEFAULT_MODEL is not already imported, import it from
the module that defines it so the help stays in sync with runtime defaults.

In `@lib/codex-manager/help.ts`:
- Around line 185-210: parseBestArgs currently accepts a value for --model that
starts with '-' (e.g., --json) because it only checks for empty value; update
the parsing branches that handle "--model" / "-m" and "--model=" in
parseBestArgs to reject flag-like values by checking if the resolved value
startsWith("-") and, if so, return the same error object used elsewhere
("ok:false, reason:'error', message:'Missing value for --model'") instead of
accepting it; also add regression tests in test/codex-manager-help.test.ts that
mirror test/codex-manager-forecast-command.test.ts:137-150 to assert that
flag-like model values are rejected for the best command.

In `@lib/codex-manager/repair-commands.ts`:
- Around line 215-230: parseFixArgs currently only checks for a missing value
when handling "--model"/"-m" and "--model=" but allows flag-like values (strings
starting with "-"), which causes flags like "--json" to be consumed as the
model. In parseFixArgs, after computing value (for both the "--model" branch and
the "--model=" branch), add a validation that rejects values starting with "-"
(e.g., if value.startsWith("-") return { ok: false, message: "Missing value for
--model" } or similar consistent error) before setting options.model; reference
argValue, parseFixArgs, and options.model to locate the spots. Also add
regression tests to the fix command test suite mirroring the existing tests in
test/codex-manager-forecast-command.test.ts:137-150 to assert that flag-like
values for --model are rejected.

---

Duplicate comments:
In `@lib/codex-manager/help.ts`:
- Line 3: Remove the unnecessary indirection: delete the local constant
DEFAULT_LIVE_PROBE_MODEL and replace its usages with the canonical DEFAULT_MODEL
(i.e., use DEFAULT_MODEL directly where DEFAULT_LIVE_PROBE_MODEL is referenced),
or if a distinct default is required across the codebase, import the canonical
DEFAULT_LIVE_PROBE_MODEL from model-map.ts instead of defining it locally;
update all references (places currently referencing DEFAULT_LIVE_PROBE_MODEL) to
use the chosen symbol so there is a single source of truth.
🪄 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: d93205b9-7baa-4e2a-9877-26a45254a44c

📥 Commits

Reviewing files that changed from the base of the PR and between 49857fd and a0317a4.

📒 Files selected for processing (10)
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (9)
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-cli.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-cli.test.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (README.md)

Prefer async/await over callback-based promise handling in TypeScript/JavaScript code for better readability and error handling

Use environment variables with CODEX_ prefix for runtime configuration overrides (e.g., CODEX_MULTI_AUTH_DIR, CODEX_MODE, CODEX_TUI_COLOR_PROFILE)

Store user data in ~/.codex/multi-auth/ directory structure with support for CODEX_MULTI_AUTH_DIR environment variable override for custom paths

Use --dry-run flag pattern for repair and fix commands to preview changes before applying them (e.g., codex-multi-auth fix --dry-run)

Use JSON format for machine-readable output with --json flag on diagnostic and report commands (e.g., codex-multi-auth report --json, codex-multi-auth doctor --json)

Use opt-in approach for experimental features with non-destructive flows: sync previews before apply, preserve destination-only accounts, and fail safely on filename collisions

All CLI commands should include appropriate help text accessible via ? hotkey in dashboard or --help flag for command-line usage

Use camelCase for all JavaScript/TypeScript variable, function, and property names

Files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.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/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
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager.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/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager.ts
test/**/codex-manager-cli.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test CLI settings with question cancellation across all 5 panels and EBUSY/concurrent race conditions

Files:

  • test/codex-manager-cli.test.ts
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T07:32:49.844Z
Learning: Design the public API contract with documented error contracts covering token expiration, missing fields, and token reuse scenarios
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T07:32:49.844Z
Learning: Never patch official Codex CLI app binaries; use reversible packaged app bind and user-level launcher routing helpers instead
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T07:32:49.844Z
Learning: Keep credentials local in `~/.codex/multi-auth/` directory structure; never transmit or store credentials in remote systems or share them across machines
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T07:32:49.844Z
Learning: Use bounded outbound request budget to prevent a single prompt from walking the entire account pool indefinitely
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T07:32:49.844Z
Learning: Implement session affinity and live account sync to maintain consistent account selection across multiple concurrent requests
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Applied to files:

  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{config,rotation,schema}*.test.{ts,js} : Write tests for minRotationIntervalMs sliding-anchor and sticky-window coverage; schema and config coverage for new knobs with min(0), allows-zero, rejects-string validation

Applied to files:

  • test/codex-manager-forecast-command.test.ts
  • lib/codex-manager/help.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{refresh,error,builder,auth}*.test.{ts,js} : Write unit tests covering refresh-endpoint invalidation returning code: "token_invalidated" routed through shared body builder

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`

Applied to files:

  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Deprecated Codex selectors such as `gpt-5-codex` and `gpt-5.1-codex*` must be treated as compatibility aliases and retried on current documented Codex models

Applied to files:

  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/commands/report.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*forecast*.js : Forecast recommendations must exclude policy-blocked and token-exhausted accounts, returning no recommendation with a clear reason when none are available

Applied to files:

  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/account*.{js,ts,tsx} : Implement atomic, self-healing account store with checksummed WAL and temp-and-rename writes that self-heal on read when encountering torn writes

Applied to files:

  • lib/codex-manager/commands/best.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/request/request-transformer.ts : Forward non-auth commands to official Codex CLI without reimplementing general Codex commands in the wrapper

Applied to files:

  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/forecast-report-commands.ts
📚 Learning: 2026-06-03T06:06:23.734Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: README.md:0-0
Timestamp: 2026-06-03T06:06:23.734Z
Learning: Applies to **/quota-cache.json : Implement quota caching in `~/.codex/multi-auth/quota-cache.json` for account quota forecasting and health-aware selection

Applied to files:

  • lib/codex-manager/commands/forecast.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-constants.ts : Use canonical runtime provider id `codex-multi-auth-runtime-proxy` in runtime constants

Applied to files:

  • lib/codex-manager/help.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,401}*.test.{ts,js} : Write unit tests covering upstream-401 invalidation path (401 to client, ~5-minute cooldown, clears affinity, no rotation) and regression guard for generic 401 rotation

Applied to files:

  • lib/codex-manager/help.ts
  • test/codex-manager-cli.test.ts
  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{builder,error,response}*.test.{ts,js} : Write unit tests for invalidation body builder covering all message-extraction branches: top-level message, nested error.message, top-level-wins priority, blank-to-nested fallback, non-JSON body, and no-usable-message fallback

Applied to files:

  • test/codex-manager-cli.test.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/cache*.{js,ts,tsx} : Verify cached Codex instructions with SHA-256 digest; discard tampered cache, treat legacy entries without recorded digest as unverified, and never fast-path serve or drive conditional revalidation on unverified bytes

Applied to files:

  • test/codex-manager-cli.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{401,auth,handler,rotation,oauth}*.{ts,js} : Detect explicit token-invalidation responses in 401 handlers by reading response body and checking for invalidation phrases (e.g., 'invalidated oauth token', 'authentication token has been invalidated')

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{rotation,scheduler,timing,auth}*.{ts,js} : Implement minRotationIntervalMs sticky window (configurable sliding anchor via CODEX_AUTH_MIN_ROTATION_INTERVAL_MS or minRotationIntervalMs, default 60s) to boost the last-served account and reduce presenting different OAuth tokens from the same IP

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,handler,401,rotation}*.{ts,js} : Distinguish token invalidation 401s from generic expired-token 401s; continue rotating for generic 401s (expired tokens, wrong credentials) but stop on explicit invalidation detection

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*{verify,bearer}*.js : Bearer token verification hot path writes to lastUsedAt must be debounced to keep steady-state verification in-memory

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,config,handler}*.{ts,js} : Apply a long cooldown (5 minutes via CODEX_AUTH_TOKEN_INVALIDATION_COOLDOWN_MS or tokenInvalidationCooldownMs) on invalidated accounts

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{error,builder,response,auth}*.{ts,js} : Emit consistent client error contract: { error: { message, code: "token_invalidated" } } for both invalidation exit paths (refresh-failure and upstream-401) through a single shared builder

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*cache*.js : Codex CLI state cache must honor forceRefresh even with a load in flight, guarded by load generation to prevent stale reads from overwriting fresh snapshots

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-05-31T13:20:01.197Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Keep recommended defaults enabled: `menuAutoFetchLimits`, `menuSortEnabled`, `liveAccountSync`, `sessionAffinity`, `proactiveRefreshGuardian`, and `preemptiveQuotaEnabled`

Applied to files:

  • lib/codex-manager.ts
📚 Learning: 2026-06-03T06:06:56.293Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/**/*status*.js : Account status tone determination must consider the entire detail string, not just segments within parentheses, to ensure failed health checks always render as failures

Applied to files:

  • lib/codex-manager.ts
🔇 Additional comments (5)
lib/codex-manager/commands/forecast.ts (1)

1-567: LGTM!

lib/codex-manager/forecast-report-commands.ts (1)

1-626: LGTM!

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

137-150: LGTM!

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

2009-2027: LGTM!

lib/codex-manager.ts (1)

2407-2415: this still skips the live probe after a transient refresh failure.

lib/codex-manager.ts:2407 still marks the account as signed in only as soon as queuedRefresh() fails, even when sessionLikelyValid is true. that undercounts codexAvailable and misreports live status if the existing account.accessToken would still pass fetchCodexQuotaSnapshot(). please keep the fallback probe here, and keep the regression in test/codex-manager-cli.test.ts for refresh failure + usable token + live probe.

Comment thread lib/codex-manager/commands/report.ts
Comment thread test/codex-manager-report-command.test.ts
ndycode and others added 2 commits June 3, 2026 16:02
…bit round 2)

CodeRabbit found two more --model parsers I missed (separate parse functions):
- help.ts parseBestArgs (the 'best' command's own parser, distinct from the one
  in codex-manager.ts) — Critical
- repair-commands.ts parseFixArgs (the 'fix' command) — Critical

Also fixed the same class in two pre-existing parsers not touched by the original
PR, for consistency (flagged by an exhaustive sweep):
- commands/integrations.ts (--model)
- commands/models.ts (--model and --model=)

Every --model/-m and --model= site now rejects a flag-like next token
(startsWith('-')) instead of consuming it. Added regression tests:
parseBestArgs (--model --json/--live/=--json) in codex-manager-help.test.ts and
parseFixArgs in repair-commands.test.ts.

Deep-audit workflow verdict: SAFE TO MERGE — both raised findings REFUTED against
committed code (auditor read origin/main state, not the PR's commits); no v2.2.1
regression in the audited surfaces.

Full suite: 4354 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Addressed the round-2 review in 72be723:

  • help.ts parseBestArgs (Critical): the 'best' command's own parser (separate from codex-manager.ts) now rejects flag-like --model values. + regression tests (--model --json/--live/=--json).
  • repair-commands.ts parseFixArgs (Critical): the 'fix' command parser now guarded. + parseFixArgs regression test.
  • Also fixed the same class in two pre-existing parsers an exhaustive sweep found (integrations.ts, models.ts), so EVERY --model/-m and --model= site across the CLI now rejects startsWith('-') values.
  • Removed a stray audit helper file committed by mistake.

Every --model parse site is now consistent. Full suite: 4354 passed, 3 skipped, 0 failed; typecheck + lint clean. Deep-audit workflow verdict: SAFE TO MERGE (its 2 findings were refuted against committed code).

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@ndycode good work on the exhaustive sweep — catching integrations.ts and models.ts in addition to the two critical sites is exactly the right approach. every --model parse site consistent now is the bar. triggering a full review of the updated branch now.

User:

@ndycode solid — the exhaustive sweep catching integrations.ts and models.ts beyond the two originally flagged sites is the right call. consistent rejection of flag-like values at every --model/-m parse site is clean. triggering full review now.

✅ Action performed

Full review finished.

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

🤖 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 `@test/codex-manager-help.test.ts`:
- Around line 129-146: Add regression tests for the short alias handled in
lib/codex-manager/help.ts (the -m handling around line 185) by extending the
existing test that covers --model: add a case expect(parseBestArgs(["-m",
"--json"])) to return the same error object as ["--model", "--json"] (ok: false,
reason: "error", message: "Missing value for --model") and add a success case
expect(parseBestArgs(["-m", "gpt-5.5"])) mirroring the valid ["--model",
"gpt-5.5"] behavior so the -m alias contract is locked in.
🪄 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: eabc6bf5-74a9-4aa8-a4e9-d7d121e691d2

📥 Commits

Reviewing files that changed from the base of the PR and between a0317a4 and 72be723.

📒 Files selected for processing (6)
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (8)
lib/**/*.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/**/*.ts: All public exports should flow through lib/index.ts or documented package subpaths
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/integrations.ts
  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/integrations.ts
  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (README.md)

Use CODEX_MULTI_AUTH_DIR environment variable to override settings/accounts root directory instead of hardcoding paths

Use CODEX_MODE=0/1 environment variable to disable/enable Codex mode at runtime instead of modifying code

Use CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1 to opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions instead of changing defaults in code

Store account credentials and settings in project-scoped paths under ~/.codex/multi-auth/projects// for repo-specific workflows

Implement account selection logic to prefer health-aware selection, quota forecasting, and automatic failover over simple sequential rotation

Ensure credentials stay local and never transmit account state to external services beyond OpenAI API endpoints

Implement bounded outbound request budget so one prompt cannot walk through the full account pool indefinitely

Trigger short cooldown on repeated cross-account 5xx bursts instead of continuing aggressive rotation

Stagger proactive refresh operations to reduce background refresh bursts across multiple accounts

Disable whole-pool replay by default when every account is rate-limited to prevent cascading failures

Implement Responses background mode as opt-in only; callers must intentionally send background: true for stateful store=true routing

Make manual npm version check notices non-intrusive; only print on interactive TTY or when CODEX_MULTI_AUTH_DEBUG=1, never auto-update

Use loopback-only local bridge for /health, /v1/models, and /v1/responses endpoints, protected by hashed local client tokens

Implement session affinity and live account sync to maintain consistent account selection within a single forwarded Codex session

Do not patch official Codex app binaries; use reversible packaged Codex app bind and user-level launcher routing helpers instead

Keep settings, accounts, and configuration files in JSON format under ~/.codex/multi-auth/ with documented default paths for all st...

Files:

  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/integrations.ts
  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.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/commands/models.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.ts
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/codex-manager-help.test.ts
  • test/repair-commands.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-help.test.ts
  • test/repair-commands.test.ts
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.197Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:07:30.136Z
Learning: Install official Codex CLI via npm, Homebrew, or release binary before installing codex-multi-auth
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:07:30.136Z
Learning: This project is an independent open-source project, not an official OpenAI product; include clear disclaimer in documentation
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:07:30.136Z
Learning: Credentials are for personal development use only; include caution notice that production/commercial workloads should use OpenAI Platform API
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{builder,error,response}*.test.{ts,js} : Write unit tests for invalidation body builder covering all message-extraction branches: top-level message, nested error.message, top-level-wins priority, blank-to-nested fallback, non-JSON body, and no-usable-message fallback

Applied to files:

  • test/codex-manager-help.test.ts
  • test/repair-commands.test.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{config,rotation,schema}*.test.{ts,js} : Write tests for minRotationIntervalMs sliding-anchor and sticky-window coverage; schema and config coverage for new knobs with min(0), allows-zero, rejects-string validation

Applied to files:

  • test/codex-manager-help.test.ts
  • lib/codex-manager/help.ts
📚 Learning: 2026-06-02T12:30:22.264Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Applied to files:

  • test/codex-manager-help.test.ts
  • lib/codex-manager/repair-commands.ts
  • lib/codex-manager/help.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/request/request-transformer.ts : Forward non-auth commands to official Codex CLI without reimplementing general Codex commands in the wrapper

Applied to files:

  • test/codex-manager-help.test.ts
📚 Learning: 2026-05-31T13:20:14.049Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/troubleshooting.md:0-0
Timestamp: 2026-05-31T13:20:14.049Z
Learning: Run `codex-multi-auth doctor --fix` to automatically repair Codex CLI multi-account install and routing issues

Applied to files:

  • test/repair-commands.test.ts
📚 Learning: 2026-06-02T12:29:38.793Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to lib/runtime-constants.ts : Use canonical runtime provider id `codex-multi-auth-runtime-proxy` in runtime constants

Applied to files:

  • lib/codex-manager/help.ts
📚 Learning: 2026-05-31T14:24:04.131Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,401}*.test.{ts,js} : Write unit tests covering upstream-401 invalidation path (401 to client, ~5-minute cooldown, clears affinity, no rotation) and regression guard for generic 401 rotation

Applied to files:

  • lib/codex-manager/help.ts
🔇 Additional comments (1)
test/repair-commands.test.ts (1)

165-182: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

extend parser regression to cover -m alias in fix args.

this block validates --model paths only. please add parseFixArgs(["-m", "--json"]) => missing-value error and parseFixArgs(["-m", "gpt-5.5"]) => success, since lib/codex-manager/repair-commands.ts:215 treats -m as first-class.

As per coding guidelines, "test/**: tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior."

⛔ Skipped due to learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{config,rotation,schema}*.test.{ts,js} : Write tests for minRotationIntervalMs sliding-anchor and sticky-window coverage; schema and config coverage for new knobs with min(0), allows-zero, rejects-string validation
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{builder,error,response}*.test.{ts,js} : Write unit tests for invalidation body builder covering all message-extraction branches: top-level message, nested error.message, top-level-wins priority, blank-to-nested fallback, non-JSON body, and no-usable-message fallback
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-02T12:29:38.793Z
Learning: Applies to test/**/*.ts : Windows filesystem operations must include retry handling for transient `EBUSY`, `EPERM`, and `ENOTEMPTY` errors where tests cover Windows locks
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{auth,rotation,401}*.test.{ts,js} : Write unit tests covering upstream-401 invalidation path (401 to client, ~5-minute cooldown, clears affinity, no rotation) and regression guard for generic 401 rotation
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.264Z
Learning: Applies to docs/releases/**/*.{js,ts,tsx} --mcodex* : Validate `MCODEX_MONITOR_INTERVAL` and `MCODEX_TMUX_HISTORY_LIMIT` environment variables as numeric before interpolating into `watch` or tmux commands to prevent shell injection
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.2.md:0-0
Timestamp: 2026-05-31T14:24:04.131Z
Learning: Applies to docs/releases/**/*{refresh,error,builder,auth}*.test.{ts,js} : Write unit tests covering refresh-endpoint invalidation returning code: "token_invalidated" routed through shared body builder
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.293Z
Learning: Applies to docs/releases/scripts/mcodex.js : POSIX tools like tmux and watch must be invoked as argv arrays instead of shell string interpolation to avoid shell dependency issues

… test

CodeRabbit: the parseFixArgs regression only exercised --model; add -m cases
("-m --json" => missing-value error, "-m gpt-5.5" => success) since repair-commands
treats -m as first-class.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Addressed in 272c0e9: added the -m short-form cases to the parseFixArgs flag-guard test (-m --json => missing-value, -m gpt-5.5 => success), since repair-commands treats -m as first-class.

All --model parse sites + their short forms are now guarded and covered. Full repair-commands suite: 19 passed; typecheck clean.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@ndycode solid call adding the -m short-form cases — repair-commands.ts is one of the few parsers where -m is first-class so the flag-guard there has to cover both spellings. -m --json => missing-value and -m gpt-5.5 => success are exactly the right regression cases in test/repair-commands.test.ts. triggering the full review now.


🧠 Learnings used
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_COMMAND.md:0-0
Timestamp: 2026-05-21T00:22:54.020Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend CLI tests covering success path, invalid input or missing args, JSON mode if supported, and non-interactive behavior in `test/codex-manager-cli.test.ts`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/models.ts : Implement models command integration in `lib/codex-manager/commands/models.ts` for the model capability matrix feature

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies fix command flag documentation is aligned consistently across README.md, docs/reference/commands.md, and CLI runtime usage text

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/lib/codex-manager.ts : Add the smallest possible parsing/dispatch change in `lib/codex-manager.ts` when adding a new `codex-multi-auth` command

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend `test/codex-manager-cli.test.ts` with test coverage for new command paths

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/auth*.ts : Preserve `codex auth doctor --fix` as the canonical safe-recovery command with documented trust and safety guarantees

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/*.ts : Standardize `--json` flag support across all subcommands (`list`, `switch`, `check`, `forecast`, `fix`, `report`, `doctor`, `verify-flagged`) to ensure uniform JSON output capability

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.2.md:0-0
Timestamp: 2026-05-21T00:32:08.338Z
Learning: Applies to docs/releases/**/*.test.{js,ts} : Add regression coverage for explicit no-capture forwarding, explicit capture forwarding, unsupported-model retries, and fixture-pinned `CODEX_HOME` isolation in test suite

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{lib/refresh-queue.ts,lib/storage.ts,index.ts} : Mark `lib/refresh-queue.ts` refresh-queue race deduplication, atomic writes on primary/flagged/settings storage, and 4-gate request-loop termination (`index.ts:*`) as load-bearing invariants; verify all refactors (especially R4 routing mutex) preserve these invariants with dedicated regression tests before merge

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/{codex-manager,index}.ts : Update codex-manager exports and main entry points (`lib/codex-manager.ts`, `lib/index.ts`) to include new model capability matrix functionality

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/reference/error-contracts.md:0-0
Timestamp: 2026-05-27T15:54:46.276Z
Learning: Implement `--json` flag support for commands: `codex-multi-auth forecast`, `codex-multi-auth report`, `codex-multi-auth fix`, `codex-multi-auth doctor`, and `codex-multi-auth verify-flagged`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/{model-capability-matrix,codex-manager-models-command,test-model-matrix-script}.test.ts : Ensure test coverage for model capability matrix with test files `test/model-capability-matrix.test.ts`, `test/codex-manager-models-command.test.ts`, and `test/test-model-matrix-script.test.ts`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.12.md:0-0
Timestamp: 2026-05-27T15:54:51.791Z
Learning: Applies to docs/releases/**/*.test.{js,ts,py} : Add regression coverage for literal TOML keys, CRLF preservation, table-like content inside strings and arrays, alternate hook paths, long hook keys, shadow `hooks.json` visibility, and concurrent runtime shadow launches

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.2.md:0-0
Timestamp: 2026-05-21T00:30:00.875Z
Learning: Applies to docs/releases/**/*.test.{js,ts,mjs,cjs} : Expand regression coverage for backup-depth recovery, staged rename retries, and parallel-save ordering guarantees in test suites

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/DOCUMENTATION.md:0-0
Timestamp: 2026-05-21T00:15:46.683Z
Learning: Applies to docs/reference/commands.md : Verify CLI flags documented in references match runtime parser/usage output

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.1.md:0-0
Timestamp: 2026-05-21T00:32:01.979Z
Learning: Applies to docs/releases/**/model-map*.{js,ts,tsx,jsx} : Support GPT-5.5 and GPT-5.5 Pro as first-attempt models on supported Codex runtimes with deterministic fallback behavior for older runtimes

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.0.md:0-0
Timestamp: 2026-05-27T15:59:46.782Z
Learning: Applies to docs/releases/**/*.{e2e,integration}.test.{ts,js} : Add end-to-end regression coverage for pinned-503 rate-limited and cooling-down paths; extend disabled-account test case to assert new structured fields

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.0.1.md:0-0
Timestamp: 2026-05-21T00:32:20.873Z
Learning: Live quota probes and fallback model defaults should use current selectors including `gpt-5.3-codex` and `gpt-5.5`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.2.md:0-0
Timestamp: 2026-05-21T00:32:54.402Z
Learning: Applies to docs/releases/{package.json,bin/**,**/*codex-multi-auth*} : `codex-multi-auth-codex` remains the explicit forwarding wrapper; `codex-multi-auth` remains the account-management command family

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/monitor.ts : Add `codex-multi-auth monitor` command to aggregate local runtime observability, usage, account policies, routing profile context, budget guards, model capability matrix summary, quota cache counts, and current project context

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.274Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/GITHUB_DISCOVERABILITY.md:0-0
Timestamp: 2026-05-21T00:22:11.873Z
Learning: Repository description on GitHub should be: 'Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for openai/codex'

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.0-beta.0.md:0-0
Timestamp: 2026-05-21T00:29:31.294Z
Learning: Update scoped prerelease package installations from ndycode/codex-multi-auth to codex-multi-auth during migration to stable releases

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CLI_UI_DEEPSEARCH_AUDIT.md:0-0
Timestamp: 2026-05-21T00:21:13.269Z
Learning: Applies to docs/development/lib/codex-manager.ts : Implement account health safeguards including circuit breaker support, rate-limit reason handling, and hybrid account selection using health and token buckets
✅ Action performed

Full review finished.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
lib/codex-manager/forecast-report-commands.ts (1)

98-125: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

drive forecast/report help text from DEFAULT_MODEL.

printForecastUsage() and printReportUsage() still hardcode gpt-5.5 at lib/codex-manager/forecast-report-commands.ts:107 and lib/codex-manager/forecast-report-commands.ts:121, while the actual parser default already comes from DEFAULT_MODEL at lib/codex-manager/forecast-report-commands.ts:131 and lib/codex-manager/forecast-report-commands.ts:172. that will drift the next time the default changes. please format the help text from the constant and add a parity assertion in test/codex-manager-help.test.ts or test/documentation.test.ts.

suggested fix
 export function printForecastUsage(): void {
 	console.log(
 		[
 			"Usage:",
 			"  codex-multi-auth forecast [--live] [--json] [--model <model>]",
 			"",
 			"Options:",
 			"  --live, -l         Probe live quota headers via Codex backend",
 			"  --json, -j         Print machine-readable JSON output",
-			"  --model, -m        Probe model for live mode (default: gpt-5.5)",
+			`  --model, -m        Probe model for live mode (default: ${DEFAULT_MODEL})`,
 		].join("\n"),
 	);
 }
@@
 export function printReportUsage(): void {
 	console.log(
 		[
 			"Usage:",
 			"  codex-multi-auth report [--live] [--json] [--model <model>] [--out <path>]",
 			"",
 			"Options:",
 			"  --live, -l         Probe live quota headers via Codex backend",
 			"  --json, -j         Print machine-readable JSON output",
-			"  --model, -m        Probe model for live mode (default: gpt-5.5)",
+			`  --model, -m        Probe model for live mode (default: ${DEFAULT_MODEL})`,
 			"  --out              Write JSON report to a file path",
 		].join("\n"),
 	);
 }

based on learnings: extend test/documentation.test.ts when command text or help changes to ensure docs parity.

🤖 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/codex-manager/forecast-report-commands.ts` around lines 98 - 125, The
usage strings in printForecastUsage and printReportUsage hardcode "gpt-5.5";
change both help messages to interpolate the DEFAULT_MODEL constant (use
DEFAULT_MODEL where the default model text appears in printForecastUsage and
printReportUsage) so the help text always matches the parser default, and add a
parity assertion in the test suite (extend test/documentation.test.ts or
create/extend test/codex-manager-help.test.ts) that loads the generated help
text for the forecast/report commands and asserts it contains DEFAULT_MODEL to
prevent future drift.
lib/codex-manager.ts (1)

2542-2555: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

trim split-form --model values before validating them.

at lib/codex-manager.ts:2543, --model " " and --model " -x" still bypass the new guard because this branch checks the raw token. later lib/codex-manager.ts:2186 trims again, which silently falls back to the default or forwards a flag-like value. trim once before the empty/leading-- check, and add regressions in test/codex-manager-help.test.ts.

proposed patch
 		if (arg === "--model" || arg === "-m") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				return { ok: false, message: "Missing value for --model" };
 			}
 			options.model = value;
🤖 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/codex-manager.ts` around lines 2542 - 2555, The split-form handler for
--model/-m currently checks the raw token and lets values like "   " or "  -x"
pass; fix the branch in the if (arg === "--model" || arg === "-m") block to trim
the next token before validating (e.g., read args[i+1] into raw, compute value =
raw?.trim()), then validate (!value || value.startsWith("-")) and only then
assign options.model = value and options.modelProvided = true and increment i;
keep the equals-form logic as-is and add regression tests in
test/codex-manager-help.test.ts for inputs like --model "   " and --model " 
-x".
lib/codex-manager/commands/integrations.ts (1)

70-76: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

trim split-form --model values before checking for flags.

at lib/codex-manager/commands/integrations.ts:71, --model " " and --model " -x" still pass this branch because it inspects the raw token. that leaves the command accepting an empty/flag-like model even after this hardening pass. trim before validating, and add a regression in test/codex-manager-integrations-command.test.ts.

proposed patch
 		if (arg === "--model") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				logError("Missing value for --model");
 				return 1;
 			}
🤖 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/codex-manager/commands/integrations.ts` around lines 70 - 76, The
validation for the split-form --model option currently checks the raw token and
allows values like "   " or "  -x"; update the handler where arg === "--model"
to trim the candidate value (use the existing args array and the local value
variable) before checking for emptiness or startsWith("-"), assign the trimmed
string to model, and add a regression test in
test/codex-manager-integrations-command.test.ts that asserts rejected inputs
like `--model "   "` and `--model "  -x"` produce the expected error/exit code.
♻️ Duplicate comments (2)
scripts/check-pack-budget-lib.js (1)

16-18: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

split exact-file requirements from directory prefixes to prevent lookalike-path bypass.

the startsWith logic at scripts/check-pack-budget-lib.js:103-106 means .codex-plugin/plugin.json.bak or .codex-plugin/plugin.json~ would incorrectly satisfy the pack gate even when the real manifest is missing. this lets broken packages pass npm run pack:check. split exact-path requirements (like the manifest) into a separate REQUIRED_PATHS constant and check equality for those, keeping startsWith only for directory prefixes like dist/ and vendor/codex-ai-plugin/. add regression coverage in test/check-pack-budget.test.ts proving lookalike paths are rejected.

proposed fix (from previous review)
+export const REQUIRED_PATHS = [".codex-plugin/plugin.json"];
 export const REQUIRED_PREFIXES = [
-	".codex-plugin/plugin.json",
 	"dist/",
 	"assets/",
 	"config/",
@@
+	for (const required of REQUIRED_PATHS) {
+		if (!paths.includes(required)) {
+			throw new Error(
+				`Required package content missing from npm pack output: ${required}`,
+			);
+		}
+	}
+
 	for (const required of REQUIRED_PREFIXES) {
 		const present = paths.some(
 			(path) => path === required || path.startsWith(required),
 		);
🤖 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 `@scripts/check-pack-budget-lib.js` around lines 16 - 18, Split exact-file and
directory-prefix requirements: add a new REQUIRED_PATHS array for exact matches
(e.g., ".codex-plugin/plugin.json") and keep REQUIRED_PREFIXES for directory
prefixes like "dist/" and "vendor/codex-ai-plugin/"; then update the
existence-check logic in scripts/check-pack-budget-lib.js to test exact equality
against REQUIRED_PATHS (not startsWith) and only use startsWith for items in
REQUIRED_PREFIXES so files like ".codex-plugin/plugin.json.bak" no longer pass,
and add a regression test in test/check-pack-budget.test.ts that asserts
lookalike paths are rejected while valid exact paths and directories pass.
test/codex-manager-help.test.ts (1)

129-146: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

still missing the -m short-alias regression.

lib/codex-manager/help.ts:185 accepts -m as the alias, but this block only exercises --model and --model=. add parseBestArgs(["-m", "--json"]) (expect the Missing value for --model error) and parseBestArgs(["-m", "gpt-5.5"]) (expect success) so the alias contract is locked alongside the long forms. drift on the -m branch would ship green today.

💚 proposed regression cases
 		expect(parseBestArgs(["--model=--json"])).toEqual({
 			ok: false,
 			reason: "error",
 			message: "Missing value for --model",
 		});
+		expect(parseBestArgs(["-m", "--json"])).toEqual({
+			ok: false,
+			reason: "error",
+			message: "Missing value for --model",
+		});
+		expect(parseBestArgs(["-m", "gpt-5.5"])).toEqual({
+			ok: true,
+			options: {
+				live: false,
+				json: false,
+				model: "gpt-5.5",
+				modelProvided: true,
+			},
+		});
 	});

as per coding guidelines, "tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior."

🤖 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/codex-manager-help.test.ts` around lines 129 - 146, Add regression tests
for the `-m` short alias to the existing suite: extend the `it("rejects a
flag-like value after --model ...")` block to call `parseBestArgs(["-m",
"--json"])` and assert the same failure object (`ok: false, reason: "error",
message: "Missing value for --model"`), and add a success case
`parseBestArgs(["-m", "gpt-5.5"])` asserting the expected success result; this
ensures the `-m` alias handled in help.ts (alias at line ~185) is exercised
alongside `--model` and `--model=` so the alias contract cannot regress.
🤖 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 `@lib/codex-manager/commands/forecast.ts`:
- Around line 175-188: In the split-form branch that handles arg === "--model"
|| arg === "-m", trim the next token before validating so tokens like "   " or "
-x" are rejected like the --model= branch; specifically, read const raw =
args[i+1], compute const value = raw?.trim(), validate value for emptiness or
leading '-' and only then assign options.model = value and increment i; also add
regression tests in test/codex-manager-forecast-command.test.ts to assert that
`--model "   "` and `--model "  -x"` produce the same missing/invalid-value
behavior as the equals-form.
- Line 139: The help text is hardcoded to "gpt-5.5" instead of deriving the
default from DEFAULT_MODEL; update the usage/help string in forecast.ts to
interpolate or construct the default from the DEFAULT_MODEL constant (the same
constant used at lines ~152 and ~218) so the displayed default always matches
runtime behavior, and update the relevant test (either
test/codex-manager-forecast-command.test.ts or test/documentation.test.ts) to
assert the help output contains DEFAULT_MODEL rather than a literal version
string.

In `@lib/codex-manager/commands/report.ts`:
- Line 131: Replace the hardcoded "gpt-5.5" help text with the DEFAULT_MODEL
constant so the report command always reflects the configured default; update
the string where the option help is defined (the entry that currently reads " 
--model, -m        Probe model for live mode (default: gpt-5.5)") to interpolate
or concatenate DEFAULT_MODEL instead, and adjust the corresponding test
expectation in test/codex-manager-report-command.test.ts or
test/documentation.test.ts to assert the rendered usage contains DEFAULT_MODEL
rather than the literal "gpt-5.5". Ensure you reference the existing
DEFAULT_MODEL symbol used elsewhere in this module and do not introduce a new
literal.

In `@lib/codex-manager/repair-commands.ts`:
- Line 145: The usage text currently hardcodes "gpt-5.5" for the --model/-m
flag; replace that literal with the shared DEFAULT_MODEL constant so the CLI
help reflects the actual configured default. Locate the usage/help string that
contains '"  --model, -m        Probe model for live mode (default: gpt-5.5)"'
in repair-commands.ts and interpolate or concatenate DEFAULT_MODEL (the same
constant referenced at lines around 197 and 1200) into that message so it stays
consistent when DEFAULT_MODEL changes.

In `@test/check-pack-budget.test.ts`:
- Around line 112-128: Update the test to assert lookalike paths are rejected:
in test/check-pack-budget.test.ts add or modify a case using
validatePackMetadata so the paths array contains ".codex-plugin/plugin.json.bak"
(or similar lookalike) instead of the real manifest and assert it still throws
the same /\.codex-plugin\/plugin\.json/ error; this proves the validator
(validatePackMetadata) requires the exact ".codex-plugin/plugin.json" and will
catch the current startsWith-based acceptance in
scripts/check-pack-budget-lib.js.

---

Outside diff comments:
In `@lib/codex-manager.ts`:
- Around line 2542-2555: The split-form handler for --model/-m currently checks
the raw token and lets values like "   " or "  -x" pass; fix the branch in the
if (arg === "--model" || arg === "-m") block to trim the next token before
validating (e.g., read args[i+1] into raw, compute value = raw?.trim()), then
validate (!value || value.startsWith("-")) and only then assign options.model =
value and options.modelProvided = true and increment i; keep the equals-form
logic as-is and add regression tests in test/codex-manager-help.test.ts for
inputs like --model "   " and --model "  -x".

In `@lib/codex-manager/commands/integrations.ts`:
- Around line 70-76: The validation for the split-form --model option currently
checks the raw token and allows values like "   " or "  -x"; update the handler
where arg === "--model" to trim the candidate value (use the existing args array
and the local value variable) before checking for emptiness or startsWith("-"),
assign the trimmed string to model, and add a regression test in
test/codex-manager-integrations-command.test.ts that asserts rejected inputs
like `--model "   "` and `--model "  -x"` produce the expected error/exit code.

In `@lib/codex-manager/forecast-report-commands.ts`:
- Around line 98-125: The usage strings in printForecastUsage and
printReportUsage hardcode "gpt-5.5"; change both help messages to interpolate
the DEFAULT_MODEL constant (use DEFAULT_MODEL where the default model text
appears in printForecastUsage and printReportUsage) so the help text always
matches the parser default, and add a parity assertion in the test suite (extend
test/documentation.test.ts or create/extend test/codex-manager-help.test.ts)
that loads the generated help text for the forecast/report commands and asserts
it contains DEFAULT_MODEL to prevent future drift.

---

Duplicate comments:
In `@scripts/check-pack-budget-lib.js`:
- Around line 16-18: Split exact-file and directory-prefix requirements: add a
new REQUIRED_PATHS array for exact matches (e.g., ".codex-plugin/plugin.json")
and keep REQUIRED_PREFIXES for directory prefixes like "dist/" and
"vendor/codex-ai-plugin/"; then update the existence-check logic in
scripts/check-pack-budget-lib.js to test exact equality against REQUIRED_PATHS
(not startsWith) and only use startsWith for items in REQUIRED_PREFIXES so files
like ".codex-plugin/plugin.json.bak" no longer pass, and add a regression test
in test/check-pack-budget.test.ts that asserts lookalike paths are rejected
while valid exact paths and directories pass.

In `@test/codex-manager-help.test.ts`:
- Around line 129-146: Add regression tests for the `-m` short alias to the
existing suite: extend the `it("rejects a flag-like value after --model ...")`
block to call `parseBestArgs(["-m", "--json"])` and assert the same failure
object (`ok: false, reason: "error", message: "Missing value for --model"`), and
add a success case `parseBestArgs(["-m", "gpt-5.5"])` asserting the expected
success result; this ensures the `-m` alias handled in help.ts (alias at line
~185) is exercised alongside `--model` and `--model=` so the alias contract
cannot regress.
🪄 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: 20a713a7-f8ad-4830-af3b-8fbc8ac4e8d9

📥 Commits

Reviewing files that changed from the base of the PR and between c02494b and 72be723.

📒 Files selected for processing (29)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/repair-commands.test.ts
  • test/runtime-quota-probe.test.ts

Comment thread lib/codex-manager/commands/forecast.ts Outdated
Comment thread lib/codex-manager/commands/forecast.ts
Comment thread lib/codex-manager/commands/report.ts Outdated
Comment thread lib/codex-manager/repair-commands.ts Outdated
Comment thread test/check-pack-budget.test.ts
…t coverage

CodeRabbit round 3:
- check-pack-budget: split exact-file requirements (REQUIRED_FILES: plugin.json,
  README, LICENSE — matched by full path equality) from directory prefixes
  (REQUIRED_PREFIXES), so a sibling like '.codex-plugin/plugin.json.bak' can no
  longer satisfy the publish gate while the real manifest is missing. + regression.
- report.ts: trim the split-arg --model value before validating, so a
  whitespace-prefixed flag ('  -x') or whitespace-only token can't bypass the
  startsWith('-') guard and silently fall back to the default. + regression
  (--json / '  -x' / '   ').
- tests: added -m short-form cases to parseBestArgs (codex-manager-help.test.ts)
  and parseFixArgs, mirroring the long-form coverage.

Full suite: 4356 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Round 3 addressed in 2651824:

  • check-pack-budget (Major): split exact-file requirements (REQUIRED_FILES: plugin.json, README, LICENSE — full-path equality) from directory prefixes (REQUIRED_PREFIXES). A .codex-plugin/plugin.json.bak sibling can no longer satisfy the publish gate while the real manifest is missing. + regression test.
  • report.ts (Minor): trim the split-arg --model value before validating, so ' -x' / whitespace-only can't bypass the startsWith('-') guard. + regression (--json / ' -x' / ' ').
  • tests: added -m short-form cases to parseBestArgs + parseFixArgs.

Skipped 2 pure nitpicks (printBestUsage display-string assertion; report-test shared-const import) as cosmetic — flag if you want them.

Full suite: 4356 passed, 3 skipped, 0 failed; typecheck + lint clean.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Oops, something went wrong! Please try again later. 🐰 💔

@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.

♻️ Duplicate comments (2)
lib/codex-manager/commands/report.ts (1)

131-131: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

replace hardcoded "gpt-5.5" with the shared default constant.

line 131 still hardcodes "gpt-5.5" while lines 145 and 313 correctly use DEFAULT_MODEL. interpolate the constant so the help text stays synchronized with the next model bump.

🤖 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/codex-manager/commands/report.ts` at line 131, Replace the hardcoded
"gpt-5.5" in the help string for the --model/-m option with the shared
DEFAULT_MODEL constant so the CLI help stays in sync with future model bumps;
locate the string in lib/codex-manager/commands/report.ts (the line containing
`"  --model, -m        Probe model for live mode (default: gpt-5.5)"`) and
interpolate or concatenate DEFAULT_MODEL (the same constant used elsewhere in
this file) into that help text.
test/codex-manager-report-command.test.ts (1)

534-534: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

import the shared default model constant instead of hardcoding the literal.

line 534 still hardcodes "gpt-5.5" in the fetchCodexQuotaSnapshot assertion. import DEFAULT_MODEL from lib/request/helpers/model-map.js and use it here so the test stays aligned when the default model changes.

🤖 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/codex-manager-report-command.test.ts` at line 534, Replace the hardcoded
"gpt-5.5" literal in the fetchCodexQuotaSnapshot assertion with the shared
DEFAULT_MODEL constant: import DEFAULT_MODEL from
lib/request/helpers/model-map.js at the top of the test file and use
DEFAULT_MODEL in the assertion that currently references "gpt-5.5" so the test
follows the canonical default model; update any nearby test references to the
same literal to use DEFAULT_MODEL as well.
🤖 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.

Duplicate comments:
In `@lib/codex-manager/commands/report.ts`:
- Line 131: Replace the hardcoded "gpt-5.5" in the help string for the
--model/-m option with the shared DEFAULT_MODEL constant so the CLI help stays
in sync with future model bumps; locate the string in
lib/codex-manager/commands/report.ts (the line containing `"  --model, -m       
Probe model for live mode (default: gpt-5.5)"`) and interpolate or concatenate
DEFAULT_MODEL (the same constant used elsewhere in this file) into that help
text.

In `@test/codex-manager-report-command.test.ts`:
- Line 534: Replace the hardcoded "gpt-5.5" literal in the
fetchCodexQuotaSnapshot assertion with the shared DEFAULT_MODEL constant: import
DEFAULT_MODEL from lib/request/helpers/model-map.js at the top of the test file
and use DEFAULT_MODEL in the assertion that currently references "gpt-5.5" so
the test follows the canonical default model; update any nearby test references
to the same literal to use DEFAULT_MODEL as well.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c867aca9-52d3-4f89-b0a3-554de09292c3

📥 Commits

Reviewing files that changed from the base of the PR and between 72be723 and 2651824.

📒 Files selected for processing (6)
  • lib/codex-manager/commands/report.ts
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-report-command.test.ts
  • test/repair-commands.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (8)
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • test/check-pack-budget.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
  • test/check-pack-budget.test.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • test/check-pack-budget.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/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • test/check-pack-budget.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
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/report.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/commands/report.ts
scripts/*.js

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors

Files:

  • scripts/check-pack-budget-lib.js
🧠 Learnings (62)
📓 Common learnings
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.0.md:0-0
Timestamp: 2026-05-27T15:59:46.782Z
Learning: Applies to docs/releases/**/*.{e2e,integration}.test.{ts,js} : Add end-to-end regression coverage for pinned-503 rate-limited and cooling-down paths; extend disabled-account test case to assert new structured fields
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.1.md:0-0
Timestamp: 2026-05-21T00:32:01.979Z
Learning: Applies to docs/releases/**/model-map*.{js,ts,tsx,jsx} : Support GPT-5.5 and GPT-5.5 Pro as first-attempt models on supported Codex runtimes with deterministic fallback behavior for older runtimes
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/{codex-manager,index}.ts : Update codex-manager exports and main entry points (`lib/codex-manager.ts`, `lib/index.ts`) to include new model capability matrix functionality
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.2.md:0-0
Timestamp: 2026-05-21T00:32:54.402Z
Learning: Applies to docs/releases/{package.json,bin/**,**/*codex-multi-auth*} : `codex-multi-auth-codex` remains the explicit forwarding wrapper; `codex-multi-auth` remains the account-management command family
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{package.json,.github/**/*.yml,scripts/*.js,Makefile} : Add explicit gate in CI/build process to verify `pack:check` exits 0 and tarball inspection finds no test fixtures, `.codex/` dirs, `.env` files, or leaked dev artifacts before publishing npm package; block release on failure
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.0.1.md:0-0
Timestamp: 2026-05-21T00:32:20.873Z
Learning: Live quota probes and fallback model defaults should use current selectors including `gpt-5.3-codex` and `gpt-5.5`
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/monitor.ts : Add `codex-multi-auth monitor` command to aggregate local runtime observability, usage, account policies, routing profile context, budget guards, model capability matrix summary, quota cache counts, and current project context
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.1.md:0-0
Timestamp: 2026-05-21T00:31:02.762Z
Learning: Applies to docs/releases/src/wrapper/**/*.{ts,js} : Fix `codex-multi-auth` wrapper version flags handling
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.274Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/models.ts : Implement models command integration in `lib/codex-manager/commands/models.ts` for the model capability matrix feature
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/configuration.md:0-0
Timestamp: 2026-05-31T13:20:01.206Z
Learning: Applies to docs/config/codex-modern.json : Configuration shipped templates must expose first-class current OpenAI model aliases, with `config/codex-modern.json` including `gpt-5.5` and `gpt-5.5-pro`
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/lib/**/*.ts : Canonicalize all runtime usage and error strings in help text to use `codex-multi-auth ...` (not `codex-multi-auth auth ...` or other prefixed forms) in CLI output
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.1.md:0-0
Timestamp: 2026-05-21T00:31:02.762Z
Learning: Applies to docs/releases/src/**/openai/**/*.{ts,js} : Align GPT-5 model routing with current OpenAI defaults
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/GITHUB_DISCOVERABILITY.md:0-0
Timestamp: 2026-05-21T00:22:11.873Z
Learning: GitHub repository topics should include: codex, codex-cli, openai, chatgpt, oauth, oauth2, pkce, multi-account, cli, terminal-ui, typescript, nodejs, developer-tools, authentication, account-switching, runtime-rotation, responses-api, diagnostics, recovery-tools, account-health, quota-management, productivity
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/help.ts : Update help documentation (`lib/codex-manager/help.ts`) to document the models command and capability matrix features
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Use `npm i -g codex-multi-auth` for installation of the codex-multi-auth package
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: The package exports three global binaries: `codex-multi-auth`, `codex-multi-auth-codex`, and `codex-multi-auth-app-launcher`. Do not create a global `codex` binary; let the official OpenAI install own that command.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Store account credentials and configuration under `~/.codex/multi-auth/` by default, with support for custom root via `CODEX_MULTI_AUTH_DIR` environment variable
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Support per-project account storage at `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` for repo-specific workflows
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Implement health-aware account selection with automatic failover, quota forecasting, and flagged-account recovery logic
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Disable whole-pool replay by default when every account is rate-limited, and implement bounded outbound request budgets so one prompt cannot walk the full pool indefinitely
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Trigger a short cooldown instead of continuing aggressive rotation when repeated cross-account 5xx bursts occur
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Keep Responses background mode opt-in via `backgroundResponses` setting or `CODEX_AUTH_BACKGROUND_RESPONSES=1` environment variable, only for callers intentionally sending `background: true`
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Enable runtime rotation by default for request-bearing wrapper-launched Codex sessions, with explicit `codex-multi-auth rotation enable` and `codex-multi-auth rotation disable` repair commands
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Perform best-effort daily npm version check during forwarded Codex startup, printing manual upgrade notice only on interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`. Never automatically run npm install or update.
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Make experimental features non-destructive by default: sync previews before apply, preserve destination-only accounts, and fail safely on backup filename collisions
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Use staggered proactive refresh to reduce background refresh bursts and prevent overloading the system
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: Credentials and OAuth tokens should stay local; runtime rotation should be loopback-only for security
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T08:53:41.967Z
Learning: This is an independent open-source project, not an official OpenAI product. For production/commercial workloads, use the OpenAI Platform API instead
📚 Learning: 2026-05-21T00:22:26.487Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies fix command flag documentation is aligned consistently across README.md, docs/reference/commands.md, and CLI runtime usage text

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:22:54.020Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_COMMAND.md:0-0
Timestamp: 2026-05-21T00:22:54.020Z
Learning: Applies to docs/development/test/documentation.test.ts : Update `test/documentation.test.ts` if new command text must stay aligned across docs and runtime usage text

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:23:03.577Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/test/documentation.test.ts : Extend `test/documentation.test.ts` when command text or help changes to ensure docs parity

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:34:47.250Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: test/AGENTS.md:0-0
Timestamp: 2026-05-21T00:34:47.250Z
Learning: Applies to test/**/documentation.test.ts : Test documentation parity including command flags, config precedence, changelog policy, and governance rules

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
📚 Learning: 2026-05-21T00:22:54.020Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_COMMAND.md:0-0
Timestamp: 2026-05-21T00:22:54.020Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend CLI tests covering success path, invalid input or missing args, JSON mode if supported, and non-interactive behavior in `test/codex-manager-cli.test.ts`

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:22:26.487Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies compatibility command aliases are scoped to reference, troubleshooting, and migration documentation with explicit allowlist enforcement

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
📚 Learning: 2026-05-21T00:23:03.577Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend `test/codex-manager-cli.test.ts` with test coverage for new command paths

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:32:08.338Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.2.md:0-0
Timestamp: 2026-05-21T00:32:08.338Z
Learning: Applies to docs/releases/**/*.test.{js,ts} : Add regression coverage for explicit no-capture forwarding, explicit capture forwarding, unsupported-model retries, and fixture-pinned `CODEX_HOME` isolation in test suite

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:30:00.875Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.2.md:0-0
Timestamp: 2026-05-21T00:30:00.875Z
Learning: Applies to docs/releases/**/*.test.{js,ts,mjs,cjs} : Expand regression coverage for backup-depth recovery, staged rename retries, and parallel-save ordering guarantees in test suites

Applied to files:

  • test/repair-commands.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:30:21.731Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.5.md:0-0
Timestamp: 2026-05-21T00:30:21.731Z
Learning: Run `npx vitest run test/test-model-matrix-script.test.ts` as part of release validation

Applied to files:

  • test/repair-commands.test.ts
  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:27:54.022Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/reference/commands.md:0-0
Timestamp: 2026-05-21T00:27:54.022Z
Learning: codex-multi-auth verify runs self-tests for storage paths (process.cwd, findProjectRoot, resolveProjectStorageIdentityRoot, getProjectStorageKey, getProjectConfigDir, getProjectGlobalConfigDir) and sandbox probes that reject escape candidates; modes include --paths, --flagged, or --all

Applied to files:

  • test/repair-commands.test.ts
📚 Learning: 2026-05-21T00:19:02.858Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-K-tests.md:0-0
Timestamp: 2026-05-21T00:19:02.858Z
Learning: Applies to docs/audits/evidence/test/flagged-storage-io.test.ts : Add regression test for storage recovery non-atomicity issue (E-03) in flagged-storage-io tests

Applied to files:

  • test/repair-commands.test.ts
📚 Learning: 2026-05-21T00:27:54.022Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/reference/commands.md:0-0
Timestamp: 2026-05-21T00:27:54.022Z
Learning: Use --dry-run flag with verify-flagged, verify (with --flagged or --all), fix, and doctor to preview changes without writing storage

Applied to files:

  • test/repair-commands.test.ts
📚 Learning: 2026-05-21T00:15:46.683Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/DOCUMENTATION.md:0-0
Timestamp: 2026-05-21T00:15:46.683Z
Learning: Applies to docs/reference/commands.md : Verify CLI flags documented in references match runtime parser/usage output

Applied to files:

  • test/repair-commands.test.ts
📚 Learning: 2026-05-21T00:26:08.267Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-12-integration-generators.md:0-0
Timestamp: 2026-05-21T00:26:08.267Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/codex-manager-integrations-command.test.ts : Add tests for the codex-manager integrations command

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
📚 Learning: 2026-05-21T00:21:13.269Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CLI_UI_DEEPSEARCH_AUDIT.md:0-0
Timestamp: 2026-05-21T00:21:13.269Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Ensure regression test coverage proving `Q` cancel discards modified drafts across account-list, summary-fields, behavior, theme, and backend flows

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:25:34.447Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/{model-capability-matrix,codex-manager-models-command,test-model-matrix-script}.test.ts : Ensure test coverage for model capability matrix with test files `test/model-capability-matrix.test.ts`, `test/codex-manager-models-command.test.ts`, and `test/test-model-matrix-script.test.ts`

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:25:34.447Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/models.ts : Implement models command integration in `lib/codex-manager/commands/models.ts` for the model capability matrix feature

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:30:28.313Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.6.md:0-0
Timestamp: 2026-05-21T00:30:28.313Z
Learning: Applies to docs/releases/test/codex-cli-state.test.ts : Run tests for Codex CLI state validation: `npm test -- test/codex-cli-state.test.ts`

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:25:34.447Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/{codex-manager,index}.ts : Update codex-manager exports and main entry points (`lib/codex-manager.ts`, `lib/index.ts`) to include new model capability matrix functionality

Applied to files:

  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:32:01.979Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.1.md:0-0
Timestamp: 2026-05-21T00:32:01.979Z
Learning: Applies to docs/releases/**/model-map*.{js,ts,tsx,jsx} : Support GPT-5.5 and GPT-5.5 Pro as first-attempt models on supported Codex runtimes with deterministic fallback behavior for older runtimes

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:32:20.873Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.0.1.md:0-0
Timestamp: 2026-05-21T00:32:20.873Z
Learning: Live quota probes and fallback model defaults should use current selectors including `gpt-5.3-codex` and `gpt-5.5`

Applied to files:

  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-06-02T12:30:22.274Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.0.md:0-0
Timestamp: 2026-06-02T12:30:22.274Z
Learning: Applies to docs/releases/**/quota*.{js,ts,tsx} : Detect unsupported Codex model from upstream error `detail` shape and surface a friendly 'Codex unavailable' note across `best` / `forecast` / `report` / live-check surfaces instead of leaking raw upstream text

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:25:34.447Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/help.ts : Update help documentation (`lib/codex-manager/help.ts`) to document the models command and capability matrix features

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:34:47.250Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: test/AGENTS.md:0-0
Timestamp: 2026-05-21T00:34:47.250Z
Learning: Applies to test/**/codex-manager-cli.test.ts : Test CLI settings with question cancellation across all 5 panels and EBUSY/concurrent race conditions

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:25:46.114Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/codex-manager-monitor-command.test.ts : Create comprehensive test coverage for the monitor command including runtime policy validation

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:30:54.269Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.1.10.md:0-0
Timestamp: 2026-05-21T00:30:54.269Z
Learning: Include comprehensive validation and JSON output coverage for auth CLI commands, including help, malformed flags, null storage, concurrency, and sync-state edge cases

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:18:12.895Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/*.ts : Standardize `--json` flag support across all subcommands (`list`, `switch`, `check`, `forecast`, `fix`, `report`, `doctor`, `verify-flagged`) to ensure uniform JSON output capability

Applied to files:

  • test/codex-manager-report-command.test.ts
  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:30:44.991Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.8.md:0-0
Timestamp: 2026-05-21T00:30:44.991Z
Learning: Applies to docs/releases/**/*{dashboard,cli}*.{test,spec}.{ts,tsx,js,jsx} : Dashboard and CLI test harness coverage must be expanded to cover experimental settings and wrapper behavior

Applied to files:

  • test/codex-manager-report-command.test.ts
📚 Learning: 2026-05-21T00:18:12.895Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/*.ts : Verify and document `codex --help` output parity with README subcommand enumeration to ensure help discoverability

Applied to files:

  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:30:10.391Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.3.md:0-0
Timestamp: 2026-05-21T00:30:10.391Z
Learning: Applies to docs/releases/test/**/*.test.ts : Validate releases by running `npm run test -- test/codex-manager-cli.test.ts` to ensure regression coverage

Applied to files:

  • test/codex-manager-help.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:23:03.577Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/lib/codex-manager.ts : Add the smallest possible parsing/dispatch change in `lib/codex-manager.ts` when adding a new `codex-multi-auth` command

Applied to files:

  • test/codex-manager-help.test.ts
  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:23:03.577Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_MANAGER_COMMAND.md:0-0
Timestamp: 2026-05-21T00:23:03.577Z
Learning: Applies to docs/development/lib/codex-manager/**/*.ts : Extract command helpers under `lib/codex-manager/` when a command has more than one logical branch instead of growing the main file

Applied to files:

  • test/codex-manager-help.test.ts
📚 Learning: 2026-05-27T15:54:51.791Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.12.md:0-0
Timestamp: 2026-05-27T15:54:51.791Z
Learning: Applies to docs/releases/**/*.test.{js,ts,py} : Add regression coverage for literal TOML keys, CRLF preservation, table-like content inside strings and arrays, alternate hook paths, long hook keys, shadow `hooks.json` visibility, and concurrent runtime shadow launches

Applied to files:

  • test/codex-manager-help.test.ts
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:17:08.066Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/MASTER_AUDIT.md:0-0
Timestamp: 2026-05-21T00:17:08.066Z
Learning: Applies to docs/audits/lib/codex-manager.ts : Standardize `--json` output format across all `codex auth` subcommands (status, check, list, forecast, report, verify-flagged, doctor, fix) with consistent schema versioning

Applied to files:

  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:22:26.487Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/lib/**/*.ts : Canonicalize all runtime usage and error strings in help text to use `codex-multi-auth ...` (not `codex-multi-auth auth ...` or other prefixed forms) in CLI output

Applied to files:

  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:22:26.487Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Extend Windows cross-platform verification patterns in `test/documentation.test.ts` to include explicit `codex-multi-auth` output-escaping checks for cmd.exe and PowerShell whenever new shell-sensitive command rendering is introduced

Applied to files:

  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:31:02.762Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.1.md:0-0
Timestamp: 2026-05-21T00:31:02.762Z
Learning: Applies to docs/releases/src/**/openai/**/*.{ts,js} : Align GPT-5 model routing with current OpenAI defaults

Applied to files:

  • lib/codex-manager/commands/report.ts
📚 Learning: 2026-05-21T00:19:18.672Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-LM-release-docs.md:0-0
Timestamp: 2026-05-21T00:19:18.672Z
Learning: Applies to docs/audits/evidence/{package.json,.npmignore,scripts/build.js} : Fix `npm run pack:check` failure — required package content missing from npm pack output: `dist/` directory must be included in published tarball

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:20:06.769Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{package.json,scripts/*.js,dist/**} : Ensure `pack:check` gate passes on all build artifacts; inspect tarball manifest to verify no `.env`, test fixtures, `.codex/`, or dev-only artifacts containing tokens/credentials are included in npm package

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:20:06.769Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{package.json,.github/**/*.yml,scripts/*.js,Makefile} : Add explicit gate in CI/build process to verify `pack:check` exits 0 and tarball inspection finds no test fixtures, `.codex/` dirs, `.env` files, or leaked dev artifacts before publishing npm package; block release on failure

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:31:50.443Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.0.md:0-0
Timestamp: 2026-05-21T00:31:50.443Z
Learning: Applies to docs/releases/**/{package.json,build.ts,scripts/*.ts} : Run `pack:check` build before running tests to ensure package integrity

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:52:04.720Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.11.md:0-0
Timestamp: 2026-05-21T00:52:04.720Z
Learning: Applies to docs/releases/**/*.{test,spec}.{js,ts} : Implement a plugin manifest integrity test that validates JSON parsing, package-version parity between package.json and plugin.json, and icon path resolution

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:30:44.991Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.8.md:0-0
Timestamp: 2026-05-21T00:30:44.991Z
Learning: Applies to docs/releases/**/{package.json,package-lock.json,yarn.lock,pnpm-lock.yaml,Gemfile,requirements.txt,go.mod,Cargo.lock} : Ensure dependencies are maintained for audit compliance (e.g., hono library versions)

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:25:04.938Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-03-usage-command.md:0-0
Timestamp: 2026-05-21T00:25:04.938Z
Learning: All code changes must pass `npm run build` validation

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:17:08.066Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/MASTER_AUDIT.md:0-0
Timestamp: 2026-05-21T00:17:08.066Z
Learning: Applies to docs/audits/.github/workflows/*.yml : Add CI gate that runs `npm run pack:check` and fails PR on tarball size regression to prevent unintended files in npm distribution

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:25:04.938Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-03-usage-command.md:0-0
Timestamp: 2026-05-21T00:25:04.938Z
Learning: All code changes must pass `npm test` with relevant test files

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:33:34.237Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.6.md:0-0
Timestamp: 2026-05-21T00:33:34.237Z
Learning: Applies to docs/releases/**/scripts/{install,uninstall}*.js : Pre-filter falsy entries with `list.filter(Boolean)` in `removePluginFromList` to match `scripts/install-codex-auth-utils.js` behavior

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:17:54.509Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-E-storage.md:0-0
Timestamp: 2026-05-21T00:17:54.509Z
Learning: Applies to docs/audits/evidence/lib/storage/paths.ts : Fix the known regression in `resolvePath()` that fails to reliably reject lookalike-prefix paths on current HEAD. Harden `isWithinDirectory()` to guard import/export paths against sibling lookalike paths outside approved home/project/tmp roots.

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:19:02.858Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-K-tests.md:0-0
Timestamp: 2026-05-21T00:19:02.858Z
Learning: Applies to docs/audits/evidence/test/paths.test.ts : Add regression test for resolvePath() lookalike prefix validation in test/paths.test.ts (currently failing at line 846)

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:20:06.769Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{lib/storage/paths.ts,test/paths.test.ts} : Harden `isWithinDirectory()` in `lib/storage/paths.ts` to reject lookalike-prefix paths that bypass `resolvePath()` guard; add regression tests matching `test/paths.test.ts:842-846` failure case

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:31:37.957Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.7.md:0-0
Timestamp: 2026-05-21T00:31:37.957Z
Learning: Applies to docs/releases/**/*.test.{ts,js},**/*.spec.{ts,js},**/tests/**,**/__tests__/** : Harden native resolver edge cases and validate stale test expectations around native Codex path handling

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:19:02.858Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-K-tests.md:0-0
Timestamp: 2026-05-21T00:19:02.858Z
Learning: Applies to docs/audits/evidence/test/plugin-config.test.ts : Update test/plugin-config.test.ts:417 to verify correct CONFIG_PATH precedence behavior

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:32:54.402Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.2.md:0-0
Timestamp: 2026-05-21T00:32:54.402Z
Learning: Applies to docs/releases/{package.json,bin/**} : Drop the global `codex` bin to avoid npm bin collisions with official Codex npm, native, and Homebrew distributions

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:29:48.217Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.1.md:0-0
Timestamp: 2026-05-21T00:29:48.217Z
Learning: Applies to docs/releases/bin/codex{,.js,.ts} : The `codex` bin wrapper must lazy-load auth runtime to prevent early module-load failures in clean/global installs

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-06-03T06:06:56.303Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.2.1.md:0-0
Timestamp: 2026-06-03T06:06:56.303Z
Learning: Applies to docs/releases/**/*resolver*.js : The Codex bin resolver must skip any PATH candidate inside its own wrapper directory

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:31:37.957Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.7.md:0-0
Timestamp: 2026-05-21T00:31:37.957Z
Learning: Applies to docs/releases/**/wrapper/**,**/launcher/**,**/*wrapper*.{sh,bat,cmd,js,ts},**/*launcher*.{sh,bat,cmd,js,ts},**/bin/**,**/scripts/** : Support native Codex CLI installs alongside npm launcher flow by discovering Codex CLI on PATH for Homebrew and release-binary installs

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:19:18.672Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-LM-release-docs.md:0-0
Timestamp: 2026-05-21T00:19:18.672Z
Learning: Applies to docs/audits/evidence/scripts/codex.js : Ensure `npm run build` completes successfully before auth commands in CLI: build artifacts in `dist/lib/codex-manager.js` are required for auth-related operations

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-05-21T00:17:08.066Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/MASTER_AUDIT.md:0-0
Timestamp: 2026-05-21T00:17:08.066Z
Learning: Applies to docs/audits/test/paths.test.ts : Add regression test for `resolvePath()` lookalike-prefix rejection covering home-directory siblings, project-directory siblings, and tmp-directory siblings on Windows and POSIX systems

Applied to files:

  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:22:26.487Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies scoped package references appear only in explicit legacy migration documentation contexts

Applied to files:

  • test/check-pack-budget.test.ts
📚 Learning: 2026-05-21T00:31:02.762Z
Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.1.md:0-0
Timestamp: 2026-05-21T00:31:02.762Z
Learning: Applies to docs/releases/src/**/*.test.{ts,js} : Validate shipped config templates in test coverage

Applied to files:

  • test/check-pack-budget.test.ts
🔇 Additional comments (6)
scripts/check-pack-budget-lib.js (1)

16-24: LGTM!

Also applies to: 108-114

test/check-pack-budget.test.ts (1)

130-149: LGTM!

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

169-169: LGTM!

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

146-152: LGTM!

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

95-104: LGTM!

test/repair-commands.test.ts (1)

179-187: LGTM!

… assertion

CodeRabbit (non-blocking): the report --model help text and the live-probe test
assertion still hardcoded 'gpt-5.5'. Reference the shared DEFAULT_MODEL constant
so CLI help and the regression stay aligned with the next model bump.

Full suite: 4356 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Cleared the last 2 (non-blocking) items in 0db5069: the report --model help string and the live-probe test assertion now reference the shared DEFAULT_MODEL constant instead of a hardcoded 'gpt-5.5'.

Every actionable finding across all review rounds is now resolved (--model flag-guard on all 9 sites + short forms + trim, exact-file pack gate, warnings column, DEFAULT_MODEL consolidation, all regressions). Full suite: 4356 passed, 0 failed; typecheck + lint clean; Greptile pass.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@ndycode solid close-out. DEFAULT_MODEL as the shared constant across all help strings, parse sites, and test assertions is the right call — no scattered 'gpt-5.5' literals leaking through. the REQUIRED_FILES / REQUIRED_PREFIXES split in scripts/check-pack-budget-lib.js is also a meaningful correctness fix, not just cosmetic. every item tracked across rounds is resolved. triggering full review now.


✏️ Learnings added
Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, the canonical default live/quota probe model is `gpt-5.5`, exposed as `DEFAULT_MODEL` (imported from `lib/request/helpers/model-map.ts`). This constant is the single source of truth used across all `--model` parse sites (9 sites: `lib/codex-manager.ts`, `lib/codex-manager/help.ts`, `lib/codex-manager/repair-commands.ts`, `lib/codex-manager/forecast-report-commands.ts`, `lib/codex-manager/commands/best.ts`, `lib/codex-manager/commands/forecast.ts`, `lib/codex-manager/commands/report.ts`, `lib/codex-manager/commands/integrations.ts`, `lib/codex-manager/commands/models.ts`), help strings, and test assertions. The old `gpt-5.3-codex` hardcoded default has been removed.

Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, `scripts/check-pack-budget-lib.js` exports two separate lists: `REQUIRED_FILES` (exact full-path equality check for `.codex-plugin/plugin.json`, `README.md`, `LICENSE`) and `REQUIRED_PREFIXES` (directory prefix checks for `dist/`, `assets/`, etc.). This split prevents a sibling file like `.codex-plugin/plugin.json.bak` from satisfying the exact-file publish gate. Tests for this live in `test/check-pack-budget.test.ts`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Full review finished.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (8)
lib/codex-manager.ts (2)

2542-2548: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

trim split-arg --model values before validating.

at lib/codex-manager.ts:2542-2548, the split-arg path still checks the raw token. best --model " " and best -m " --json" both bypass the missing/flag-like guard, set modelProvided = true, and then quietly fall back later via lib/codex-manager.ts:2186. trim before the empty/startsWith("-") checks so this matches the new cli contract.

proposed fix
 		if (arg === "--model" || arg === "-m") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				return { ok: false, message: "Missing value for --model" };
 			}
 			options.model = value;
🤖 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/codex-manager.ts` around lines 2542 - 2548, When parsing the --model / -m
split-arg in the argument loop, trim the extracted value before performing the
empty and startsWith("-") checks and before assigning to options.model; i.e.,
replace checks against the raw value with checks against value.trim() and set
options.model to the trimmed string and options.modelProvided only when the
trimmed value is non-empty and not flag-like. This affects the branch handling
arg === "--model" || arg === "-m" where options.model and options.modelProvided
are set.

2407-2415: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

add the missing refresh-fail live-probe regression.

lib/codex-manager.ts:2407-2415 is now the user-visible signed in only path for forceRefresh + liveProbe + queuedRefresh failure with a still-valid session, but this review cohort does not include the matching vitest in test/codex-manager-cli.test.ts. add a deterministic case that asserts both the per-account warning row and the final codex available | signed in only | need re-login summary so this token-refresh race does not drift silently.

as per coding guidelines, test/**: tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior.

🤖 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/codex-manager.ts` around lines 2407 - 2415, Add a deterministic vitest
regression in test/codex-manager-cli.test.ts that reproduces the forceRefresh +
liveProbe + queuedRefresh failure while sessionLikelyValid is true: stub/mocking
the refresh path (queuedRefresh/forceRefresh) to throw/return failure, mock
liveProbe to fail, and ensure the session validity flag remains true; then run
the CLI/manager routine that emits the per-account row (the code path using
sessionLikelyValid, liveProbe, signedInOnly, display.showPerAccountRows,
stylePromptText, labelText) and assert the console output contains the
per-account warning row and the final summary line including "codex available |
signed in only | need re-login"; use vitest timers/mocks to keep the test
deterministic and avoid real concurrency/file IO.
lib/codex-manager/commands/integrations.ts (1)

70-78: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

trim --model value before validation.

lib/codex-manager/commands/integrations.ts:71 reads args[i + 1] without trimming before the guard at line 72. tokens like " " will pass the !value check (non-empty string) and the .startsWith("-") check (no leading dash), but represent a missing value. trim before validating to match the equals-form pattern at lib/codex-manager/commands/models.ts:56 and reject whitespace-only tokens.

proposed fix
 if (arg === "--model") {
-  const value = args[i + 1];
-  if (!value || value.startsWith("-")) {
+  const raw = args[i + 1];
+  const value = raw?.trim();
+  if (!value || value.startsWith("-")) {
     logError("Missing value for --model");
     return 1;
   }
   model = value;
🤖 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/codex-manager/commands/integrations.ts` around lines 70 - 78, The --model
argument handling reads args[i + 1] into value without trimming, so
whitespace-only tokens like "   " bypass the existing checks; update the parsing
in the integrations command to trim the token first (e.g., const raw = args[i +
1]; const value = raw?.trim()), then validate that value is non-empty and does
not start with "-" before assigning to model and advancing i, ensuring you store
the trimmed value into model; refer to the same argument parsing block that
checks arg === "--model" and the variables args, i, value, and model.
test/codex-manager-integrations-command.test.ts (1)

4-31: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

missing regression tests for --model flag-like rejection.

test/codex-manager-integrations-command.test.ts covers the invalid --kind path at lines 22-30, but the new guard at lib/codex-manager/commands/integrations.ts:72 that rejects --model -x and --model "" has no corresponding regression coverage. add test cases asserting that runIntegrationsCommand(["--model", "-x"], deps) and runIntegrationsCommand(["--model", " "], deps) both return exit code 1 with error message "Missing value for --model".

🤖 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/codex-manager-integrations-command.test.ts` around lines 4 - 31, Add two
regression tests to test/codex-manager-integrations-command.test.ts that assert
the new --model guard in integrations.ts returns a failure: call
runIntegrationsCommand(["--model","-x"], { logInfo: vi.fn(), logError }) and
runIntegrationsCommand(["--model","   "], { logInfo: vi.fn(), logError }) (where
logError = vi.fn()), expect each exit code toBe(1) and expect
String(logError.mock.calls[0]?.[0]) toContain "Missing value for --model"; place
them alongside the existing "rejects invalid kinds" test and reuse the same
runIntegrationsCommand helper so the tests exercise the guard at
integrations.ts:72.
lib/codex-manager/commands/models.ts (1)

45-53: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

trim --model value before validation.

lib/codex-manager/commands/models.ts:46 reads args[i + 1] without trimming before the guard at line 47. tokens like " " will pass the !value check (non-empty string) and the .startsWith("-") check, but represent a missing value. trim before validating to match the equals-form behavior at line 56 and reject whitespace-only tokens consistently.

proposed fix
 if (arg === "--model") {
-  const value = args[i + 1];
-  if (!value || value.startsWith("-")) {
+  const raw = args[i + 1];
+  const value = raw?.trim();
+  if (!value || value.startsWith("-")) {
     logError("Missing value for --model");
     return 1;
   }
   models.push(value);
🤖 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/codex-manager/commands/models.ts` around lines 45 - 53, In the argument
parsing branch that handles the "--model" flag (the block that reads const value
= args[i + 1] and pushes into models), trim the retrieved value first (e.g.,
const raw = args[i + 1]; const value = raw && raw.trim()) and then perform the
existing guards (check for falsy/empty after trim and startsWith("-")) so
whitespace-only tokens are rejected the same way as the equals-form handling;
update the push to use the trimmed value and keep the index increment and
continue behavior unchanged.
lib/codex-manager/forecast-report-commands.ts (1)

145-151: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

trim split --model values before validating them.

lib/codex-manager/forecast-report-commands.ts:145 and lib/codex-manager/forecast-report-commands.ts:186 still validate the raw argv token. --model " --json" bypasses the new flag-like guard, and --model " gpt-5.5 " keeps the surrounding spaces while the --model= path trims them. trim first, then run the missing/flag check in both parsers.

suggested fix
 		if (arg === "--model" || arg === "-m") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				return { ok: false, message: "Missing value for --model" };
 			}
 			options.model = value;
 			i += 1;
 			continue;
 		}

Also applies to: 186-192

🤖 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/codex-manager/forecast-report-commands.ts` around lines 145 - 151, The
--model parsing branches validate the raw argv token so values like '"  --json"'
or '" gpt-5.5 "' bypass checks or keep surrounding spaces; fix both places that
handle --model (the branch checking arg === "--model" || arg === "-m" where
value is taken as args[i+1], and the branch that parses "--model=...") by
trimming the extracted value (e.g., value = value.trim()) before performing the
missing/flag check (value === "" or value.startsWith("-")) and before assigning
to options.model, and ensure you still increment i in the positional form.
lib/codex-manager/help.ts (1)

185-195: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

trim split-arg --model before validating it.

at lib/codex-manager/help.ts:186, the parser checks the raw token. values like " " or " --json" bypass this guard and get accepted as a model. trim first, then validate.

proposed patch
 		if (arg === "--model" || arg === "-m") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				return {
 					ok: false,
 					reason: "error",
 					message: "Missing value for --model",
 				};
 			}
 			options.model = value;
🤖 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/codex-manager/help.ts` around lines 185 - 195, The parser currently
validates the raw token for the --model/-m flag (variables arg, value,
options.model, options.modelProvided) which accepts whitespace-only or
leading-whitespace tokens; fix by trimming the next token before validation
(e.g., compute a trimmedValue from args[i+1] safely), then check trimmedValue
for falsiness or trimmedValue.startsWith("-") and assign options.model =
trimmedValue and options.modelProvided = true only after passing validation.
lib/codex-manager/repair-commands.ts (1)

215-221: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

trim split-arg --model in parseFixArgs before validation.

at lib/codex-manager/repair-commands.ts:216, raw token validation allows " " or " --json" through. normalize with .trim() first, then apply the missing/flag-like checks.

proposed patch
 		if (argValue === "--model" || argValue === "-m") {
-			const value = args[i + 1];
+			const value = args[i + 1]?.trim();
 			if (!value || value.startsWith("-")) {
 				return { ok: false, message: "Missing value for --model" };
 			}
 			options.model = value;
🤖 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/codex-manager/repair-commands.ts` around lines 215 - 221, In
parseFixArgs, the validation for the --model/-m token uses the raw next token
without trimming, so whitespace-only values like "   " or tokens with leading
spaces pass validation; update the logic in parseFixArgs (the branch handling
argValue === "--model" || argValue === "-m") to call .trim() on the candidate
value before checking for falsiness or whether it startsWith("-"), then assign
the trimmed value to options.model and increment i as before.
🤖 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 `@lib/codex-manager/forecast-report-commands.ts`:
- Line 107: The help text for the probe model flags currently hardcodes
"gpt-5.5"; update the two help strings (the ones that read "Probe model for live
mode (default: gpt-5.5)" and its quota/probe counterpart) to reference the
single source-of-truth DEFAULT_MODEL constant instead of the literal, e.g. build
the string using DEFAULT_MODEL so the help text always reflects the real
default; also ensure DEFAULT_MODEL is imported/available in
forecast-report-commands.ts (the same constant used at the other default
usages).

In `@lib/quota-probe.ts`:
- Around line 56-62: DEFAULT_QUOTA_PROBE_MODELS currently hardcodes "gpt-5.5" as
the first probe candidate causing split-brain when the canonical default_model
changes; update the probe stacks to use the runtime canonical default_model as
the first element instead of a hardcoded string. Replace the first entry in
DEFAULT_QUOTA_PROBE_MODELS (and the analogous array in
lib/runtime/quota-probe.ts) to insert the exported default_model (or read the
same default_model constant/value) as the first probe candidate, keeping the
remaining fallback model names in the same order so both quota-probe.ts and
runtime/quota-probe.ts share the same source-of-truth for the initial probe
target.

In `@lib/runtime-rotation-proxy.ts`:
- Around line 729-730: The code currently remaps missing request model into
DEFAULT_MODEL by calling getModelFamily(model ?? DEFAULT_MODEL), which causes
pass-through /codex/responses requests to be classified as gpt-5.2; change this
to preserve pass-through semantics by only calling getModelFamily when a model
is provided (e.g., use getModelFamily(model) or conditional logic that leaves
family undefined/null when model is absent) so that codex requests without an
explicit model remain in the neutral codex bucket; update the logic around
parsedBody?.stream and any downstream usage that expects a family to handle an
undefined family value and add tests covering the no-model codex path.

In `@test/codex-manager-cli.test.ts`:
- Around line 3279-3350: Add a deterministic test near the existing case that
exercises the refresh-fail + still-valid session branch: create an account whose
expiresAt is in the future (so session is still valid), mock queuedRefreshMock
to reject (simulate refresh failure) and ensure fetchCodexQuotaSnapshotMock is
either not called for that account or rejects with CodexUnavailableError as
appropriate, then call runCodexMultiAuthCli(["auth","check"]) and assert the
output increments the "signed in only" count (and includes
CODEX_UNAVAILABLE_PROBE_NOTE_LITERAL on that row) while not counting it as
"working" or incrementing codexAvailable; reference runCodexMultiAuthCli,
queuedRefreshMock, fetchCodexQuotaSnapshotMock and
CODEX_UNAVAILABLE_PROBE_NOTE_LITERAL when locating where to add the test.

In `@test/codex-manager-help.test.ts`:
- Around line 129-153: Add deterministic regression tests for whitespace and
leading-space flag-like model values in parseBestArgs: add assertions that
parseBestArgs(["--model", "   "]) and parseBestArgs(["--model", "  --json"])
both return { ok: false, reason: "error", message: "Missing value for --model" }
(and mirror for the short alias -m if appropriate), so the split-arg parsing
treats pure-whitespace or leading-space flag-like tokens as missing values
rather than valid model names; update test/codex-manager-help.test.ts around the
existing flag-like cases to include these two new expectations referencing
parseBestArgs.
- Around line 92-99: The test currently hardcodes "gpt-5.5" in the expected
payload for parseBestArgs; change it to import and use DEFAULT_MODEL instead so
the assertion follows the single source of truth. Update
test/codex-manager-help.test.ts to import DEFAULT_MODEL from its module and
replace the literal "gpt-5.5" in the expect(...) object with DEFAULT_MODEL,
keeping the rest of the expected shape (ok: true, options: { live:false,
json:false, modelProvided:false }) unchanged.

In `@test/codex-manager-integrations-command.test.ts`:
- Line 18: The test currently asserts a hardcoded string 'model="gpt-5.5"'
against payload.snippets[0]?.body which will break when the default model
changes; import DEFAULT_MODEL from lib/request/helpers/model-map.js at the top
of the test file and replace the literal expectation with a derived one that
asserts payload.snippets[0]?.body contains `model="${DEFAULT_MODEL}"`, keeping
the test in sync with runtime; ensure the import is added and the assertion uses
the DEFAULT_MODEL symbol rather than a hardcoded string.

In `@test/documentation.test.ts`:
- Line 339: The test is hardcoding the default model string in the docs parity
assertion; import and use the single source of truth DEFAULT_MODEL instead of
the literal "gpt-5.5" so the test follows future default-model changes—update
the assertion in test/documentation.test.ts (the expect(readme).toContain(...)
line) to import DEFAULT_MODEL from its module and assert
expect(readme).toContain(`codex-multi-auth fix --live --model ${DEFAULT_MODEL}`)
(or equivalent string concatenation), ensuring any needed export/import path and
type/string conversion are handled.

In `@test/quota-probe.test.ts`:
- Around line 87-101: Add a deterministic regression test that simulates gpt-5.5
failing and verifies the fallback to gpt-5.4: call fetchCodexQuotaSnapshot (the
function under test) with vi.stubGlobal("fetch") returning a first Response
representing gpt-5.5 unsupported (e.g., 404/empty headers) and a second Response
with successful quota headers for gpt-5.4, then assert snapshot.model ===
"gpt-5.4", that getCodexInstructionsMock was invoked with "gpt-5.4", and that
the fetch mock was called twice; this ensures the reordered candidate chain in
quota-probe (the probe logic that tries "gpt-5.5" then "gpt-5.4") correctly
falls back rather than skipping gpt-5.4 under failure.

In `@test/repair-commands.test.ts`:
- Around line 165-187: Update the "parseFixArgs rejects a flag-like value after
--model instead of consuming it" test to include edge-case assertions for
whitespace-only model tokens: call parseFixArgs(["--model", "   "]) and
parseFixArgs(["--model", "  --json"]) (and their short-form counterparts like
["-m", "   "] if desired) and assert they return { ok: false, message: "Missing
value for --model" }, so parseFixArgs correctly rejects whitespace-only or
whitespace-prefixed flag-looking values instead of treating them as valid model
names.

---

Outside diff comments:
In `@lib/codex-manager.ts`:
- Around line 2542-2548: When parsing the --model / -m split-arg in the argument
loop, trim the extracted value before performing the empty and startsWith("-")
checks and before assigning to options.model; i.e., replace checks against the
raw value with checks against value.trim() and set options.model to the trimmed
string and options.modelProvided only when the trimmed value is non-empty and
not flag-like. This affects the branch handling arg === "--model" || arg ===
"-m" where options.model and options.modelProvided are set.
- Around line 2407-2415: Add a deterministic vitest regression in
test/codex-manager-cli.test.ts that reproduces the forceRefresh + liveProbe +
queuedRefresh failure while sessionLikelyValid is true: stub/mocking the refresh
path (queuedRefresh/forceRefresh) to throw/return failure, mock liveProbe to
fail, and ensure the session validity flag remains true; then run the
CLI/manager routine that emits the per-account row (the code path using
sessionLikelyValid, liveProbe, signedInOnly, display.showPerAccountRows,
stylePromptText, labelText) and assert the console output contains the
per-account warning row and the final summary line including "codex available |
signed in only | need re-login"; use vitest timers/mocks to keep the test
deterministic and avoid real concurrency/file IO.

In `@lib/codex-manager/commands/integrations.ts`:
- Around line 70-78: The --model argument handling reads args[i + 1] into value
without trimming, so whitespace-only tokens like "   " bypass the existing
checks; update the parsing in the integrations command to trim the token first
(e.g., const raw = args[i + 1]; const value = raw?.trim()), then validate that
value is non-empty and does not start with "-" before assigning to model and
advancing i, ensuring you store the trimmed value into model; refer to the same
argument parsing block that checks arg === "--model" and the variables args, i,
value, and model.

In `@lib/codex-manager/commands/models.ts`:
- Around line 45-53: In the argument parsing branch that handles the "--model"
flag (the block that reads const value = args[i + 1] and pushes into models),
trim the retrieved value first (e.g., const raw = args[i + 1]; const value = raw
&& raw.trim()) and then perform the existing guards (check for falsy/empty after
trim and startsWith("-")) so whitespace-only tokens are rejected the same way as
the equals-form handling; update the push to use the trimmed value and keep the
index increment and continue behavior unchanged.

In `@lib/codex-manager/forecast-report-commands.ts`:
- Around line 145-151: The --model parsing branches validate the raw argv token
so values like '"  --json"' or '" gpt-5.5 "' bypass checks or keep surrounding
spaces; fix both places that handle --model (the branch checking arg ===
"--model" || arg === "-m" where value is taken as args[i+1], and the branch that
parses "--model=...") by trimming the extracted value (e.g., value =
value.trim()) before performing the missing/flag check (value === "" or
value.startsWith("-")) and before assigning to options.model, and ensure you
still increment i in the positional form.

In `@lib/codex-manager/help.ts`:
- Around line 185-195: The parser currently validates the raw token for the
--model/-m flag (variables arg, value, options.model, options.modelProvided)
which accepts whitespace-only or leading-whitespace tokens; fix by trimming the
next token before validation (e.g., compute a trimmedValue from args[i+1]
safely), then check trimmedValue for falsiness or trimmedValue.startsWith("-")
and assign options.model = trimmedValue and options.modelProvided = true only
after passing validation.

In `@lib/codex-manager/repair-commands.ts`:
- Around line 215-221: In parseFixArgs, the validation for the --model/-m token
uses the raw next token without trimming, so whitespace-only values like "   "
or tokens with leading spaces pass validation; update the logic in parseFixArgs
(the branch handling argValue === "--model" || argValue === "-m") to call
.trim() on the candidate value before checking for falsiness or whether it
startsWith("-"), then assign the trimmed value to options.model and increment i
as before.

In `@test/codex-manager-integrations-command.test.ts`:
- Around line 4-31: Add two regression tests to
test/codex-manager-integrations-command.test.ts that assert the new --model
guard in integrations.ts returns a failure: call
runIntegrationsCommand(["--model","-x"], { logInfo: vi.fn(), logError }) and
runIntegrationsCommand(["--model","   "], { logInfo: vi.fn(), logError }) (where
logError = vi.fn()), expect each exit code toBe(1) and expect
String(logError.mock.calls[0]?.[0]) toContain "Missing value for --model"; place
them alongside the existing "rejects invalid kinds" test and reuse the same
runIntegrationsCommand helper so the tests exercise the guard at
integrations.ts:72.
🪄 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: dddc0240-a025-4d41-830f-8edb654a06a2

📥 Commits

Reviewing files that changed from the base of the PR and between c02494b and 0db5069.

📒 Files selected for processing (29)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/repair-commands.test.ts
  • test/runtime-quota-probe.test.ts

Comment thread lib/codex-manager/forecast-report-commands.ts Outdated
Comment thread lib/runtime-rotation-proxy.ts Outdated
Comment thread test/codex-manager-cli.test.ts
Comment thread test/codex-manager-help.test.ts
Comment thread test/codex-manager-help.test.ts
Comment thread test/codex-manager-integrations-command.test.ts Outdated
Comment thread test/documentation.test.ts Outdated
Comment thread test/quota-probe.test.ts
Comment thread test/repair-commands.test.ts
…nly regression

CodeRabbit round 4:
- consistency: every split-arg --model/-m parser now trims (args[i+1]?.trim())
  before the missing/flag-like guard, matching the already-trimmed --model= forms.
  Whitespace-only ('   ') and leading-space flags ('  --json') no longer slip
  through and silently fall back to the default. Sites: codex-manager.ts
  (parseBestArgs), forecast.ts, forecast-report-commands.ts (x2), help.ts
  (parseBestArgs), repair-commands.ts (parseFixArgs), integrations.ts, models.ts.
  report.ts was already trimmed.
- tests: added whitespace-only rejection cases (parseBestArgs/parseFixArgs/forecast)
  + integrations --model -x / '   ' coverage + a deep-check regression asserting a
  transient refresh failure with a still-valid session lands as 'signed in only'
  (not 'need re-login') with the per-account warning row.

Full suite: 4360 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Round 4 addressed in 4754e2b:

  • trim consistency: every split-arg --model/-m parser now trims before the missing/flag-like guard (matching the --model= forms), so ' ' / ' --json' can't slip through to the default fallback. Sites: parseBestArgs (codex-manager.ts + help.ts), forecast, forecast-report ×2, parseFixArgs, integrations, models. (report.ts was already trimmed.)
  • tests: whitespace-only rejection for parseBestArgs/parseFixArgs/forecast; integrations --model -x / ' ' coverage; and a deep-check regression asserting a transient refresh failure with a still-valid session lands as signed in only (not need re-login) with the per-account warning row — covering the live-summary path.

Full suite: 4360 passed, 3 skipped, 0 failed; typecheck + lint clean.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@ndycode the trim-before-guard consistency sweep is the right finishing touch — ' ' and ' --json' bypassing the startsWith('-') check was a real gap across the split-arg parse sites. covering parseBestArgs (codex-manager.ts:* + help.ts:*), forecast-report ×2, parseFixArgs, integrations, and models in one pass is clean. the deep-check regression for the transient-refresh-fail → signedInOnly path in lib/codex-manager.ts closes the last branch greptile flagged. suite at 4360 (+4 from round 3) tracks correctly with the new cases. triggering full review now.


✏️ Learnings added
Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T10:07:04.084Z
Learning: In ndycode/codex-multi-auth, all split-arg `--model`/`-m` parse sites trim the value *before* the missing/flag-like guard (`startsWith('-')` check), so whitespace-only values (`'   '`) and strings like `'  --json'` are rejected consistently. Sites: `parseBestArgs` in `lib/codex-manager.ts` and `lib/codex-manager/help.ts`, `parseForecastArgs` in `lib/codex-manager/commands/forecast.ts` and `lib/codex-manager/forecast-report-commands.ts` (×2), `parseFixArgs` in `lib/codex-manager/repair-commands.ts`, integrations in `lib/codex-manager/commands/integrations.ts`, models in `lib/codex-manager/commands/models.ts`. `parseReportArgs` in `lib/codex-manager/commands/report.ts` was trimmed before round 4. The `--model=<value>` forms have always trimmed; this round aligned the split-arg forms to match.

Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T10:07:04.084Z
Learning: In ndycode/codex-multi-auth, the sessionLikelyValid refresh-fail path in `lib/codex-manager.ts` that increments `signedInOnly` in liveProbe mode now has dedicated vitest regression coverage (added in commit `4754e2b`, PR `#506` round 4), asserting the account lands as `signed in only` (not `need re-login`) with the per-account warning row visible in the live-summary output.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, the canonical default live/quota probe model is `gpt-5.5`, exposed as `DEFAULT_MODEL` (imported from `lib/request/helpers/model-map.ts`). This constant is the single source of truth used across all `--model` parse sites (9 sites: `lib/codex-manager.ts`, `lib/codex-manager/help.ts`, `lib/codex-manager/repair-commands.ts`, `lib/codex-manager/forecast-report-commands.ts`, `lib/codex-manager/commands/best.ts`, `lib/codex-manager/commands/forecast.ts`, `lib/codex-manager/commands/report.ts`, `lib/codex-manager/commands/integrations.ts`, `lib/codex-manager/commands/models.ts`), help strings, and test assertions. The old `gpt-5.3-codex` hardcoded default has been removed.

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{lib/refresh-queue.ts,lib/storage.ts,index.ts} : Mark `lib/refresh-queue.ts` refresh-queue race deduplication, atomic writes on primary/flagged/settings storage, and 4-gate request-loop termination (`index.ts:*`) as load-bearing invariants; verify all refactors (especially R4 routing mutex) preserve these invariants with dedicated regression tests before merge

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CLI_UI_DEEPSEARCH_AUDIT.md:0-0
Timestamp: 2026-05-21T00:21:13.269Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Ensure regression test coverage proving `Q` cancel discards modified drafts across account-list, summary-fields, behavior, theme, and backend flows

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.0.md:0-0
Timestamp: 2026-05-27T15:59:46.782Z
Learning: Applies to docs/releases/**/*.{e2e,integration}.test.{ts,js} : Add end-to-end regression coverage for pinned-503 rate-limited and cooling-down paths; extend disabled-account test case to assert new structured fields

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.2.md:0-0
Timestamp: 2026-05-21T00:32:08.338Z
Learning: Applies to docs/releases/**/*.test.{js,ts} : Add regression coverage for explicit no-capture forwarding, explicit capture forwarding, unsupported-model retries, and fixture-pinned `CODEX_HOME` isolation in test suite

Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, `scripts/check-pack-budget-lib.js` exports two separate lists: `REQUIRED_FILES` (exact full-path equality check for `.codex-plugin/plugin.json`, `README.md`, `LICENSE`) and `REQUIRED_PREFIXES` (directory prefix checks for `dist/`, `assets/`, etc.). This split prevents a sibling file like `.codex-plugin/plugin.json.bak` from satisfying the exact-file publish gate. Tests for this live in `test/check-pack-budget.test.ts`.

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.12.md:0-0
Timestamp: 2026-05-27T15:54:51.791Z
Learning: Applies to docs/releases/**/*.test.{js,ts,py} : Add regression coverage for literal TOML keys, CRLF preservation, table-like content inside strings and arrays, alternate hook paths, long hook keys, shadow `hooks.json` visibility, and concurrent runtime shadow launches

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_COMMAND.md:0-0
Timestamp: 2026-05-21T00:22:54.020Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend CLI tests covering success path, invalid input or missing args, JSON mode if supported, and non-interactive behavior in `test/codex-manager-cli.test.ts`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies fix command flag documentation is aligned consistently across README.md, docs/reference/commands.md, and CLI runtime usage text

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.1.md:0-0
Timestamp: 2026-05-31T02:33:07.408Z
Learning: Applies to docs/releases/**/*{*.test,*.spec}.{ts,js} : Add unit tests for label disambiguation coverage and `formatWorkspaceLines` output covering active markers, disabled annotations, and indentation

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/*.ts : Standardize `--json` flag support across all subcommands (`list`, `switch`, `check`, `forecast`, `fix`, `report`, `doctor`, `verify-flagged`) to ensure uniform JSON output capability

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: test/AGENTS.md:0-0
Timestamp: 2026-05-21T00:34:47.250Z
Learning: Applies to test/**/documentation.test.ts : Test documentation parity including command flags, config precedence, changelog policy, and governance rules

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.1.md:0-0
Timestamp: 2026-05-31T02:33:07.408Z
Learning: Applies to docs/releases/**/*{*.test,*.spec}.{ts,js} : Add unit tests for schema round-trip preservation including workspace-load regression tests to lock in the fix

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.1.md:0-0
Timestamp: 2026-05-21T00:32:01.979Z
Learning: Applies to docs/releases/**/model-map*.{js,ts,tsx,jsx} : Support GPT-5.5 and GPT-5.5 Pro as first-attempt models on supported Codex runtimes with deterministic fallback behavior for older runtimes

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/{codex-manager,index}.ts : Update codex-manager exports and main entry points (`lib/codex-manager.ts`, `lib/index.ts`) to include new model capability matrix functionality

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/monitor.ts : Add `codex-multi-auth monitor` command to aggregate local runtime observability, usage, account policies, routing profile context, budget guards, model capability matrix summary, quota cache counts, and current project context

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CLI_UI_DEEPSEARCH_AUDIT.md:0-0
Timestamp: 2026-05-21T00:21:13.269Z
Learning: Applies to docs/development/lib/codex-manager.ts : Implement account health safeguards including circuit breaker support, rate-limit reason handling, and hybrid account selection using health and token buckets

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.2.md:0-0
Timestamp: 2026-05-21T00:32:54.402Z
Learning: Applies to docs/releases/{package.json,bin/**,**/*codex-multi-auth*} : `codex-multi-auth-codex` remains the explicit forwarding wrapper; `codex-multi-auth` remains the account-management command family

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/GITHUB_DISCOVERABILITY.md:0-0
Timestamp: 2026-05-21T00:22:11.873Z
Learning: Repository description on GitHub should be: 'Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for openai/codex'

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/GITHUB_DISCOVERABILITY.md:0-0
Timestamp: 2026-05-21T00:22:11.873Z
Learning: GitHub repository topics should include: codex, codex-cli, openai, chatgpt, oauth, oauth2, pkce, multi-account, cli, terminal-ui, typescript, nodejs, developer-tools, authentication, account-switching, runtime-rotation, responses-api, diagnostics, recovery-tools, account-health, quota-management, productivity

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v0.1.0-beta.0.md:0-0
Timestamp: 2026-05-21T00:29:31.294Z
Learning: Update scoped prerelease package installations from ndycode/codex-multi-auth to codex-multi-auth during migration to stable releases
✅ Action performed

Full review finished.

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

♻️ Duplicate comments (2)
lib/quota-probe.ts (1)

56-62: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

source the probe fallback list from default_model.

lib/quota-probe.ts:56 and lib/runtime/quota-probe.ts:5 still hardcode the first probe candidate, so the next default bump will desync probe order from the cli/help/cache path again. please derive both lists from DEFAULT_MODEL and pin it with test/quota-probe.test.ts and test/runtime-quota-probe.test.ts. based on learnings the canonical default live/quota probe model is DEFAULT_MODEL, the single source of truth across parse sites, help strings, and test assertions.

🤖 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/quota-probe.ts` around lines 56 - 62, The hardcoded probe candidate array
DEFAULT_QUOTA_PROBE_MODELS should be derived from the single source of truth
DEFAULT_MODEL: replace the literal first entry (and any duplicates) by building
DEFAULT_QUOTA_PROBE_MODELS so its first element equals DEFAULT_MODEL and the
rest remain the current fallbacks; update the equivalent list in runtime code to
reference the same DEFAULT_MODEL-derived list (use the same symbol name or
export/import to avoid duplication), and update/pin the tests
test/quota-probe.test.ts and test/runtime-quota-probe.test.ts to assert against
DEFAULT_MODEL as the canonical first probe candidate so future default bumps
stay in sync.
lib/codex-manager/commands/forecast.ts (1)

139-139: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

derive the forecast help default from default_model.

lib/codex-manager/commands/forecast.ts:139 still prints gpt-5.5 literally while lib/codex-manager/commands/forecast.ts:152 and lib/codex-manager/commands/forecast.ts:218 already source the runtime default from DEFAULT_MODEL. that will drift on the next model change. please render this line from the constant and cover it in test/codex-manager-forecast-command.test.ts or test/documentation.test.ts. based on learnings the canonical default live/quota probe model is DEFAULT_MODEL, the single source of truth across parse sites, help strings, and test assertions.

🤖 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/codex-manager/commands/forecast.ts` at line 139, The help string in
forecast.ts currently hardcodes "gpt-5.5"; change it to interpolate the
DEFAULT_MODEL constant so the displayed default comes from the single source of
truth (DEFAULT_MODEL) used elsewhere (e.g., where DEFAULT_MODEL is referenced at
lines around 152 and 218). Update the help definition for the "--model, -m" flag
in the forecast command to render DEFAULT_MODEL instead of the literal, and add
or update a test (in test/codex-manager-forecast-command.test.ts or
test/documentation.test.ts) that asserts the generated help output contains the
DEFAULT_MODEL value to prevent future drift.
🤖 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 `@test/codex-manager-cli.test.ts`:
- Line 748: Replace hardcoded "gpt-5.5" usages in the test suite with the
canonical constant: import DEFAULT_MODEL from "lib/request/helpers/model-map.ts"
at the top of test/codex-manager-cli.test.ts and update every occurrence where a
test constructs or asserts the model (e.g., the object key model: "gpt-5.5" and
any assertions comparing strings) to reference DEFAULT_MODEL instead; ensure all
listed spots (around the occurrences near the model property and related
assertions) use DEFAULT_MODEL so tests rely on the single source of truth rather
than a literal string.
- Around line 7023-7070: The test currently returns a queuedRefreshMock result
with { type: "error", ... } but lib/codex-manager.ts (around the refresh
handling that reads queuedRefresh results) and lib/refresh-queue.ts use a
different TokenResult discriminator; update the test's mocked result to use the
same discriminator value and shape used by TokenResult in lib/refresh-queue.ts
(e.g., change queuedRefreshMock.mockResolvedValueOnce to return the actual
non-success discriminator and expected fields), so the mock matches
queuedRefresh and the runCodexMultiAuthCli auth flow (referencing
queuedRefreshMock and the refresh handling in lib/codex-manager.ts).

In `@test/runtime-quota-probe.test.ts`:
- Line 45: The test currently hardcodes "gpt-5.5" for the default model; instead
import the canonical DEFAULT_MODEL constant and use it in the assertion so the
test follows the single source of truth. Replace the literal in the assertion
that checks snapshot.model with DEFAULT_MODEL, and add the appropriate import
for DEFAULT_MODEL at the top of the test file so the assertion reads
expect(snapshot.model).toBe(DEFAULT_MODEL).

---

Duplicate comments:
In `@lib/codex-manager/commands/forecast.ts`:
- Line 139: The help string in forecast.ts currently hardcodes "gpt-5.5"; change
it to interpolate the DEFAULT_MODEL constant so the displayed default comes from
the single source of truth (DEFAULT_MODEL) used elsewhere (e.g., where
DEFAULT_MODEL is referenced at lines around 152 and 218). Update the help
definition for the "--model, -m" flag in the forecast command to render
DEFAULT_MODEL instead of the literal, and add or update a test (in
test/codex-manager-forecast-command.test.ts or test/documentation.test.ts) that
asserts the generated help output contains the DEFAULT_MODEL value to prevent
future drift.

In `@lib/quota-probe.ts`:
- Around line 56-62: The hardcoded probe candidate array
DEFAULT_QUOTA_PROBE_MODELS should be derived from the single source of truth
DEFAULT_MODEL: replace the literal first entry (and any duplicates) by building
DEFAULT_QUOTA_PROBE_MODELS so its first element equals DEFAULT_MODEL and the
rest remain the current fallbacks; update the equivalent list in runtime code to
reference the same DEFAULT_MODEL-derived list (use the same symbol name or
export/import to avoid duplication), and update/pin the tests
test/quota-probe.test.ts and test/runtime-quota-probe.test.ts to assert against
DEFAULT_MODEL as the canonical first probe candidate so future default bumps
stay in sync.
🪄 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: dfbee02f-8a4b-43e8-bd3a-8310ad6421ab

📥 Commits

Reviewing files that changed from the base of the PR and between c02494b and 4754e2b.

📒 Files selected for processing (29)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/repair-commands.test.ts
  • test/runtime-quota-probe.test.ts

Comment thread test/codex-manager-cli.test.ts Outdated
Comment thread test/codex-manager-cli.test.ts
Comment thread test/runtime-quota-probe.test.ts Outdated
…gle-source

CodeRabbit round 5 (all 10 unresolved threads):

Behavioral (Major):
- runtime-rotation-proxy: a model-less /codex/responses request fell back to
  DEFAULT_MODEL (gpt-5.5 -> family gpt-5.2), mis-bucketing a codex pass-through
  into the wrong rotation/cooldown/budget family. Restore codex-family bucketing
  via CURRENT_CODEX_MODEL (gpt-5.3-codex -> gpt-5-codex), the prior behavior, now
  named instead of a bare literal.

Consistency / drift (help text, probe candidates, tests now derive from the
single source DEFAULT_MODEL instead of a hardcoded 'gpt-5.5'):
- forecast / fix / forecast-report usage strings
- lib/quota-probe.ts + lib/runtime/quota-probe.ts first probe candidate
- test assertions: help (parseBestArgs + new printBestUsage regression),
  integrations, documentation parity, runtime-quota-probe, forecast help
- new quota-probe regression for the default -> gpt-5.4 fallback chain

Value-neutral (DEFAULT_MODEL is still 'gpt-5.5'); only removes literal drift.
Full suite: 4362 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Round 5 — all 10 unresolved threads addressed in 15b34f2:

Behavioral (Major): runtime-rotation-proxy — a model-less /codex/responses request fell back to DEFAULT_MODEL (gpt-5.5 → family gpt-5.2), mis-bucketing a codex pass-through into the wrong rotation/cooldown/budget family. Restored codex-family bucketing via CURRENT_CODEX_MODEL (→ gpt-5-codex), the prior behavior, now named not literal.

Consistency (single-source DEFAULT_MODEL, no more hardcoded 'gpt-5.5'): forecast/fix/forecast-report usage strings; quota-probe + runtime/quota-probe first candidate; test assertions (parseBestArgs + new printBestUsage regression, integrations, documentation parity, runtime-quota-probe, forecast help); + new quota-probe regression for the default→gpt-5.4 fallback chain.

Value-neutral (DEFAULT_MODEL still 'gpt-5.5'). Full suite: 4362 passed, 0 failed; typecheck + lint clean; Greptile pass.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@ndycode the runtime-rotation-proxy.ts behavioral fix is the most meaningful change in this round — DEFAULT_MODEL (gpt-5.5 → gpt-5.2 family) was the wrong fallback for a model-less codex pass-through; CURRENT_CODEX_MODEL (→ gpt-5-codex family) restoring the prior bucketing is correct. the single-source consistency sweep on the remaining hardcoded 'gpt-5.5' literals and the quota-probe default→gpt-5.4 fallback chain regression close out the last open threads. triggering full review now.


✏️ Learnings added
Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T10:33:03.622Z
Learning: In ndycode/codex-multi-auth, `lib/runtime-rotation-proxy.ts` uses `CURRENT_CODEX_MODEL` (resolves to `gpt-5-codex`, codex family) — not `DEFAULT_MODEL` — as the fallback when deriving the Responses API request context `family` via `getModelFamily(model ?? CURRENT_CODEX_MODEL)` for model-less `/codex/responses` requests. Using `DEFAULT_MODEL` (gpt-5.5 → gpt-5.2 family) was a regression introduced in round 4 that mis-bucketed codex pass-throughs into the wrong rotation/cooldown/budget family; `CURRENT_CODEX_MODEL` was restored in commit `15b34f2` (PR `#506` round 5). `DEFAULT_MODEL` remains the correct fallback for quota-probe and CLI `--model` parse sites only.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T10:07:04.084Z
Learning: In ndycode/codex-multi-auth, all split-arg `--model`/`-m` parse sites trim the value *before* the missing/flag-like guard (`startsWith('-')` check), so whitespace-only values (`'   '`) and strings like `'  --json'` are rejected consistently. Sites: `parseBestArgs` in `lib/codex-manager.ts` and `lib/codex-manager/help.ts`, `parseForecastArgs` in `lib/codex-manager/commands/forecast.ts` and `lib/codex-manager/forecast-report-commands.ts` (×2), `parseFixArgs` in `lib/codex-manager/repair-commands.ts`, integrations in `lib/codex-manager/commands/integrations.ts`, models in `lib/codex-manager/commands/models.ts`. `parseReportArgs` in `lib/codex-manager/commands/report.ts` was trimmed before round 4. The `--model=<value>` forms have always trimmed; this round aligned the split-arg forms to match.

Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, the canonical default live/quota probe model is `gpt-5.5`, exposed as `DEFAULT_MODEL` (imported from `lib/request/helpers/model-map.ts`). This constant is the single source of truth used across all `--model` parse sites (9 sites: `lib/codex-manager.ts`, `lib/codex-manager/help.ts`, `lib/codex-manager/repair-commands.ts`, `lib/codex-manager/forecast-report-commands.ts`, `lib/codex-manager/commands/best.ts`, `lib/codex-manager/commands/forecast.ts`, `lib/codex-manager/commands/report.ts`, `lib/codex-manager/commands/integrations.ts`, `lib/codex-manager/commands/models.ts`), help strings, and test assertions. The old `gpt-5.3-codex` hardcoded default has been removed.

Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T10:07:04.084Z
Learning: In ndycode/codex-multi-auth, the sessionLikelyValid refresh-fail path in `lib/codex-manager.ts` that increments `signedInOnly` in liveProbe mode now has dedicated vitest regression coverage (added in commit `4754e2b`, PR `#506` round 4), asserting the account lands as `signed in only` (not `need re-login`) with the per-account warning row visible in the live-summary output.

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CLI_UI_DEEPSEARCH_AUDIT.md:0-0
Timestamp: 2026-05-21T00:21:13.269Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Ensure regression test coverage proving `Q` cancel discards modified drafts across account-list, summary-fields, behavior, theme, and backend flows

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/*.ts : Standardize `--json` flag support across all subcommands (`list`, `switch`, `check`, `forecast`, `fix`, `report`, `doctor`, `verify-flagged`) to ensure uniform JSON output capability

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/MASTER_AUDIT.md:0-0
Timestamp: 2026-05-21T00:17:08.066Z
Learning: Applies to docs/audits/lib/codex-manager.ts : Standardize `--json` output format across all `codex auth` subcommands (status, check, list, forecast, report, verify-flagged, doctor, fix) with consistent schema versioning

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/RUNBOOK_ADD_AUTH_COMMAND.md:0-0
Timestamp: 2026-05-21T00:22:54.020Z
Learning: Applies to docs/development/test/codex-manager-cli.test.ts : Add or extend CLI tests covering success path, invalid input or missing args, JSON mode if supported, and non-interactive behavior in `test/codex-manager-cli.test.ts`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/dim-G-cli.md:0-0
Timestamp: 2026-05-21T00:18:12.895Z
Learning: Applies to docs/audits/evidence/lib/codex-manager/cli-commands/**/auth*.ts : Preserve `codex auth doctor --fix` as the canonical safe-recovery command with documented trust and safety guarantees

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/IA_FINDABILITY_AUDIT_2026-03-01.md:0-0
Timestamp: 2026-05-21T00:22:26.487Z
Learning: Applies to docs/development/test/documentation.test.ts : Maintain deterministic regression test in `test/documentation.test.ts` that verifies fix command flag documentation is aligned consistently across README.md, docs/reference/commands.md, and CLI runtime usage text

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{lib/refresh-queue.ts,lib/storage.ts,index.ts} : Mark `lib/refresh-queue.ts` refresh-queue race deduplication, atomic writes on primary/flagged/settings storage, and 4-gate request-loop termination (`index.ts:*`) as load-bearing invariants; verify all refactors (especially R4 routing mutex) preserve these invariants with dedicated regression tests before merge

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.3.1.md:0-0
Timestamp: 2026-05-21T00:32:01.979Z
Learning: Applies to docs/releases/**/model-map*.{js,ts,tsx,jsx} : Support GPT-5.5 and GPT-5.5 Pro as first-attempt models on supported Codex runtimes with deterministic fallback behavior for older runtimes

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.13-beta.0.md:0-0
Timestamp: 2026-05-27T15:59:46.782Z
Learning: Applies to docs/releases/**/*.{e2e,integration}.test.{ts,js} : Add end-to-end regression coverage for pinned-503 rate-limited and cooling-down paths; extend disabled-account test case to assert new structured fields

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-08-runtime-policy-integration.md:0-0
Timestamp: 2026-05-21T00:25:39.859Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/**/*.test.ts : Runtime policy tests must pass including runtime-policy, runtime-rotation-proxy, index, failure-policy, request-transformer, and stream-failover test suites

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/codex-manager/commands/monitor.ts : Add `codex-multi-auth monitor` command to aggregate local runtime observability, usage, account policies, routing profile context, budget guards, model capability matrix summary, quota cache counts, and current project context

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-09-monitor-command.md:0-0
Timestamp: 2026-05-21T00:25:46.114Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/test/codex-manager-monitor-command.test.ts : Create comprehensive test coverage for the monitor command including runtime policy validation

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/audits/evidence/oracle-verdicts.md:0-0
Timestamp: 2026-05-21T00:20:06.769Z
Learning: Applies to docs/audits/evidence/{lib/stream-failover.ts,lib/response-handler.ts,docs/audits/**/*.md} : Spot-check AUDIT-H9/M16-M19 file:line citations in dim-H (salvaged agent output) against actual source; verify references to `response-handler.ts` 10MB buffer, `stream-failover.ts` emittedBytes guard, and similar claims match code before prioritizing Phase-1 fixes

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.0.1.md:0-0
Timestamp: 2026-05-21T00:32:20.873Z
Learning: Live quota probes and fallback model defaults should use current selectors including `gpt-5.3-codex` and `gpt-5.5`

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/CONFIG_FLOW.md:0-0
Timestamp: 2026-05-21T00:21:49.644Z
Learning: Applies to docs/development/**/*{rotation,proxy,forward}*.{ts,js,py} : Runtime rotation flow: (1) Resolve CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY environment variable or read pluginConfig.codexRuntimeRotationProxy (defaults to enabled), (2) If disabled or forwarded command is help/non-requesting, forward directly to official Codex, (3) If enabled, start loopback Responses proxy with per-process client token, (4) Create temporary shadow CODEX_HOME and rewrite config.toml to use codex-multi-auth-runtime-proxy, (5) Forward official Codex with shadow home, (6) Proxy selects/refreshes managed accounts and rotates on rate limit/auth/network/server failure before streaming, (7) On process exit, sync refreshed state files and remove shadow home.

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/TESTING.md:0-0
Timestamp: 2026-05-21T00:23:57.518Z
Learning: Before approving large runtime, manager, or storage refactors, run guardrail test suites: index, index-retry, runtime-rotation-proxy, runtime-rotation-proxy-safe-equal, codex-bin-wrapper, codex-manager-cli, storage, storage-async, storage-recovery-paths, and paths tests

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v1.2.1.md:0-0
Timestamp: 2026-05-21T00:31:02.762Z
Learning: Applies to docs/releases/src/**/openai/**/*.{ts,js} : Align GPT-5 model routing with current OpenAI defaults

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/TESTING.md:0-0
Timestamp: 2026-05-21T00:23:57.518Z
Learning: Run failure-mode scenario tests to verify OAuth callback port conflict handling, invalid/expired refresh token behavior, rate-limiting scenarios, runtime rotation pool exhaustion, runtime proxy compression, shadow-home sync failures, storage write errors, unsupported model handling, and stream stall failover

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/implementation-plans/subagent-handoffs/pr-07-model-capability-matrix.md:0-0
Timestamp: 2026-05-21T00:25:34.447Z
Learning: Applies to docs/development/implementation-plans/subagent-handoffs/lib/{codex-manager,index}.ts : Update codex-manager exports and main entry points (`lib/codex-manager.ts`, `lib/index.ts`) to include new model capability matrix functionality

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/development/GITHUB_DISCOVERABILITY.md:0-0
Timestamp: 2026-05-21T00:22:11.873Z
Learning: Repository description on GitHub should be: 'Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for openai/codex'

Learnt from: CR
Repo: ndycode/codex-multi-auth PR: 0
File: docs/releases/v2.1.2.md:0-0
Timestamp: 2026-05-21T00:32:54.402Z
Learning: Applies to docs/releases/{package.json,bin/**,**/*codex-multi-auth*} : `codex-multi-auth-codex` remains the explicit forwarding wrapper; `codex-multi-auth` remains the account-management command family
✅ Action performed

Full review finished.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
lib/codex-manager/commands/report.ts (1)

403-427: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

use the patched identity in the change detector.

at lib/codex-manager/commands/report.ts:403, the gate still compares previousEmail/previousAccountId against the pre-patch account object. if a refresh only changes derived identity fields carried in refreshPatch, this path skips both persistRefreshedAccountPatch() and applyRefreshedAccountPatch(), so the report keeps stale identity data for the rest of the command.

proposed fix
+				const nextEmail = refreshPatch.email ?? account.email;
+				const nextAccountId = refreshPatch.accountId ?? account.accountId;
 				if (
 					previousRefreshToken !== refreshPatch.refreshToken ||
 					previousAccessToken !== refreshPatch.accessToken ||
 					previousExpiresAt !== refreshPatch.expiresAt ||
-					previousEmail !== account.email ||
-					previousAccountId !== account.accountId
+					previousEmail !== nextEmail ||
+					previousAccountId !== nextAccountId
 				) {
 					try {
 						await persistRefreshedAccountPatch(
 							storage,
 							accountMatch,
 							refreshPatch,
 							deps.loadAccounts,
 							deps.saveAccounts,
 						);
 					} catch (error) {
 						const message = deps.normalizeFailureDetail(
 							error instanceof Error ? error.message : String(error),
 							undefined,
 						);
 						probeErrors.push(`${formatAccountLabel(account, i)}: ${message}`);
 						continue;
 					}
 					applyRefreshedAccountPatch(account, refreshPatch);
 				}

please add a vitest regression in test/codex-manager-report-command.test.ts that reproduces the identity-only patch case, so this does not drift again. as per coding guidelines, "lib/**: focus on auth rotation, windows filesystem io, and concurrency. verify every change cites affected tests (vitest)".

🤖 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/codex-manager/commands/report.ts` around lines 403 - 427, The
change-detection gate compares previousEmail/previousAccountId against the
pre-patch account and therefore ignores identity-only patches carried in
refreshPatch; update the condition so it compares previousEmail and
previousAccountId against the post-patch identity (i.e. the values in
refreshPatch when present) before skipping persistence, ensuring
persistRefreshedAccountPatch and applyRefreshedAccountPatch run for
identity-only updates; then add a vitest regression in
test/codex-manager-report-command.test.ts that simulates a refreshPatch
containing only email/accountId changes and asserts the report reflects the
patched identity after the command completes.
lib/codex-manager/forecast-report-commands.ts (1)

145-160: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

pull the --model validation into one helper.

lib/codex-manager/forecast-report-commands.ts:145-160 and lib/codex-manager/forecast-report-commands.ts:186-201 now duplicate the same trim + flag-like guard. this exact parsing contract already drifted across commands in earlier rounds, so keeping two copies here makes the next change easy to miss. a small shared helper in this file would keep forecast/report locked to the same behavior that test/codex-manager-forecast-command.test.ts:141-161 and test/codex-manager-report-command.test.ts:96-105 are asserting.

Also applies to: 186-201

🤖 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/codex-manager/forecast-report-commands.ts` around lines 145 - 160, There
are two duplicated validation blocks for the --model flag in
forecast-report-commands.ts; create a small helper like getModelValue(arg:
string, next?: string) (or parseModelFlag) that accepts either the current arg
and optional next arg, performs trim() and the startsWith("-") guard, and
returns a normalized { ok, value?, message? } result; then replace both the
"--model"/"-m" branch and the "--model=" branch to call this helper, set
options.model on success, and return the helper's error message on failure so
both parsing paths share identical validation behavior used by the tests.
♻️ Duplicate comments (1)
test/repair-commands.test.ts (1)

165-192: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

cover the trimmed short-form -m regressions too.

test/repair-commands.test.ts:165 still does not exercise the short-form branch with trimmed-empty or whitespace-prefixed flag-like values, so a regression in lib/codex-manager/repair-commands.ts:216-218 could slip through while this suite stays green. add ["-m", " "] and ["-m", " --json"] next to the existing long-form cases.

suggested additions
 		expect(parseFixArgs(["-m", "--json"])).toEqual({
 			ok: false,
 			message: "Missing value for --model",
 		});
+		expect(parseFixArgs(["-m", "   "])).toEqual({
+			ok: false,
+			message: "Missing value for --model",
+		});
+		expect(parseFixArgs(["-m", "  --json"])).toEqual({
+			ok: false,
+			message: "Missing value for --model",
+		});
 		// A real model value is still accepted (both long and short forms).

as per coding guidelines test/**: tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior.

🤖 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/repair-commands.test.ts` around lines 165 - 192, Add test cases
exercising the short-form model flag in parseFixArgs to cover trimmed-empty and
whitespace-prefixed flag-like values: extend the existing test block that checks
"--model" behavior to also expect parseFixArgs(["-m", "   "]) and
parseFixArgs(["-m", "  --json"]) to return { ok: false, message: "Missing value
for --model" }, and keep the positive short-form case parseFixArgs(["-m",
"gpt-5.5"]).ok toBe(true); this ensures the short-form branch in
lib/codex-manager/repair-commands.ts (around the -m handling) is exercised and
prevents regressions.
🤖 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 `@lib/quota-probe.ts`:
- Around line 57-63: The duplicated ordered model list
(DEFAULT_QUOTA_PROBE_MODELS) is defined in two places; extract it into a single
exported constant in a shared module and have both the quota probe
implementation and the runtime quota probe import and use that constant instead
of redefining the array. Update references that currently use the local array
(the quota probe code that uses DEFAULT_QUOTA_PROBE_MODELS and the runtime probe
module that repeats the list) to import the shared symbol, and adjust the tests
that assert the probe fallback chain to reference the same exported
constant/contract so there is a single source of truth for the fallback chain.

---

Outside diff comments:
In `@lib/codex-manager/commands/report.ts`:
- Around line 403-427: The change-detection gate compares
previousEmail/previousAccountId against the pre-patch account and therefore
ignores identity-only patches carried in refreshPatch; update the condition so
it compares previousEmail and previousAccountId against the post-patch identity
(i.e. the values in refreshPatch when present) before skipping persistence,
ensuring persistRefreshedAccountPatch and applyRefreshedAccountPatch run for
identity-only updates; then add a vitest regression in
test/codex-manager-report-command.test.ts that simulates a refreshPatch
containing only email/accountId changes and asserts the report reflects the
patched identity after the command completes.

In `@lib/codex-manager/forecast-report-commands.ts`:
- Around line 145-160: There are two duplicated validation blocks for the
--model flag in forecast-report-commands.ts; create a small helper like
getModelValue(arg: string, next?: string) (or parseModelFlag) that accepts
either the current arg and optional next arg, performs trim() and the
startsWith("-") guard, and returns a normalized { ok, value?, message? } result;
then replace both the "--model"/"-m" branch and the "--model=" branch to call
this helper, set options.model on success, and return the helper's error message
on failure so both parsing paths share identical validation behavior used by the
tests.

---

Duplicate comments:
In `@test/repair-commands.test.ts`:
- Around line 165-192: Add test cases exercising the short-form model flag in
parseFixArgs to cover trimmed-empty and whitespace-prefixed flag-like values:
extend the existing test block that checks "--model" behavior to also expect
parseFixArgs(["-m", "   "]) and parseFixArgs(["-m", "  --json"]) to return { ok:
false, message: "Missing value for --model" }, and keep the positive short-form
case parseFixArgs(["-m", "gpt-5.5"]).ok toBe(true); this ensures the short-form
branch in lib/codex-manager/repair-commands.ts (around the -m handling) is
exercised and prevents regressions.
🪄 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: 38373320-ef8d-4cbf-ad8b-59828a893b84

📥 Commits

Reviewing files that changed from the base of the PR and between c02494b and 15b34f2.

📒 Files selected for processing (29)
  • README.md
  • lib/codex-manager.ts
  • lib/codex-manager/commands/best.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/repair-commands.ts
  • lib/integration-generators.ts
  • lib/prompts/codex.ts
  • lib/quota-probe.ts
  • lib/runtime-rotation-proxy.ts
  • lib/runtime/quota-probe.ts
  • package.json
  • scripts/check-pack-budget-lib.js
  • test/check-pack-budget.test.ts
  • test/codex-manager-cli.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/codex-manager-report-command.test.ts
  • test/codex-prompts.test.ts
  • test/documentation.test.ts
  • test/package-bin.test.ts
  • test/quota-probe.test.ts
  • test/repair-commands.test.ts
  • test/runtime-quota-probe.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (12)
lib/**/*.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/**/*.ts: All public exports should flow through lib/index.ts or documented package subpaths
Never import from dist/ in source tests or library code
Never suppress type errors

Files:

  • lib/codex-manager/commands/best.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/prompts/codex.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/codex-manager.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not use as any, @ts-ignore, or @ts-expect-error type assertions

Files:

  • lib/codex-manager/commands/best.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/prompts/codex.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • test/package-bin.test.ts
  • lib/runtime/quota-probe.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/report.ts
  • test/documentation.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/help.ts
  • test/repair-commands.test.ts
  • test/codex-prompts.test.ts
  • lib/codex-manager/forecast-report-commands.ts
  • test/quota-probe.test.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-manager-help.test.ts
  • lib/quota-probe.ts
  • test/codex-manager-cli.test.ts
  • test/check-pack-budget.test.ts
  • lib/codex-manager.ts
**/*.{ts,js}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESM module syntax exclusively; the project is ESM-only with "type": "module"

Files:

  • lib/codex-manager/commands/best.ts
  • scripts/check-pack-budget-lib.js
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/prompts/codex.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • test/package-bin.test.ts
  • lib/runtime/quota-probe.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-report-command.test.ts
  • lib/codex-manager/commands/report.ts
  • test/documentation.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-integrations-command.test.ts
  • lib/codex-manager/help.ts
  • test/repair-commands.test.ts
  • test/codex-prompts.test.ts
  • lib/codex-manager/forecast-report-commands.ts
  • test/quota-probe.test.ts
  • lib/codex-manager/repair-commands.ts
  • test/codex-manager-help.test.ts
  • lib/quota-probe.ts
  • test/codex-manager-cli.test.ts
  • test/check-pack-budget.test.ts
  • lib/codex-manager.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/commands/best.ts
  • lib/runtime-rotation-proxy.ts
  • lib/codex-manager/commands/forecast.ts
  • lib/prompts/codex.ts
  • lib/integration-generators.ts
  • lib/codex-manager/commands/integrations.ts
  • lib/codex-manager/commands/models.ts
  • lib/runtime/quota-probe.ts
  • lib/codex-manager/commands/report.ts
  • lib/codex-manager/help.ts
  • lib/codex-manager/forecast-report-commands.ts
  • lib/codex-manager/repair-commands.ts
  • lib/quota-probe.ts
  • lib/codex-manager.ts
scripts/*.js

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors

Files:

  • scripts/check-pack-budget-lib.js
lib/runtime-rotation-proxy.ts

📄 CodeRabbit inference engine (lib/AGENTS.md)

lib/runtime-rotation-proxy.ts: Runtime rotation code must preserve pass-through semantics except for auth/provider headers that intentionally change
Runtime proxy client-facing headers must not expose account emails or tokens
Runtime rotation should fail open to normal official Codex forwarding when startup helpers are unavailable
Never add account emails/tokens to runtime proxy client responses

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

Files:

  • lib/runtime-rotation-proxy.ts
package.json

📄 CodeRabbit inference engine (SECURITY.md)

package.json: Pin hono to 4.12.18 or higher (but below 4.12.0-4.12.1) to avoid GHSA-xh87-mx6m-69f3 authentication bypass vulnerability
Pin rollup to ^4.59.0 or higher to avoid vulnerable versions below 4.59.0 in Vite and Vitest transitive dependencies

Files:

  • package.json
test/**/*.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

test/**/*.test.ts: Vitest globals (describe, it, expect) are enabled and should be used without explicit imports
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/ENOTEMPTY backoff
Use source files in tests, not compiled dist/ files; test the source directly
Do not skip tests without justification; include rationale if a test must be skipped
Relax ESLint rules for test files as specified in eslint.config.js

Files:

  • test/package-bin.test.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-report-command.test.ts
  • test/documentation.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/repair-commands.test.ts
  • test/codex-prompts.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-cli.test.ts
  • test/check-pack-budget.test.ts
test/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Windows filesystem operations must include retry handling for transient EBUSY, EPERM, and ENOTEMPTY errors where tests cover Windows locks

Files:

  • test/package-bin.test.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-report-command.test.ts
  • test/documentation.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/repair-commands.test.ts
  • test/codex-prompts.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-cli.test.ts
  • test/check-pack-budget.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/package-bin.test.ts
  • test/runtime-quota-probe.test.ts
  • test/codex-manager-report-command.test.ts
  • test/documentation.test.ts
  • test/codex-manager-forecast-command.test.ts
  • test/codex-manager-integrations-command.test.ts
  • test/repair-commands.test.ts
  • test/codex-prompts.test.ts
  • test/quota-probe.test.ts
  • test/codex-manager-help.test.ts
  • test/codex-manager-cli.test.ts
  • test/check-pack-budget.test.ts
test/**/documentation.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test documentation parity including command flags, config precedence, changelog policy, and governance rules

Files:

  • test/documentation.test.ts
test/**/codex-manager-cli.test.ts

📄 CodeRabbit inference engine (test/AGENTS.md)

Test CLI settings with question cancellation across all 5 panels and EBUSY/concurrent race conditions

Files:

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

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Use `npm i -g codex-multi-auth` for standard installation of the package
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Use `codex-multi-auth login` to initialize the first account and access the account menu
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Run `codex-multi-auth status`, `codex-multi-auth check`, and `codex-multi-auth forecast --live` to validate manager state and account health
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Use `codex-multi-auth doctor --fix` for automatic diagnosis and safe repair of storage or account issues
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Store account credentials and configuration under `~/.codex/multi-auth/` directory with support for override via `CODEX_MULTI_AUTH_DIR` environment variable
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Enable `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=1` by default for live account rotation in forwarded Codex CLI sessions
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Implement request timeout with `CODEX_AUTH_FETCH_TIMEOUT_MS` and stream stall timeout with `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS` environment variable overrides
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Restrict background Responses mode to opt-in via `backgroundResponses` setting or `CODEX_AUTH_BACKGROUND_RESPONSES=1` for stateful routing compatibility
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Implement whole-pool replay disabled by default when all accounts are rate-limited, with bounded outbound request budgets and cross-account 5xx cooldowns
Learnt from: CR
Repo: ndycode/codex-multi-auth

Timestamp: 2026-06-03T10:33:38.254Z
Learning: Stagger proactive refresh operations to reduce background request bursts across the account pool
📚 Learning: 2026-06-03T09:09:54.928Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T09:09:54.928Z
Learning: In ndycode/codex-multi-auth, `scripts/check-pack-budget-lib.js` exports two separate lists: `REQUIRED_FILES` (exact full-path equality check for `.codex-plugin/plugin.json`, `README.md`, `LICENSE`) and `REQUIRED_PREFIXES` (directory prefix checks for `dist/`, `assets/`, etc.). This split prevents a sibling file like `.codex-plugin/plugin.json.bak` from satisfying the exact-file publish gate. Tests for this live in `test/check-pack-budget.test.ts`.

Applied to files:

  • scripts/check-pack-budget-lib.js
📚 Learning: 2026-06-03T10:33:03.622Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T10:33:03.622Z
Learning: In ndycode/codex-multi-auth, `lib/runtime-rotation-proxy.ts` uses `CURRENT_CODEX_MODEL` (resolves to `gpt-5-codex`, codex family) — not `DEFAULT_MODEL` — as the fallback when deriving the Responses API request context `family` via `getModelFamily(model ?? CURRENT_CODEX_MODEL)` for model-less `/codex/responses` requests. Using `DEFAULT_MODEL` (gpt-5.5 → gpt-5.2 family) was a regression introduced in round 4 that mis-bucketed codex pass-throughs into the wrong rotation/cooldown/budget family; `CURRENT_CODEX_MODEL` was restored in commit `15b34f2` (PR `#506` round 5). `DEFAULT_MODEL` remains the correct fallback for quota-probe and CLI `--model` parse sites only.

Applied to files:

  • lib/runtime-rotation-proxy.ts
📚 Learning: 2026-06-03T10:07:04.084Z
Learnt from: ndycode
Repo: ndycode/codex-multi-auth PR: 0
File: :0-0
Timestamp: 2026-06-03T10:07:04.084Z
Learning: In ndycode/codex-multi-auth, all split-arg `--model`/`-m` parse sites trim the value *before* the missing/flag-like guard (`startsWith('-')` check), so whitespace-only values (`'   '`) and strings like `'  --json'` are rejected consistently. Sites: `parseBestArgs` in `lib/codex-manager.ts` and `lib/codex-manager/help.ts`, `parseForecastArgs` in `lib/codex-manager/commands/forecast.ts` and `lib/codex-manager/forecast-report-commands.ts` (×2), `parseFixArgs` in `lib/codex-manager/repair-commands.ts`, integrations in `lib/codex-manager/commands/integrations.ts`, models in `lib/codex-manager/commands/models.ts`. `parseReportArgs` in `lib/codex-manager/commands/report.ts` was trimmed before round 4. The `--model=<value>` forms have always trimmed; this round aligned the split-arg forms to match.

Applied to files:

  • lib/codex-manager/commands/forecast.ts
  • lib/codex-manager/commands/report.ts
🔇 Additional comments (12)
package.json (1)

123-123: LGTM!

scripts/check-pack-budget-lib.js (1)

16-24: LGTM!

Also applies to: 108-124

test/check-pack-budget.test.ts (1)

99-99: LGTM!

Also applies to: 112-149, 156-156, 182-198

test/package-bin.test.ts (1)

17-23: LGTM!

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

2009-2027: LGTM!

Also applies to: 3279-3350, 7023-7070


748-748: LGTM!

Also applies to: 1775-1775, 2992-2992, 3078-3078, 3124-3124, 3268-3270, 3401-3401, 7198-7198, 7411-7416, 9978-9985

lib/integration-generators.ts (1)

1-1: LGTM!

Also applies to: 20-25

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

3-3: LGTM!

Also applies to: 19-19, 33-51

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

4-4: LGTM!

Also applies to: 46-46, 94-94

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

1-4: LGTM!

Also applies to: 145-219

README.md (1)

199-199: LGTM!

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

5-7: LGTM!

Also applies to: 94-127, 142-172

Comment thread lib/quota-probe.ts Outdated
Comment on lines +57 to +63
const DEFAULT_QUOTA_PROBE_MODELS = [
DEFAULT_MODEL,
"gpt-5.4",
"gpt-5.3-codex",
"gpt-5.2-codex",
"gpt-5-codex",
] as const;

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.

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

extract the probe fallback chain into one shared constant.

lib/quota-probe.ts:57-63 and lib/runtime/quota-probe.ts:6-12 still carry the same ordered model list in two places. that contract already drifted once in this pr. keeping both copies means the next default bump or inserted fallback can split manager live probes from runtime probes again. wire both call sites to one exported array/helper and keep test/quota-probe.test.ts:88-110 plus test/runtime-quota-probe.test.ts:19-96 as the shared contract.

🤖 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/quota-probe.ts` around lines 57 - 63, The duplicated ordered model list
(DEFAULT_QUOTA_PROBE_MODELS) is defined in two places; extract it into a single
exported constant in a shared module and have both the quota probe
implementation and the runtime quota probe import and use that constant instead
of redefining the array. Update references that currently use the local array
(the quota probe code that uses DEFAULT_QUOTA_PROBE_MODELS and the runtime probe
module that repeats the list) to import the shared symbol, and adjust the tests
that assert the probe fallback chain to reference the same exported
constant/contract so there is a single source of truth for the fallback chain.

… cli tests

CodeRabbit round 6:
- extract the duplicated quota-probe fallback chain into one exported
  QUOTA_PROBE_MODEL_CHAIN in model-map.ts; lib/quota-probe.ts and
  lib/runtime/quota-probe.ts both import it, so the ordered candidate list can no
  longer drift between manager and runtime probes (it already split once this PR).
- test/codex-manager-cli.test.ts: replace default-probe-model assertions that
  hardcoded 'gpt-5.5' with the shared DEFAULT_MODEL constant (7 sites); left the
  cache-seed fixtures and the model-inspection literal as real test inputs.

Value-neutral. Full suite: 4362 passed, 3 skipped, 0 failed; typecheck + lint clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@ndycode

ndycode commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Round 6 addressed in 3239f71:

  • probe chain (Major): extracted the duplicated fallback list into one exported QUOTA_PROBE_MODEL_CHAIN in model-map.ts; both lib/quota-probe.ts and lib/runtime/quota-probe.ts import it — the ordered candidate list can no longer drift between manager and runtime probes.
  • tests (nit): replaced the 7 default-probe-model assertions in cli.test that hardcoded 'gpt-5.5' with the shared DEFAULT_MODEL; left cache-seed fixtures + the model-inspection literal as real test inputs.

Full suite: 4362 passed, 0 failed; typecheck + lint clean; Greptile pass.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check QUOTA_PROBE_MODEL_CHAIN in model-map
rg -n "QUOTA_PROBE_MODEL_CHAIN" --type ts -A3 -B2

# Check both quota-probe files import from model-map
rg -n "QUOTA_PROBE_MODEL_CHAIN\|DEFAULT_MODEL\|model-map" lib/quota-probe.ts lib/runtime/quota-probe.ts -A1 -B1

# Check model-map export
rg -n "DEFAULT_MODEL\|QUOTA_PROBE_MODEL_CHAIN\|CURRENT_CODEX_MODEL" lib/request/helpers/model-map.ts 2>/dev/null || fd model-map --exec rg -n "DEFAULT_MODEL\|QUOTA_PROBE_MODEL_CHAIN\|CURRENT_CODEX_MODEL" {}

Unrecoverable error: Failed to clone repository


@ndycode QUOTA_PROBE_MODEL_CHAIN in lib/request/helpers/model-map.ts is the right call for round 6 — with both lib/quota-probe.ts and lib/runtime/quota-probe.ts importing from the same exported constant, the ordered candidate list can't silently diverge between manager and runtime probe paths. that was the last structural drift risk.

the DEFAULT_MODEL swap on the 7 cli.test assertions is consistent with the established pattern — the distinction between test inputs (fixtures, cache seeds, model-inspection literals staying as real strings) vs. assertions (using the shared constant) is the correct line to draw.

suite stable at 4362, no regressions. triggering full review.


✏️ Learnings added
Learnt from: ndycode
URL: https://github.com/ndycode/codex-multi-auth/pull/506

Timestamp: 2026-06-03T10:57:53.412Z
Learning: In ndycode/codex-multi-auth, the ordered quota-probe model fallback list is exported as `QUOTA_PROBE_MODEL_CHAIN` from `lib/request/helpers/model-map.ts` (added in commit `3239f71`, PR `#506` round 6). Both `lib/quota-probe.ts` and `lib/runtime/quota-probe.ts` import this single constant so the candidate model order (`DEFAULT_MODEL` / `gpt-5.5`, `gpt-5.4`, `gpt-5.3-codex`, `gpt-5.2-codex`, `gpt-5-codex`) can never drift between manager-side and runtime-side probes.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Actions performed

Full review triggered.

@ndycode
ndycode merged commit 180de6d into ndycode:main Jun 3, 2026
2 checks passed
ndycode added a commit that referenced this pull request Jun 3, 2026
#506 (gpt-5.5 default probe, Codex-unavailable labeling, plugin manifest
packaging, --model hardening, codex-family fallback) ships under 2.2.1; add it
to docs/releases/v2.2.1.md so the notes match what's on main.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
luo178 pushed a commit to luo178/codex-multi-auth that referenced this pull request Jun 23, 2026
None of these files is imported anywhere in the repo (verified by
whole-repo reference search incl. scripts' dynamic dist imports,
package.json export subpaths, vendor/, and the plugin manifest):

- lib/codex-manager/forecast-report-commands.ts (625 LOC): superseded
  by commands/forecast.ts + commands/report.ts, which the dispatcher
  imports. The dead copy was still being patched in parallel (ndycode#502,
  ndycode#506) - exactly the drift hazard an orphaned duplicate creates.
- lib/codex-manager/statusline-order.ts: duplicate of
  reorderStatuslineField in settings-panels.ts (the live, tested one).
- lib/runtime/account-health-check.ts: clampRuntimeActiveIndices is
  never wired into account-check.ts's injected deps by any caller.
- lib/runtime/oauth-browser-flow.ts: superseded by
  browser-oauth-flow.ts / manual-oauth-flow.ts.
- lib/runtime/session-affinity.ts: ensureRuntimeSessionAffinity has no
  callers; rotation code constructs SessionAffinityStore directly.

Also drops the stale runtime/session-affinity.ts row from the
lib/AGENTS.md structure tree.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants