Skip to content

feat(codex): add account picker lifecycle settings - #1019

Open
chrisae9 wants to merge 53 commits into
lidge-jun:devfrom
chrisae9:split/426-04-account-lifecycle-settings
Open

feat(codex): add account picker lifecycle settings#1019
chrisae9 wants to merge 53 commits into
lidge-jun:devfrom
chrisae9:split/426-04-account-lifecycle-settings

Conversation

@chrisae9

@chrisae9 chrisae9 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the optional codexAccountPickerEnabled lifecycle setting for account-qualified Codex picker entries.
  • Initialize privacy-safe selector bindings when enabled, preserve stable bindings across disable/delete/re-add flows, and keep exact selector routing available even while generated picker rows are hidden.
  • Reserve the canonical policy namespace and slash-qualified routing-profile alias prefixes so picker enable and account add cannot create ambiguous or unloadable combined configs.
  • Persist account and setting changes first, then run one bounded catalog convergence through the shared coordinator. If gather, lock, write, or cache completion cannot be proven, keep the saved mutation and report catalogRefreshPending without exposing internal diagnostics.
  • Reuse the canonical catalog merge rules during convergence so fresh provider rows do not delete unrelated foreign rows, generated account rows win selector collisions without duplicates, and native per-model metadata/backfill survives picker enable/disable cycles.
  • Surface a generic ocx sync recovery warning in the dashboard and CLI when an account change succeeds but its catalog refresh remains pending; JSON clients retain the boolean completion field.
  • Fail closed on a malformed persisted picker flag without discarding providers, accounts, or exact selector routes; live config writes remain strict.
  • Prevent Pool's injected access token and physical ChatGPT account ID from being reflected through ordinary errors, redirects, compact responses, combo failures, continuation diagnostics, warmup failures, or persisted validation state. Route explanations expose only the public account selector.
  • Document picker visibility, exact-account routing, account lifecycle recovery, and management behavior in English, Japanese, Simplified Chinese, Korean, and Russian. A dedicated dashboard control remains a follow-up layer.
  • Continue the account-targeting work from feat(codex): add exact account routing #671 and feat(codex): add account-qualified catalog entries #949.

Dashboard feedback

Pending catalog refresh warning after a saved account change

Verification

  • Focused picker/account/catalog/routing-profile, config-recovery, response-privacy, warmup, combo, redirect, compact, and RI-09 integration suites pass. The combined catalog/privacy gate is 596 pass; the final evidence-bound catalog follow-up is 239 pass.
  • Full dashboard suite: 604 pass, plus lint, i18n lint, and production build.
  • bun run typecheck
  • bun run privacy:scan
  • cd docs-site && bun install --frozen-lockfile && bun run build (216 pages)
  • git diff upstream/dev...HEAD --check
  • Full suite on the code-identical pre-release-merge head: 9,132 pass and 10 skip; the same unrelated native-main sideband close-order assertion failed only under aggregate load, then passed its complete file and 10 consecutive isolated runs.
  • The aggregate-only pool-quota polling assertion also passed 10 consecutive isolated runs and its complete file passed 159/159.
  • Independent backend-correctness, code-quality/conventions, and security/privacy reviews completed against the final diff with no remaining findings. The encoded-credential gate is 210 pass; fresh caller-shaped and dual-projection fuzz covered 40,000 security and 20,000 backend cases, and the dense encoded-quote CPU bound fails closed.
  • Latest dev ancestor: 80e4075e (the provider icon fix). On merged head 75008c93, 273 provider/account/CLI tests and all 604 GUI tests pass, together with GUI lint/build, local React Doctor, typecheck, privacy scan, CLI smoke, diff hygiene, and the 216-page docs build. Three independent sync reviews found no security, integration, or conventions issues.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • New Features

    • Added Codex account-picker visibility controls while preserving exact selector routes.
    • Added catalog refresh status reporting for account and settings operations.
    • Added warnings and retry guidance when catalog synchronization is pending.
  • Bug Fixes

    • Improved catalog convergence, routing, and account-binding behavior.
    • Strengthened redaction of account identifiers and credentials in errors and responses.
    • Improved persistence rollback and unavailable-account filtering.
  • Documentation

    • Updated configuration, management API, CLI, dashboard, and multilingual documentation.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I fixed all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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

The PR adds Codex account-picker visibility controls, durable account mutations before catalog refresh, normalized refresh status, deterministic catalog convergence, GUI and CLI feedback, and exact-secret redaction.

