Repository navigation
Commit bbf2aad
committed
fix(codex): keep the identity-change retry from upgrading a background refresh
CodeRabbit caught a hole in the previous commit. `forceRefresh` carries two
meanings: "bypass the cache" and "the caller asked for this". Gating the reauth
clear on it left `retryMainAccountInfoIfIdentityChanged` able to launder a
background poll into operator intent, because that retry re-enters
`fetchMainAccountInfoWhileOwned(true, ...)` purely to re-read past a stale cache.
So a background refresh that crossed an identity change came back with the
authority to retract a quarantine raised — by real traffic 401/403 — against the
new identity while the retry probe was in flight.
Split the two meanings: `explicitRefresh` defaults to `forceRefresh` and the
retry propagates the caller's original value. The reauth clear now keys off
`explicitRefresh`; cache bypass is unchanged.
Note the purge on a genuine identity change is a separate and correct path —
`reconcileMainCodexAccountRuntimeState` drops the previous identity's quarantine,
quota, health, and thread map because it is a different account. The new test
marks the quarantine after that purge so it pins the retry, not the purge.
Verified on win32:
- bun run typecheck exit 0
- 12 auth/routing/oauth suites 596 pass / 0 fail
Mutation-checked:
- clear gated on `forceRefresh` (this hole) → 1 fail, the new retry test
- clear unconditional (the original bug) → 2 fail, both regression tests1 parent e921346 commit bbf2aad
2 files changed
Lines changed: 50 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
647 | 648 | | |
648 | 649 | | |
649 | 650 | | |
650 | 651 | | |
651 | 652 | | |
652 | | - | |
| 653 | + | |
653 | 654 | | |
654 | 655 | | |
655 | 656 | | |
| |||
696 | 697 | | |
697 | 698 | | |
698 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
699 | 707 | | |
700 | 708 | | |
701 | 709 | | |
| |||
724 | 732 | | |
725 | 733 | | |
726 | 734 | | |
727 | | - | |
| 735 | + | |
728 | 736 | | |
729 | 737 | | |
730 | 738 | | |
| |||
733 | 741 | | |
734 | 742 | | |
735 | 743 | | |
736 | | - | |
| 744 | + | |
737 | 745 | | |
738 | 746 | | |
739 | 747 | | |
| |||
754 | 762 | | |
755 | 763 | | |
756 | 764 | | |
757 | | - | |
| 765 | + | |
758 | 766 | | |
759 | 767 | | |
760 | 768 | | |
| |||
769 | 777 | | |
770 | 778 | | |
771 | 779 | | |
772 | | - | |
| 780 | + | |
773 | 781 | | |
774 | 782 | | |
775 | 783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
895 | 932 | | |
896 | 933 | | |
897 | 934 | | |
| |||
0 commit comments