Skip to content

[Bug] A request-owned Codex bearer gets no Pool affinity key on 2.94.0 (re-report of #6998) #8080

Closed

Description

@vibewriter-hand

Client or integration

Codex CLI

Area

Authentication and account pool

Summary

A request-owned Codex bearer gets no Pool affinity key. One conversation therefore changes Pool
account on about a third of its consecutive turns, and the request log labels every Pool selection
new_bind with reason healthy, so no binding is ever reused.

This repeats #6998 with fresh measurements after that report was closed by the issue-quality bot for
not using this form. The source path below is unchanged.

Two outcomes would make the behaviour readable and usable: an opt-in that lets a request-owned main
request keep one Pool binding per conversation, or a clear refusal that says such a request cannot
hold a binding instead of a row that reports new_bind with reason healthy every time. We do not
propose a patch; the decision on the ownership invariant is the maintainer's.

Reproduction

  1. Run OCX 2.94.0 with a Codex account pool of at least two Pool accounts.
  2. Send Codex CLI traffic with ChatGPT sign-in, so the client presents its own bearer.
  3. Read the last six hours of ~/.opencodex/usage.jsonl.
  4. Tally the affinity fields on Pool rows and the account label on consecutive rows of one
    conversation.

Measured on 2026-10-31 from 04:46 KST:

  • Pool rows in the window: 843 of 1687 GPT rows.
  • Affinity field on those rows: affinity=new_bind 843, reused 0.
  • Affinity reason: healthy 843.
  • Main rows carry no affinity field: 844.
  • Consecutive same-conversation pairs: 1589, account moves 564, rate 0.355.
  • One-hour window at 05:05 KST: 560 pairs, 182 moves, rate 0.325.

The two labels alternate almost exactly (main 844, pool 843), which matches a per-request pick that
never reuses a binding.

Source on 2.94.0:

  • src/codex/auth-context.ts:1316-1318: affinityKey is undefined when poolStateEligible() is
    false, and it is false for a request-owned main credential (src/codex/auth-context.ts:203-208,
    return fixedAccountId === undefined && !requestScopedMainCredential;).
  • src/codex/routing/selection.ts:495: the binding is written only when commitAffinity && threadId.
  • src/server/responses/core-auth.ts:174-190: the ownership flags are derived here.
  • src/codex/routing/thread-affinity.ts:130: the release path labels the decision
    { move: "new_bind", reason: "healthy" } even when no binding was stored.

The same gate is still present on the current source at v2.96.0: src/codex/auth-context.ts:1313
gates affinityKey on poolStateEligible, src/codex/routing/selection.ts:491 binds only when
commitAffinity && threadId, and src/codex/routing/thread-affinity.ts:130 still emits
new_bind/healthy (source read 2026-11-02).

One caveat measured on the same 2.94.0 install on 2026-11-02 01:25 KST: a six-hour window whose
traffic was served from stored Pool credentials shows 981 of 1160 Pool rows reused and a change
rate of 0.131. So the failure appears on the caller-bearer path, not on every request; the window
above is the caller-bearer one.

Version

2.94.0 (@bitkyc08/opencodex, npm global install; the proxy /healthz reports 2.94.0)

Operating system

macOS 26.5.2, arm64

Provider and model

openai / gpt-6.1-terra (Codex native family)

Logs or error output

affinity=new_bind       843 rows
affinityReason=healthy  843 rows
affinity reused           0 rows
consecutive pairs      1589
account moves            564
change rate            0.355

Screenshots and supporting files

None.

Redacted configuration

{
  "accountPoolStrategy": "round-robin",
  "accountPoolStickyLimit": 1,
  "poolAccounts": 2
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Potential duplicates found:

    Reason: The new issue explicitly states it is a re-report of 6998 with the same source path Pool affinity key for request-owned Codex bearer and identical failure signature newbind/healthy on every request, no reused binding.

    Detected automatically via GitHub Copilot; automatic closure requires separate deterministic evidence.

  3. added
    bug
    account-pool
    on Nov 1, 2026
  4. lidge-jun commented on Nov 2, 2026

    @lidge-jun
    Owner

    Fixed on dev by #8096 (merge commit affd8403a).

    • Request logs no longer report new_bind / healthy when no binding was stored. Rows now read unbound (reason request_owned or no_conversation) or cleared.
    • The new opt-in setting codexPool.requestOwnedAffinity (default off) keeps one Pool binding per conversation for a caller's own ChatGPT bearer. The binding is scoped to that exact bearer, so one caller cannot reach another's.

    It will ship in the next release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolbug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions