Repository navigation
feat(codex): preserve signed-in quota across duplicate pool entries - #7144
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
…ned-in-account # Conflicts: # scripts/test-layout/layout.json # tests/fixtures/test-layout-expected.json
…ned-in-account # Conflicts: # scripts/test-layout/layout.json
Resolve routes.ts by keeping both the preserve-signed-in and use-remaining routes. Regenerate the ocx skill surface (338 capabilities across both sides). Move the preserve-signed-in section into structure/providers/openai-signed-in-preservation.md so openai-accounts.md stays inside the 600-line doc budget.
…ned-in-account # Conflicts: # structure/gui-and-management-api.md
…ned-in-account # Conflicts: # structure/INDEX.md # structure/gui-and-management-api.md
# Conflicts: # scripts/test-layout/layout.json # structure/INDEX.md # tests/fixtures/test-layout-expected.json
|
Maintainer integration into
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3784d66bf9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (const account of config.codexAccounts ?? []) { | ||
| if (!isSelectableCodexPoolAccount(account)) continue; | ||
| const credential = getCodexAccountCredential(account.id); | ||
| if (sameCodexLogin(main, codexLoginIdentity(credential?.chatgptAccountId, account.email))) ids.add(account.id); |
There was a problem hiding this comment.
Load the credential store only once per selection
When this opt-in is enabled with multiple pool accounts, every selection pass calls getCodexAccountCredential once per row. That function reaches readCodexAccountRecord, which reloads, parses, and normalizes the entire credential store for each ID, so an N-account pool performs N synchronous full-store reads (and O(N²) parsing work) on Bun's request path; routing can perform several such selection passes for one request. Load one loadCodexAccountRecordSnapshot() before this loop and resolve every account from that snapshot instead.
Useful? React with 👍 / 👎.
| "tier": 4, | ||
| "title": "Preserve Signed-In Codex Quota", | ||
| "scope": "Opt-in effective priority bands that spend other pool accounts before the signed-in identity, its identity observation and management API.", | ||
| "documents": ["src/codex/account-preservation.ts", "src/codex/signed-in-identity.ts", "src/codex/auth-api/account-preservation.ts", "src/cli/account-preservation.ts"] |
There was a problem hiding this comment.
Map the account identity helper to its preservation contract
Add src/codex/account-identity.ts to this document's documents list and name it in the document itself. The newly added helper owns linkedCodexAccountIds, including the workspace-and-email matching rule described by this preservation document, but the generated source-to-doc index omits that relationship and instead attributes the behavior only to the other modules; future changes to the matching logic therefore will not fan out to its authoritative contract.
AGENTS.md reference: structure/AGENTS.md:L39-L42
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…for the in-memory store (lidge-jun#2999) The in-memory store adopts only complete ChatGPT credentials (access and refresh token), as a real Codex login always is. codex-preserve-signed-in (lidge-jun#7144) and native-ultrafast-picker (lidge-jun#7050) wrote logins without a refresh token, so the product saw no login. Their fixtures now include one, and the cases that rewrite auth.json mid-test call the store's observe step, which the watcher runs in production. No assertion changed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Summary
ocx account preserve-signed-in openai [on|off|status] [--apply-to-bound] [--json], backed bycodexPreserveSignedInAccountand authenticatedGET/PUT /api/codex-auth/preserve-signed-in.--apply-to-boundsaves the policy before releasing only affected bindings/manual preferences/pins for the next request. In-flight requests retain their captured account. Existing optional priority failback keeps its independent conditions and is reported in status.Verification
All runtime tests used temporary OPENCODEX_HOME/CODEX_HOME; no real account files or upstream inference. Bun 1.4.3 was downloaded only into ignored worktree scratch for the repository's pinned-runner tooling check; no global installation changed.
bun install— pass, 105 installs checked, no lockfile changes.bun test tests/codex-integration/codex-preserve-signed-in.test.ts tests/cli/cli-account-preservation.test.ts— 39 pass / 0 fail, Bun 1.4.3, latest implementation. Covers all four strategies, duplicated identity, extreme custom priorities, fallback and eligibility, bound/pin opt-in transition, unrelated bindings, login/pool credential changes, unknown/conflicting evidence, drain read fencing, API validation/persistence rollback and CLI method/body/invalid operands.bun test tests/codex-integration/codex-preserve-signed-in.test.ts tests/cli/cli-account-preservation.test.ts tests/codex-integration/codex-linked-account-pause.test.ts tests/codex-integration/codex-pool-rotation.test.ts tests/codex-integration/codex-priority-failback.test.ts tests/codex-integration/main-account-policy-binding-wait.test.ts tests/codex-integration/codex-entitlement-identity-read-fence.test.ts— 204 pass / 0 fail before the final two focused rollback/conflicting-evidence cases; those are included in the 39-pass run above.bun test tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/server/management-route-registry.test.ts tests/cli/cli-capabilities.test.ts tests/cli/cli-capabilities-arguments.test.ts tests/ci-workflows/skill-ocx.test.ts tests/ci-workflows/skill-ocx-generated.test.ts— initially 105 pass / 1 fail on host Bun 1.4.0: the tooling subprocess explicitly required repository-pinned Bun 1.4.3. WithPATHandOCX_TEST_RUNNER_BUNpointing to the scratch Bun 1.4.3 binary,bun test tests/test-layout-tooling.test.tspassed 25 / 0. The other seven files passed in the first run.bun test tests/ci-workflows/file-size-ratchet.test.ts— 9 pass / 0 fail after additions; no baseline raised.bun run typecheck— pass, latest code/tests.bun run structure:check— pass (new files staged, as the guard validates the git index).bun run privacy:scan— pass, latest code/tests.bun run skill:surface— generated the management/account capability map; generated-surface tests passed.Full local suites (
bun run test,bun run prepush, whole tests directory) were explicitly prohibited on this shared host. Broad Ubuntu, cross-platform and docs-build coverage is left to hosted CI. No live desktop/composer acceptance or maintainer security approval is claimed. PR exact-head checks will be inspected, then the fullci.ymlworkflow_dispatchwithlane=allwill be dispatched on this branch after PR checks pass. CI polling reached the approximately 60-minute stage cap (2026-10-15 07:35–08:35 UTC, across the initial and final heads). Final head:6ce501cc4eed059cc99e9ffa97407a21057a342b. The current PR CI run remains queued:changesandselect windows runnerhave no executed steps.Catalog async contracts (ubuntu-latest),resolve-pr,label,hygiene, andreact-doctorare also queued. CodeRabbit status is SUCCESS, which is not test execution or maintainer security approval. No current-head Actions test result exists yet.The final cross-platform dispatch is NOT RUN because the required preceding PR checks have not passed. After they pass, run
gh workflow run ci.yml --repo lidge-jun/opencodex --ref feat/7100-preserve-signed-in-account -f lane=all, confirm its head SHA, and inspect all jobs/logs. The obsolete own-branch initial-head CI/hygiene runs were cancelled to release workflow concurrency; no other branches or current-head runs were cancelled and no cancelled result is counted as passing. This PR remains draft pending hosted validation and explicit maintainer security review.Checklist