Commit be28f9b
chore: release v2.1.8
Patch release for issue #474. `codex-multi-auth switch <n>` now reliably
routes the Codex desktop app to the chosen account, including
mid-conversation, and `codex-multi-auth unpin` resumes hybrid rotation.
Two distinct halves of the bug fixed in one cohesive change:
1. Manual `switch` had no effect on the desktop app — the runtime
rotation proxy ignored `storage.activeIndex` and clobbered the
selection on every successful request. Fixed by introducing an
explicit `pinnedAccountIndex` field on storage and a pin-first branch
in `chooseAccount` that fires before session affinity, hybrid scoring,
and pool fallback. The pinned path is exempt from `markSwitched` so
the proxy never clobbers its own pin. New `unpin` subcommand clears
the pin; `best` clears it as well. Pinned account unavailable returns
HTTP 503 `codex_pinned_account_unavailable` instead of silently
rotating.
2. Session affinity locked the desktop app to one account for up to
20 minutes — the Codex desktop app chains turns via
`previous_response_id`. Fixed via a new `affinityGeneration` counter
on storage that `switch`/`unpin`/`best` bump and the proxy observes
via a content-hash-keyed per-path read. When the disk generation
exceeds memory, the proxy calls `SessionAffinityStore.clearAll()`
before `chooseAccount` so the same in-flight request benefits.
Hardening from review:
- `AccountManager.buildStorageSnapshot` now persists pin/gen (was
silently wiping on every routine debounced save).
- `unpin` uses `saveAccountsWithRetry` for Windows EBUSY/EPERM resilience.
- Atomic `affinityGeneration` increments via Math.max(inMemory, disk)+1
so concurrent CLI processes can't lose an invalidation signal.
- Per-path content-hash cache in the proxy replaces mtime-only key.
- Hot-path spin-wait removed from `readStorageMetaFromDisk`.
- `Number.isInteger` guard + raw-value display in status output.
- `PersistedSwitchReasonSchema` as single source for switch-reason union.
Validated with typecheck, lint, full vitest suite (3974 tests passing
across 267 files), local build, and CLI smoke tests on Windows
(--version, --help, status, unpin, rotation status).
See docs/releases/v2.1.8.md for full release notes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 62f7a41 commit be28f9b
5 files changed
Lines changed: 49 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
387 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
388 | 389 | | |
389 | 390 | | |
390 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments