Skip to content

Refine switch --live auto-switch behavior#84

Merged
Loongphy merged 1 commit intomainfrom
codex/live-switch-cursor-lock
Apr 28, 2026
Merged

Refine switch --live auto-switch behavior#84
Loongphy merged 1 commit intomainfrom
codex/live-switch-cursor-lock

Conversation

@Loongphy
Copy link
Copy Markdown
Owner

@Loongphy Loongphy commented Apr 28, 2026

Updates switch --live auto-switching behavior:

  • Uses auto_switch.threshold_5h_percent and auto_switch.threshold_weekly_percent as the switch thresholds for 5h and weekly quota.
  • Resets both default threshold values to 1 and bumps the registry schema to v4.
  • Migrates registry files during upgrade:
    • schema 2 is loaded through the legacy migration path, thresholds are reset to 1 / 1, then the file is saved as schema 4
    • schema 3 is loaded as the current layout, thresholds are reset to 1 / 1, then the file is saved as schema 4
    • schema 4 keeps the user's configured threshold values
  • Keeps the foreground switch --live switching logic separate from the background auto-switch daemon path, so the live picker can evolve independently.
  • Moves the live cursor to the account that becomes active after an automatic switch.

Account Selection

When switch --live needs to switch accounts, it chooses the next account by reset timing:

  • first, the account with the nearest 5h reset time
  • if tied, the account with the nearest weekly reset time

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

@loongphy/codex-auth-darwin-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-arm64@84

@loongphy/codex-auth-darwin-x64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-x64@84

@loongphy/codex-auth-linux-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-linux-arm64@84

@loongphy/codex-auth-linux-x64

npx https://pkg.pr.new/@loongphy/codex-auth-linux-x64@84

@loongphy/codex-auth-win32-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-win32-arm64@84

@loongphy/codex-auth-win32-x64

npx https://pkg.pr.new/@loongphy/codex-auth-win32-x64@84

@loongphy/codex-auth

npx https://pkg.pr.new/@loongphy/codex-auth@84

commit: 95d99f5

@Loongphy Loongphy merged commit d3102f0 into main Apr 28, 2026
12 checks passed
@Loongphy Loongphy deleted the codex/live-switch-cursor-lock branch April 28, 2026 14:50
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.

1 participant