v1.1.3 — Fix quota-aware auto rotation
What's Fixed
Smart rotation in auto mode now works correctly.
The QUOTA_AWARE_ROTATION flag was silently lost when cmd_auto() spawned a subprocess via flock. The subprocess re-entered load_config(), which sourced config.sh and reset the flag to 0 — so get_next_available() always fell through to round-robin instead of selecting the lowest-usage account.
Root Cause
cmd_auto()setQUOTA_AWARE_ROTATION=1in the parent shellwith_lockranflock -x ... -c "codex-rotate __internal_auto_preflight"— a new subprocess- The new subprocess called
main()→load_config()→source config.sh→QUOTA_AWARE_ROTATION=0
Fix
cmd_auto()now exportsCODEX_ROTATE__QUOTA_AWARE=1as an environment variableload_config()checks this env var after sourcingconfig.shand restoresQUOTA_AWARE_ROTATION=1
What's New
- BATS test proving auto mode selects the lowest-usage account over the highest-usage one
Stats
- 71/71 BATS tests pass
- ShellCheck clean
npm install -g codex-rotateto upgrade