Changes

Codex account picker, catalog lifecycle, and response privacy

Layer / File(s) Summary
Picker visibility and namespace routing
src/types.ts, src/config.ts, src/codex/account-namespaces.ts, src/codex/catalog/account-models.ts, src/routing/*
codexAccountPickerEnabled controls generated selector rows. Missing account targets are hidden. Policy and routing-profile namespaces participate in collision checks. Exact selector routes remain available when picker rows are hidden.
Settings, account mutations, and catalog convergence
src/codex/auth-api.ts, src/codex/catalog-refresh-status.ts, src/codex/catalog/sync.ts, src/codex/convergence.ts, src/server/management-api.ts, src/server/management/config-routes.ts
Account and settings changes persist before catalog convergence. Failed persistence restores configuration. Catalog builders consume explicit observed state and return normalized refresh dispositions.
CLI and GUI completion feedback
src/cli/*, gui/src/*, gui/tests/*
CLI output preserves pending status and provides ocx sync guidance. GUI account mutations consume structured completion data and display warning tones.
Exact-secret redaction
src/lib/redact.ts, src/server/relay.ts, src/server/responses/*, src/codex/warmup.ts
Exact account identifiers and credentials are redacted from bodies, headers, status text, redirects, combo failures, diagnostics, logs, and persisted errors.
Validation, tests, and documentation
tests/*, structure/*, docs-site/src/content/docs/*
Tests and documentation cover picker behavior, rollback, refresh status, routing preservation, namespace collisions, catalog convergence, CLI and GUI feedback, and redaction.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AccountAPI
  participant OcxConfig
  participant CatalogConvergence
  participant Catalog
  Client->>AccountAPI: create, delete, or complete OAuth login
  AccountAPI->>OcxConfig: persist account and selector bindings
  AccountAPI->>CatalogConvergence: converge catalog
  CatalogConvergence->>Catalog: build and merge observed catalog state
  Catalog-->>CatalogConvergence: catalog disposition
  CatalogConvergence-->>AccountAPI: catalogRefreshPending
  AccountAPI-->>Client: mutation result and refresh status
Loading

Possibly related PRs

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.24% 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
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: adding lifecycle settings for the Codex account picker.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 4, 2026
@chrisae9
chrisae9 marked this pull request as ready for review August 4, 2026 18:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb44b7d353

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/types.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: 2

🤖 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 `@src/server/management-api.ts`:
- Around line 105-109: Update refreshCodexCatalogStrict and auth-api’s
refreshAccountNamespaceCatalog to inspect the refresh result and reject when
catalogExists is false, while preserving successful refresh handling. Ensure the
existing retry and catalogRefreshPending flow receives this failure, and add a
regression covering a non-throwing incomplete refresh.

In `@tests/settings-stream-mode.test.ts`:
- Around line 359-367: Update the response assertions in the settings
stream-mode test to decode the response body once, reuse it for the existing
field checks, and assert that its serialized payload does not contain “private
refresh failure detail” in any field. Keep the existing status and refresh-count
assertions unchanged.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7040a690-d68b-483f-83f6-82f68682bbfd

📥 Commits

Reviewing files that changed from the base of the PR and between 6ed4c78 and fb44b7d.

📒 Files selected for processing (19)
  • src/codex/account-lifecycle.ts
  • src/codex/account-namespaces.ts
  • src/codex/auth-api.ts
  • src/codex/catalog-refresh-status.ts
  • src/codex/catalog/account-models.ts
  • src/config.ts
  • src/server/management-api.ts
  • src/server/management/config-routes.ts
  • src/server/management/context.ts
  • src/types.ts
  • structure/02_config-and-codex-home.md
  • structure/03_catalog-and-subagents.md
  • structure/05_gui-and-management-api.md
  • tests/codex-account-namespaces.test.ts
  • tests/codex-auth-api.test.ts
  • tests/config.test.ts
  • tests/native-model-toggle.test.ts
  • tests/router.test.ts
  • tests/settings-stream-mode.test.ts

Comment thread src/server/management-api.ts Outdated
Comment thread tests/settings-stream-mode.test.ts Outdated
@chrisae9
chrisae9 marked this pull request as draft August 4, 2026 18:39
@chrisae9
chrisae9 force-pushed the split/426-04-account-lifecycle-settings branch from fb44b7d to eae13eb Compare August 4, 2026 19:13
@chrisae9
chrisae9 marked this pull request as ready for review August 4, 2026 19:15

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

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

Inline comments:
In `@docs-site/src/content/docs/ja/reference/management-api.md`:
- Line 204: Update the table row for GET, POST, DELETE /api/codex-auth/accounts
to add the missing trailing pipe and replace the redundant 「することができます」 phrasing
with the concise equivalent, preserving the row’s meaning and table formatting.

In `@src/codex/account-lifecycle.ts`:
- Around line 73-83: Extend the focused Bun regression coverage for
deleteCodexAccount and its auth-api refresh path: verify enabled pickers with a
stored pool account and matching namespace return true, while disabled pickers
or orphaned namespaces return false. Also verify deleting and re-adding the same
account preserves the namespace and triggers refresh when visibility is enabled,
using the existing lifecycle/catalog test symbols under tests/ rather than
relying only on router.test.ts.

In `@src/codex/auth-api.ts`:
- Around line 1316-1318: Make the deletion flow around deleteCodexAccount and
saveRuntimeConfig atomic: ensure the credential tombstone and runtimeConfig
account removal occur within one mutation critical section, or add compensating
rollback that restores both when saveRuntimeConfig throws
ConfigMutationLockError. Preserve the 503 response while preventing partial
deletion, and add a delete-specific test covering save failure and state
restoration.

In `@src/codex/catalog-refresh-status.ts`:
- Around line 28-36: In the retry loop surrounding refresh, add a short delay
between the failed first attempt and the second attempt, using the existing
retry-delay convention from renameAtomicFile where practical. Keep the current
two-attempt limit, immediate success return, and generic failure handling
unchanged; only pause before retrying after a caught error.
- Around line 32-35: Update the catch block in the catalog refresh retry flow to
bind the caught error and call debugProviderDiagnostic("codex",
"catalog-refresh-failed", ...) for every failed attempt. Extract the error
message explicitly rather than serializing Error directly, sanitize it with
redactSecretString and redactUserPath before recording, and preserve the
existing generic terminal warning.

In `@src/server/management/context.ts`:
- Around line 12-16: Export a shared CodexCatalogRefreshCompletion type from
catalog-refresh-status.ts and use it as the return result type of
refreshCodexCatalog in the management context. Update
assertCodexCatalogRefreshComplete to accept void | CodexCatalogRefreshCompletion
while preserving its existing behavior, and remove the duplicated inline object
shape.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 32d4ce77-5ce2-40da-9ea6-96e424668bb6

📥 Commits

Reviewing files that changed from the base of the PR and between fb44b7d and eae13eb.

📒 Files selected for processing (39)
  • docs-site/src/content/docs/guides/codex-app-models.md
  • docs-site/src/content/docs/guides/web-dashboard.md
  • docs-site/src/content/docs/ja/guides/codex-app-models.md
  • docs-site/src/content/docs/ja/guides/web-dashboard.md
  • docs-site/src/content/docs/ja/reference/configuration/providers.md
  • docs-site/src/content/docs/ja/reference/management-api.md
  • docs-site/src/content/docs/ko/guides/codex-app-models.md
  • docs-site/src/content/docs/ko/guides/web-dashboard.md
  • docs-site/src/content/docs/ko/reference/configuration/providers.md
  • docs-site/src/content/docs/ko/reference/management-api.md
  • docs-site/src/content/docs/reference/configuration/providers.md
  • docs-site/src/content/docs/reference/management-api.md
  • docs-site/src/content/docs/ru/guides/codex-app-models.md
  • docs-site/src/content/docs/ru/guides/web-dashboard.md
  • docs-site/src/content/docs/ru/reference/configuration/providers.md
  • docs-site/src/content/docs/ru/reference/management-api.md
  • docs-site/src/content/docs/zh-cn/guides/codex-app-models.md
  • docs-site/src/content/docs/zh-cn/guides/web-dashboard.md
  • docs-site/src/content/docs/zh-cn/reference/configuration/providers.md
  • docs-site/src/content/docs/zh-cn/reference/management-api.md
  • src/codex/account-lifecycle.ts
  • src/codex/account-namespaces.ts
  • src/codex/auth-api.ts
  • src/codex/catalog-refresh-status.ts
  • src/codex/catalog/account-models.ts
  • src/config.ts
  • src/server/management-api.ts
  • src/server/management/config-routes.ts
  • src/server/management/context.ts
  • src/types.ts
  • structure/02_config-and-codex-home.md
  • structure/03_catalog-and-subagents.md
  • structure/05_gui-and-management-api.md
  • tests/codex-account-namespaces.test.ts
  • tests/codex-auth-api.test.ts
  • tests/config.test.ts
  • tests/native-model-toggle.test.ts
  • tests/router.test.ts
  • tests/settings-stream-mode.test.ts

Comment thread docs-site/src/content/docs/ja/reference/management-api.md Outdated
Comment thread src/codex/account-lifecycle.ts
Comment thread src/codex/auth-api.ts
Comment thread src/codex/catalog-refresh-status.ts Outdated
Comment thread src/codex/catalog-refresh-status.ts Outdated
Comment thread src/server/management/context.ts Outdated
@chrisae9
chrisae9 marked this pull request as draft August 4, 2026 19:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eae13eb170

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/types.ts
Comment thread src/codex/auth-api.ts Outdated
@chrisae9
chrisae9 marked this pull request as ready for review August 4, 2026 20:28
@chrisae9
chrisae9 marked this pull request as draft August 4, 2026 21:55
@chrisae9
chrisae9 marked this pull request as ready for review August 4, 2026 22:05
@chrisae9
chrisae9 marked this pull request as draft August 4, 2026 23:50
@chrisae9
chrisae9 marked this pull request as ready for review August 5, 2026 00:02
@chrisae9
chrisae9 marked this pull request as draft August 5, 2026 00:30
@github-actions
github-actions Bot marked this pull request as draft August 5, 2026 10:58
@github-actions
github-actions Bot marked this pull request as ready for review August 5, 2026 10:58

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

Caution

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

⚠️ Outside diff range comments (2)
docs-site/src/content/docs/ru/reference/management-api.md (1)

227-227: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Согласуйте формулировку catalogRefreshPending со строкой 242 и с фактическим поведением API.

Строка 227 утверждает, что ответы add/delete содержат catalogRefreshPending. Строка 242 для login-status использует «может содержать», а параграф на строках 244–249 описывает поле как признак пропущенного или неудачного convergence. Читатель клиента может сделать вывод, что поле присутствует всегда, и построить парсинг на обязательном булевом значении.

Используйте одну формулировку для одного поведения.

📝 Предлагаемая правка
-| `GET, POST, DELETE /api/codex-auth/accounts` | Показать/обновить список, по желанию импортировать, либо удалить аккаунты Codex; response add/delete содержат `catalogRefreshPending` | 400 invalid input; manual import can be disabled |
+| `GET, POST, DELETE /api/codex-auth/accounts` | Показать/обновить список, по желанию импортировать, либо удалить аккаунты Codex; response add/delete могут содержать `catalogRefreshPending` | 400 invalid input; manual import can be disabled |

Проверьте, что английский источник использует ту же модальность:

#!/bin/bash
# Description: Compare catalogRefreshPending wording across the English source and every locale.
fd -t f 'management-api.md' docs-site/src/content/docs --exec rg -n -C1 'catalogRefreshPending' {}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-site/src/content/docs/ru/reference/management-api.md` at line 227,
Согласуйте формулировку `catalogRefreshPending` в строке описания `GET, POST,
DELETE /api/codex-auth/accounts` с формулировкой для `login-status` и
фактическим поведением API: укажите, что поле может присутствовать, а не
гарантированно содержится в ответах add/delete. Проверьте английский источник и
примените ту же модальность в русской документации.

Source: Path instructions

docs-site/src/content/docs/reference/management-api.md (1)

225-225: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Align line 225 with the optional field documented elsewhere.

Line 225 states that add/delete responses "include catalogRefreshPending". Three other places in this change set describe the field as conditional:

  • Line 240 of this file: "a completed add can include catalogRefreshPending: true".
  • docs-site/src/content/docs/reference/configuration/providers.md line 21: "A persisted picker change can return catalogRefreshPending: true".
  • docs-site/src/content/docs/zh-cn/reference/cli/providers-accounts.md line 195: the field is typed catalogRefreshPending?: boolean.

The failure mode is concrete. A JSON client that reads line 225 as a guarantee writes if (body.catalogRefreshPending === false) or treats an absent key as a protocol violation. Both break when the refresh converges normally and the server omits the field.

📝 Proposed wording fix
-| `GET, POST, DELETE /api/codex-auth/accounts` | List/refresh, optionally import, or delete Codex accounts; add/delete responses include `catalogRefreshPending` | 400 invalid input; manual import can be disabled |
+| `GET, POST, DELETE /api/codex-auth/accounts` | List/refresh, optionally import, or delete Codex accounts; add/delete responses can include `catalogRefreshPending: true` | 400 invalid input; manual import can be disabled |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs-site/src/content/docs/reference/management-api.md` at line 225, Update
the endpoint table entry for GET, POST, DELETE /api/codex-auth/accounts so
catalogRefreshPending is described as optional or conditional rather than always
included, matching the wording and typing used elsewhere in the documentation.
🤖 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 `@src/codex/catalog/sync.ts`:
- Around line 463-470: The catalog writers use conflicting merge policies,
causing unsupported native rows to oscillate between removal and preservation.
Unify the policy used by syncModelsToCodex and the convergence flow, including
the native backfill set and unsupportedNativeEntries behavior, by reusing one
shared policy definition or equivalent values. Add a regression test that
alternates both writer paths and verifies the catalog bytes remain unchanged.

In `@src/server/responses/core.ts`:
- Around line 3146-3152: Preserve the repeated
codexForwardRedactExactValues(authCtx, route.provider) calls at each
error-reporting site in fetchTerminalGuardContinuation. Do not hoist or cache
the result, because route.provider changes during key-pool and Anthropic
failover; add a concise comment documenting that recomputation is required to
avoid stale redaction values after provider rotation.

In `@tests/codex-convergence-account-selectors.test.ts`:
- Line 104: Add the required email property to the codexAccounts fixture object
in the convergence account selectors test, using a representative fixture value
while preserving its existing id and isMain fields.
- Around line 239-258: Add an assertion in the “generated account rows win
foreign slug collisions without duplicate catalog entries” test that no
merge-policy warning is emitted during convergeCatalog(config(true)). Spy on the
warning mechanism used by warnAccountSelectorShadowedProviderOnce and verify it
is not called, while preserving the existing collision and catalog-entry
assertions.

In `@tests/codex-v2-gate.test.ts`:
- Around line 1156-1209: Extend the regression test around mergeObserved to
include at least one accountBoundEntries item, then snapshot its original state
and assert it remains unchanged after both merge calls. Keep the existing
catalogModels and routedEntries immutability assertions and ensure the added
entry exercises the account-bound detachment path in
mergeCatalogEntriesFromObservedState.

In `@tests/server-auth.test.ts`:
- Around line 2005-2007: Remove the second duplicate const json declaration and
its associated response.json() call within the try block of the “exact account
upstream errors never expose the selected physical account id” test. Keep only
the first JSON body read and preserve the existing assertions using json.

---

Outside diff comments:
In `@docs-site/src/content/docs/reference/management-api.md`:
- Line 225: Update the endpoint table entry for GET, POST, DELETE
/api/codex-auth/accounts so catalogRefreshPending is described as optional or
conditional rather than always included, matching the wording and typing used
elsewhere in the documentation.

In `@docs-site/src/content/docs/ru/reference/management-api.md`:
- Line 227: Согласуйте формулировку `catalogRefreshPending` в строке описания
`GET, POST, DELETE /api/codex-auth/accounts` с формулировкой для `login-status`
и фактическим поведением API: укажите, что поле может присутствовать, а не
гарантированно содержится в ответах add/delete. Проверьте английский источник и
примените ту же модальность в русской документации.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7cbf1aa6-f246-4c48-879f-77e0a30ab772

📥 Commits

Reviewing files that changed from the base of the PR and between 6c67a86 and fd332e7.

📒 Files selected for processing (65)
  • docs-site/src/content/docs/guides/codex-app-models.md
  • docs-site/src/content/docs/ja/guides/codex-app-models.md
  • docs-site/src/content/docs/ja/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ja/reference/configuration/providers.md
  • docs-site/src/content/docs/ja/reference/management-api.md
  • docs-site/src/content/docs/ko/guides/codex-app-models.md
  • docs-site/src/content/docs/ko/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ko/reference/configuration/providers.md
  • docs-site/src/content/docs/ko/reference/management-api.md
  • docs-site/src/content/docs/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/reference/configuration/providers.md
  • docs-site/src/content/docs/reference/configuration/routing.md
  • docs-site/src/content/docs/reference/management-api.md
  • docs-site/src/content/docs/ru/guides/codex-app-models.md
  • docs-site/src/content/docs/ru/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ru/reference/configuration/providers.md
  • docs-site/src/content/docs/ru/reference/management-api.md
  • docs-site/src/content/docs/zh-cn/guides/codex-app-models.md
  • docs-site/src/content/docs/zh-cn/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/zh-cn/reference/configuration/providers.md
  • docs-site/src/content/docs/zh-cn/reference/management-api.md
  • gui/src/i18n/de.ts
  • gui/src/i18n/en.ts
  • gui/src/i18n/ja.ts
  • gui/src/i18n/ko.ts
  • gui/src/i18n/ru.ts
  • gui/src/i18n/zh.ts
  • gui/src/styles.css
  • src/codex/auth-api.ts
  • src/codex/catalog-refresh-status.ts
  • src/codex/catalog/sync.ts
  • src/codex/convergence.ts
  • src/codex/features.ts
  • src/codex/warmup.ts
  • src/config.ts
  • src/lib/redact.ts
  • src/routing/profile.ts
  • src/server/management-api.ts
  • src/server/management/config-routes.ts
  • src/server/management/context.ts
  • src/server/relay.ts
  • src/server/responses/compact.ts
  • src/server/responses/core.ts
  • src/server/responses/passthrough-error.ts
  • src/types.ts
  • structure/03_catalog-and-subagents.md
  • structure/08_openai-provider-tiers.md
  • tests/codex-auth-api.test.ts
  • tests/codex-catalog-refresh-status.test.ts
  • tests/codex-convergence-account-selectors.test.ts
  • tests/codex-convergence-contract.test.ts
  • tests/codex-v2-gate.test.ts
  • tests/config.test.ts
  • tests/helpers/catalog-convergence.ts
  • tests/issue-452-empty-503.test.ts
  • tests/passthrough-headers.test.ts
  • tests/redact.test.ts
  • tests/responses-compaction-routing.test.ts
  • tests/retry-after-429.test.ts
  • tests/route-explainability.test.ts
  • tests/server-auth.test.ts
  • tests/server-combo-failover-e2e.test.ts
  • tests/settings-stream-mode.test.ts
  • tests/token-guardian.test.ts
  • tests/warmup.test.ts

Comment thread src/codex/catalog/sync.ts
Comment thread src/server/responses/core.ts
Comment thread tests/codex-convergence-account-selectors.test.ts Outdated
Comment thread tests/codex-convergence-account-selectors.test.ts Outdated
Comment thread tests/codex-v2-gate.test.ts
Comment thread tests/server-auth.test.ts
@chrisae9
chrisae9 marked this pull request as draft August 5, 2026 11:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d326707330

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/lib/redact.ts

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Outside-diff docs triage: I verified the English and Russian catalogRefreshPending wording against the response construction and left it unchanged. Manual add/delete always spread AccountNamespaceCatalogRefresh, including false; completed OAuth login-status conditionally includes only catalogRefreshPending: true. The two rows intentionally describe different response shapes.

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
github-actions Bot marked this pull request as ready for review August 5, 2026 14:16
@chrisae9
chrisae9 marked this pull request as draft August 5, 2026 16:24
@chrisae9

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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

Caution

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

⚠️ Outside diff range comments (1)
src/config.ts (1)

1080-1095: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject codex account namespace selectors that collide with routing-profile alias prefixes.

src/config.ts:1080 builds configuredProviderNamespaces from provider, combo, OpenAI, and policy namespaces only, but src/codex/account-namespaces.ts:77 and src/routing/profile-namespace.ts:12 treat the prefix before / in an alias like side/model as occupied. That lets configSchema.safeParse accept codexAccountNamespaces: { side: "..." } even while src/routing/profile.ts:163 rejects an alias that starts with the same codexAccountNamespace prefix. Include routingProfileAliasNamespacePrefixes(config) in the account-namespace collision issue and update the message from src/config.ts:1095 to cover configured routing-profile alias prefixes/provided namespaces.

🤖 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 `@src/config.ts` around lines 1080 - 1095, The codex account namespace
collision validation around configuredProviderNamespaces must also include the
prefixes returned by routingProfileAliasNamespacePrefixes(config), so selectors
cannot overlap routing-profile alias prefixes. Update the configured namespace
set and the collision message in the accountNamespaces validation to cover both
routing-profile alias prefixes and configured provider namespaces, while
preserving the existing collision behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/ja/reference/cli/providers-accounts.md`:
- Around line 167-172: Update the response documentation near the provider
account response definitions to separate the scopes of catalogRefreshPending:
Codex remove responses must always include the boolean, including false, while
completed login-status responses should include the field only when a catalog
refresh remains pending. Ensure the surrounding descriptions match the actual
CLI/API behavior and remove the conflicting claim that the field exists only for
Codex deletion.

In `@src/codex/account-namespaces.ts`:
- Around line 76-85: Update occupiedNamespaces to normalize each value returned
by routingProfileAliasNamespacePrefixes through codexProviderNamespaceKey before
adding it to the set, while preserving the existing provider, combo, and
reserved namespace entries. Add a regression case using the mixed-case routing
profile alias Main/gpt-5.5 and verify the normalized main prefix prevents
allocation of a conflicting default namespace.

In `@src/codex/auth-api.ts`:
- Around line 405-418: In the account-addition flow, define one local predicate
for whether codex account picker configuration is enabled, then reuse it for
both the codexAccountNamespaces clone and the appendDefaultCodexAccountNamespace
call. Update the guards in the try block around addedAccount so the clone and
mutation cannot diverge if the condition changes later.

In `@tests/server-auth.test.ts`:
- Line 2012: In the affected try block of the test, remove the duplicate json
declaration and retain a single response.json() call, reusing that parsed object
for all subsequent assertions. Do not rename the duplicate or read the response
body again, since the response can only be consumed once.

---

Outside diff comments:
In `@src/config.ts`:
- Around line 1080-1095: The codex account namespace collision validation around
configuredProviderNamespaces must also include the prefixes returned by
routingProfileAliasNamespacePrefixes(config), so selectors cannot overlap
routing-profile alias prefixes. Update the configured namespace set and the
collision message in the accountNamespaces validation to cover both
routing-profile alias prefixes and configured provider namespaces, while
preserving the existing collision behavior.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7f87e603-fc9e-4943-9977-596a93a6512d

📥 Commits

Reviewing files that changed from the base of the PR and between 0e92714 and d1047c5.

📒 Files selected for processing (106)
  • docs-site/src/content/docs/guides/codex-app-models.md
  • docs-site/src/content/docs/guides/web-dashboard.md
  • docs-site/src/content/docs/ja/guides/codex-app-models.md
  • docs-site/src/content/docs/ja/guides/web-dashboard.md
  • docs-site/src/content/docs/ja/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ja/reference/configuration/providers.md
  • docs-site/src/content/docs/ja/reference/configuration/routing.md
  • docs-site/src/content/docs/ja/reference/management-api.md
  • docs-site/src/content/docs/ko/guides/codex-app-models.md
  • docs-site/src/content/docs/ko/guides/web-dashboard.md
  • docs-site/src/content/docs/ko/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ko/reference/configuration/providers.md
  • docs-site/src/content/docs/ko/reference/configuration/routing.md
  • docs-site/src/content/docs/ko/reference/management-api.md
  • docs-site/src/content/docs/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/reference/configuration/providers.md
  • docs-site/src/content/docs/reference/configuration/routing.md
  • docs-site/src/content/docs/reference/management-api.md
  • docs-site/src/content/docs/ru/guides/codex-app-models.md
  • docs-site/src/content/docs/ru/guides/web-dashboard.md
  • docs-site/src/content/docs/ru/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/ru/reference/configuration/providers.md
  • docs-site/src/content/docs/ru/reference/configuration/routing.md
  • docs-site/src/content/docs/ru/reference/management-api.md
  • docs-site/src/content/docs/zh-cn/guides/codex-app-models.md
  • docs-site/src/content/docs/zh-cn/guides/web-dashboard.md
  • docs-site/src/content/docs/zh-cn/reference/cli/providers-accounts.md
  • docs-site/src/content/docs/zh-cn/reference/configuration/providers.md
  • docs-site/src/content/docs/zh-cn/reference/configuration/routing.md
  • docs-site/src/content/docs/zh-cn/reference/management-api.md
  • gui/src/codex-account-mutation.ts
  • gui/src/components/AddCodexAccountModal.tsx
  • gui/src/components/CodexAccountPool.tsx
  • gui/src/components/codex-account-pool-main-card.tsx
  • gui/src/components/use-add-codex-account-oauth.ts
  • gui/src/hooks/useCodexAccountPool.ts
  • gui/src/hooks/useJsonConfigEditor.ts
  • gui/src/hooks/useProviderAccountPools.ts
  • gui/src/i18n/de.ts
  • gui/src/i18n/en.ts
  • gui/src/i18n/ja.ts
  • gui/src/i18n/ko.ts
  • gui/src/i18n/ru.ts
  • gui/src/i18n/zh.ts
  • gui/src/notice-tone.ts
  • gui/src/pages/Providers.tsx
  • gui/src/pages/providers-page-modals.tsx
  • gui/src/pages/use-providers-crud.ts
  • gui/src/pages/use-providers-fetch.ts
  • gui/src/pages/use-providers-oauth.ts
  • gui/src/styles.css
  • gui/src/ui.tsx
  • gui/tests/add-codex-account-oauth.test.tsx
  • gui/tests/codex-account-pool-behaviour.test.tsx
  • gui/tests/codex-account-pool-toast-tone.test.tsx
  • src/cli/account-auth.ts
  • src/cli/account-catalog-refresh.ts
  • src/cli/account-extended.ts
  • src/codex/account-lifecycle.ts
  • src/codex/account-namespaces.ts
  • src/codex/auth-api.ts
  • src/codex/catalog-refresh-status.ts
  • src/codex/catalog/account-models.ts
  • src/codex/catalog/sync.ts
  • src/codex/convergence.ts
  • src/codex/features.ts
  • src/codex/warmup.ts
  • src/config.ts
  • src/lib/redact.ts
  • src/routing/profile-namespace.ts
  • src/routing/profile.ts
  • src/server/management-api.ts
  • src/server/management/config-routes.ts
  • src/server/management/context.ts
  • src/server/relay.ts
  • src/server/responses/compact.ts
  • src/server/responses/core.ts
  • src/server/responses/passthrough-error.ts
  • src/types.ts
  • structure/02_config-and-codex-home.md
  • structure/03_catalog-and-subagents.md
  • structure/05_gui-and-management-api.md
  • structure/08_openai-provider-tiers.md
  • tests/cli-account.test.ts
  • tests/codex-account-namespaces.test.ts
  • tests/codex-auth-api.test.ts
  • tests/codex-catalog-refresh-status.test.ts
  • tests/codex-convergence-account-selectors.test.ts
  • tests/codex-convergence-contract.test.ts
  • tests/codex-v2-gate.test.ts
  • tests/config.test.ts
  • tests/helpers/catalog-convergence.ts
  • tests/issue-452-empty-503.test.ts
  • tests/native-model-toggle.test.ts
  • tests/passthrough-headers.test.ts
  • tests/provider-workspace-auth.test.ts
  • tests/redact.test.ts
  • tests/responses-compaction-routing.test.ts
  • tests/retry-after-429.test.ts
  • tests/route-explainability.test.ts
  • tests/router.test.ts
  • tests/server-auth.test.ts
  • tests/server-combo-failover-e2e.test.ts
  • tests/settings-stream-mode.test.ts
  • tests/token-guardian.test.ts
  • tests/warmup.test.ts

Comment thread docs-site/src/content/docs/ja/reference/cli/providers-accounts.md Outdated
Comment thread src/codex/account-namespaces.ts
Comment thread src/codex/auth-api.ts
Comment thread tests/server-auth.test.ts
@chrisae9

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on the full-review finding outside the diff:

The suggested src/config.ts change is not needed. Account namespace validation already composes with routingProfileIssues(..., { codexAccountNamespaces }); an exact collision such as selector side plus alias side/gpt-5.5 is rejected at routingProfiles.<id>.alias with “collides with a configured codex account namespace.” Keeping that check in the routing-profile validator also preserves the established contract that profile aliases and account selectors are exact-case, while provider namespace admission is case-insensitive.

The two valid findings were fixed in b593374. The stale duplicate-JSON finding and mixed-case normalization suggestion were answered on their threads. Validation: 227 focused tests, typecheck, privacy scan, diff hygiene, and the 216-page docs build all pass.

@chrisae9

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chrisae9
chrisae9 marked this pull request as ready for review August 5, 2026 17:08
@chrisae9
chrisae9 marked this pull request as draft August 5, 2026 18:41
@chrisae9

chrisae9 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@github-actions
github-actions Bot marked this pull request as ready for review August 5, 2026 18:49
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant