Commit cab43d1
feat(api): harden Codex provider and unbreak Codex /fast
Two correctness fixes for the OAuth-only Codex provider.
1. Replace 5x `self.tokens.lock().unwrap()` in providers/codex.rs with
parking_lot::Mutex, which has no poison semantics. The std Mutex
variants would panic-cascade if any holder panicked mid-refresh
(e.g. on a malformed token response), permanently bricking the
provider for the rest of the session. parking_lot guarantees the
lock keeps working through panics.
2. Teach ModelRegistry that Codex is OAuth-only and absent from the
bundled models.dev snapshot. `best_model_for_provider("codex")` and
`best_small_model_for_provider("codex")` previously returned None,
which broke the `/model` default resolution and the `/fast` toggle
for any Codex session. They now fall back to
claurst_core::codex_oauth::DEFAULT_CODEX_MODEL and the first `*-mini`
entry in CODEX_MODELS, respectively. Same path is taken for the
`openai-codex` alias.
cargo test claurst-api: 4/4 codex tests pass (1 new). Full workspace:
1520 passing, 0 failing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 031db4c commit cab43d1
2 files changed
Lines changed: 69 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
742 | | - | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
743 | 747 | | |
744 | 748 | | |
745 | 749 | | |
| |||
785 | 789 | | |
786 | 790 | | |
787 | 791 | | |
788 | | - | |
| 792 | + | |
| 793 | + | |
789 | 794 | | |
790 | 795 | | |
791 | 796 | | |
| |||
1039 | 1044 | | |
1040 | 1045 | | |
1041 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1042 | 1069 | | |
1043 | 1070 | | |
1044 | 1071 | | |
| |||
1188 | 1215 | | |
1189 | 1216 | | |
1190 | 1217 | | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
1191 | 1251 | | |
1192 | 1252 | | |
1193 | 1253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
196 | | - | |
| 197 | + | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| |||
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
210 | | - | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
240 | | - | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
916 | | - | |
| 917 | + | |
917 | 918 | | |
918 | 919 | | |
919 | 920 | | |
| |||
0 commit comments