@bitkyc08/opencodex 2.100.3 → 2.100.5-preview.20261118.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/AGENTS_INSTALL.md +23 -1
  2. package/bin/ocx.mjs +8 -1
  3. package/gui/dist/assets/{App-Dnb6VMsP.js → App-BiOGtxDS.js} +21 -20
  4. package/gui/dist/assets/{Tray-BV4ms9U9.js → Tray-BwsMejUO.js} +1 -1
  5. package/gui/dist/assets/brand-mark-BY1dgACL.js +1 -0
  6. package/gui/dist/assets/{index-DCdXsMyZ.js → index-CwHSKMdG.js} +46 -13
  7. package/gui/dist/assets/index-DJxM-imn.css +2 -0
  8. package/gui/dist/assets/{segment-thumb-features-DXSidY6D.js → segment-thumb-features-Bds9Hb_7.js} +1 -1
  9. package/gui/dist/classic/assets/{App-DA-scMPq.js → App-CGLOiqQL.js} +20 -19
  10. package/gui/dist/classic/assets/{Tray-BrHaVRAq.js → Tray-Da4r2O70.js} +1 -1
  11. package/gui/dist/classic/assets/{index-BqOaGLf5.js → index-CvoKXKL9.js} +46 -13
  12. package/gui/dist/classic/assets/quota-summary-DvqzfCmr.js +1 -0
  13. package/gui/dist/classic/index.html +1 -1
  14. package/gui/dist/index.html +2 -2
  15. package/native/ocx-child/src/cli.rs +5 -3
  16. package/native/ocx-child/src/codex_home.rs +1 -0
  17. package/native/ocx-child/src/link_ws.rs +24 -19
  18. package/native/ocx-child/src/link_ws_frame.rs +136 -50
  19. package/package.json +3 -3
  20. package/src/adapters/anthropic/per-message-effort.ts +296 -0
  21. package/src/adapters/anthropic-input-schema.ts +270 -0
  22. package/src/adapters/anthropic.ts +4 -63
  23. package/src/adapters/claude-cli/adapter.ts +1 -0
  24. package/src/adapters/command-code-tool-text.ts +9 -1
  25. package/src/adapters/command-code.ts +18 -2
  26. package/src/adapters/devin/cloud-direct/chat.ts +95 -14
  27. package/src/adapters/devin/live-models.ts +11 -1
  28. package/src/adapters/google-errors.ts +14 -2
  29. package/src/adapters/kiro/reasoning.ts +3 -0
  30. package/src/adapters/kiro-tools.ts +14 -9
  31. package/src/adapters/openai-responses/passthrough.ts +3 -1
  32. package/src/adapters/openai-responses/request-strips.ts +1 -0
  33. package/src/adapters/qoder/adapter.ts +9 -1
  34. package/src/adapters/tool-catalog-nudge.ts +1 -1
  35. package/src/adapters/zed.ts +4 -2
  36. package/src/claude/chat-tool-dispatch.ts +4 -1
  37. package/src/claude/desktop-remote-store.ts +60 -10
  38. package/src/cli/account-api.ts +4 -0
  39. package/src/cli/account-auth.ts +30 -2
  40. package/src/cli/account-extended.ts +33 -2
  41. package/src/cli/capabilities-access-remote.ts +3 -3
  42. package/src/cli/capabilities-accounts.ts +3 -3
  43. package/src/cli/capabilities-base.ts +11 -6
  44. package/src/cli/capabilities-observe-system.ts +2 -2
  45. package/src/cli/claude.ts +3 -3
  46. package/src/cli/disconnect-runtime.ts +16 -6
  47. package/src/cli/dispatch.ts +7 -1
  48. package/src/cli/index.ts +2 -2
  49. package/src/cli/link-apply-restart.ts +4 -2
  50. package/src/cli/link-routes.ts +4 -1
  51. package/src/cli/link.ts +5 -4
  52. package/src/cli/logout-command.ts +23 -4
  53. package/src/cli/preflight-exemptions.ts +3 -0
  54. package/src/cli/provider.ts +3 -2
  55. package/src/cli/registry.ts +5 -2
  56. package/src/cli/resolve.ts +23 -8
  57. package/src/cli/restart-failure.ts +11 -1
  58. package/src/cli/runtime-api.ts +4 -0
  59. package/src/cli/status.ts +4 -1
  60. package/src/cli/system-command.ts +1 -1
  61. package/src/cli/system-restart-client.ts +9 -3
  62. package/src/cli/system-settings-parity.ts +2 -1
  63. package/src/client/connect.ts +73 -11
  64. package/src/client/desktop-refusal.ts +38 -0
  65. package/src/client/lifecycle-lock.ts +29 -4
  66. package/src/client/runtime-restart.ts +27 -15
  67. package/src/client/runtime.ts +4 -2
  68. package/src/client/state.ts +14 -0
  69. package/src/clients/config-export.ts +12 -7
  70. package/src/codex/account-lifecycle.ts +3 -1
  71. package/src/codex/account-pause.ts +4 -0
  72. package/src/codex/account-runtime-state.ts +4 -0
  73. package/src/codex/auth-api/main-account-probe.ts +3 -1
  74. package/src/codex/auth-api/main-hard-lock-refusal-read.ts +172 -0
  75. package/src/codex/auth-context.ts +40 -2
  76. package/src/codex/catalog/build-entries.ts +10 -0
  77. package/src/codex/catalog/derive-entry.ts +7 -0
  78. package/src/codex/catalog/metadata.ts +8 -0
  79. package/src/codex/catalog/native-models.ts +16 -6
  80. package/src/codex/catalog/pinned-models.ts +1 -0
  81. package/src/codex/catalog/provider-models.ts +5 -5
  82. package/src/codex/catalog/reserve-warn.ts +7 -5
  83. package/src/codex/catalog/reserve.ts +4 -3
  84. package/src/codex/catalog/retained-sync.ts +2 -0
  85. package/src/codex/catalog/routed-defaults.ts +35 -0
  86. package/src/codex/catalog-auto-refresh.ts +13 -2
  87. package/src/codex/config-drift-heal.ts +40 -12
  88. package/src/codex/config-write-lock.ts +39 -1
  89. package/src/codex/convergence.ts +2 -0
  90. package/src/codex/data/roster-pinned-models.json +346 -1
  91. package/src/codex/inject/config-write-section.ts +39 -1
  92. package/src/codex/inject/plan.ts +10 -8
  93. package/src/codex/inject/remove.ts +21 -19
  94. package/src/codex/inject/restore.ts +5 -1
  95. package/src/codex/inject-coordination.ts +58 -7
  96. package/src/codex/inject.ts +10 -12
  97. package/src/codex/journal-config-restore.ts +42 -0
  98. package/src/codex/journal.ts +62 -8
  99. package/src/codex/loopback-target.ts +22 -8
  100. package/src/codex/main-account.ts +94 -30
  101. package/src/codex/native-main-auth-file.ts +14 -0
  102. package/src/codex/native-main-credentials.ts +276 -0
  103. package/src/codex/native-main-owner.ts +3 -0
  104. package/src/codex/native-main-refresh-mode.ts +14 -1
  105. package/src/codex/quota.ts +63 -14
  106. package/src/combos/failover.ts +195 -1
  107. package/src/combos/index.ts +5 -0
  108. package/src/combos/resolve.ts +115 -19
  109. package/src/config/diagnostics.ts +3 -0
  110. package/src/config/live-reconcile.ts +6 -3
  111. package/src/config/load-degrade.ts +2 -0
  112. package/src/config/persisted-mutation.ts +2 -2
  113. package/src/config/persisted-projections.ts +18 -0
  114. package/src/config/process-state.ts +4 -3
  115. package/src/config/reserve-capability.ts +96 -0
  116. package/src/config/schema/config-schema.ts +6 -0
  117. package/src/config/schema/leaf-validators.ts +2 -0
  118. package/src/config/schema/routed-catalog-defaults.ts +49 -0
  119. package/src/config/subagent-models.ts +20 -12
  120. package/src/config.ts +7 -7
  121. package/src/desktop-update/acquire.ts +202 -0
  122. package/src/desktop-update/cli.ts +168 -0
  123. package/src/desktop-update/drain.ts +40 -0
  124. package/src/desktop-update/headless.ts +285 -0
  125. package/src/desktop-update/image.ts +85 -0
  126. package/src/desktop-update/install.ts +53 -0
  127. package/src/desktop-update/msi.ts +72 -0
  128. package/src/desktop-update/release.ts +128 -0
  129. package/src/desktop-update/runtime.ts +155 -0
  130. package/src/desktop-update/staging.ts +118 -0
  131. package/src/desktop-update/trust.ts +45 -0
  132. package/src/generated/compatibility-version.json +327 -195
  133. package/src/generated/model-metadata.ts +3 -3
  134. package/src/images/fulfill-video.ts +3 -3
  135. package/src/images/loop.ts +6 -2
  136. package/src/images/plan.ts +147 -11
  137. package/src/images/types.ts +13 -4
  138. package/src/images/xai-video-client.ts +72 -10
  139. package/src/lib/client-error-body.ts +6 -0
  140. package/src/lib/developer-role-rejection.ts +15 -0
  141. package/src/lib/gcp-adc.ts +48 -4
  142. package/src/lib/offline-resend.ts +150 -0
  143. package/src/lib/paced-stream.ts +3 -3
  144. package/src/lib/provider-outbound.ts +17 -6
  145. package/src/lib/request-failure-model.ts +2 -0
  146. package/src/lib/response-body-inactivity.ts +23 -1
  147. package/src/lib/upstream-retry.ts +39 -6
  148. package/src/link/explicit-route.ts +4 -4
  149. package/src/link/remote-windows.ts +79 -31
  150. package/src/link/residual-recovery.ts +20 -8
  151. package/src/messaging/budget.ts +23 -5
  152. package/src/messaging/remote-ports.ts +22 -10
  153. package/src/messaging/rpc.ts +4 -4
  154. package/src/oauth/antigravity-risk.ts +126 -0
  155. package/src/oauth/credential-siblings.ts +32 -0
  156. package/src/oauth/generic-account-failover.ts +113 -30
  157. package/src/oauth/generic-session-affinity.ts +10 -3
  158. package/src/oauth/index.ts +22 -14
  159. package/src/oauth/login-cli.ts +35 -1
  160. package/src/oauth/pool-kernel.ts +3 -3
  161. package/src/oauth/store.ts +38 -7
  162. package/src/providers/anthropic-billing-refusal.ts +27 -3
  163. package/src/providers/anthropic-reset-grants.ts +4 -0
  164. package/src/providers/claude-cli-usage.ts +2 -0
  165. package/src/providers/codebuddy-models.ts +11 -0
  166. package/src/providers/google-vertex-model-discovery.ts +49 -15
  167. package/src/providers/kiro-models.ts +5 -0
  168. package/src/providers/model-rename-fields.ts +2 -0
  169. package/src/providers/quota/workbuddy.ts +6 -2
  170. package/src/providers/registry/entries-core.ts +9 -3
  171. package/src/providers/registry/entries-extended.ts +20 -9
  172. package/src/providers/registry/model-seeds.ts +4 -1
  173. package/src/providers/stale-context-window-migration.ts +2 -0
  174. package/src/providers/workbuddy-credit-balance.ts +125 -16
  175. package/src/responses/citation-markers.ts +26 -23
  176. package/src/responses/effort-history.ts +732 -0
  177. package/src/routing/history/integrity.ts +41 -4
  178. package/src/server/auth-cors.ts +13 -3
  179. package/src/server/codex-model-list.ts +2 -1
  180. package/src/server/direct-local-http.ts +26 -3
  181. package/src/server/index/link-listener.ts +20 -14
  182. package/src/server/index/serve-options.ts +1 -0
  183. package/src/server/index.ts +3 -2
  184. package/src/server/link-turn.ts +17 -5
  185. package/src/server/management/config-routes.ts +39 -3
  186. package/src/server/management/link-child-preflight.ts +1 -1
  187. package/src/server/management/link-enrollment.ts +3 -3
  188. package/src/server/management/link-route-edit.ts +20 -1
  189. package/src/server/management/link-route-request.ts +11 -5
  190. package/src/server/management/oauth-account-routes.ts +43 -13
  191. package/src/server/management/provider-credential-release.ts +44 -0
  192. package/src/server/management/provider-overwrite-carry.ts +3 -0
  193. package/src/server/management/provider-routes.ts +12 -12
  194. package/src/server/management/static-catalog-probe.ts +33 -0
  195. package/src/server/management/usage-aggregate-cache.ts +6 -3
  196. package/src/server/messages-native.ts +16 -2
  197. package/src/server/proxy-liveness.ts +54 -9
  198. package/src/server/relay.ts +6 -1
  199. package/src/server/request-log-conversation.ts +8 -4
  200. package/src/server/request-log-failure-detail.ts +26 -9
  201. package/src/server/request-log.ts +5 -1
  202. package/src/server/reserve-capability-startup.ts +32 -0
  203. package/src/server/responses/adapter-continuation.ts +59 -25
  204. package/src/server/responses/adapter-delivery.ts +2 -0
  205. package/src/server/responses/adapter-dispatch.ts +39 -18
  206. package/src/server/responses/antigravity-fault-rotation.ts +24 -0
  207. package/src/server/responses/antigravity-validation-refusal.ts +43 -6
  208. package/src/server/responses/codex-tool-catalog.ts +47 -10
  209. package/src/server/responses/combo-selection-keepalive.ts +254 -0
  210. package/src/server/responses/combo-session-recall.ts +26 -1
  211. package/src/server/responses/combo-stream-preflight.ts +35 -26
  212. package/src/server/responses/core-combo-failure.ts +6 -0
  213. package/src/server/responses/core-combo-native.ts +2 -1
  214. package/src/server/responses/core-combo.ts +67 -28
  215. package/src/server/responses/core-errors.ts +9 -6
  216. package/src/server/responses/core-options.ts +10 -0
  217. package/src/server/responses/core.ts +21 -0
  218. package/src/server/responses/estimated-usage.ts +115 -0
  219. package/src/server/responses/input-admission.ts +41 -3
  220. package/src/server/responses/jev-model-invoke.ts +7 -2
  221. package/src/server/responses/passthrough-completion.ts +6 -3
  222. package/src/server/responses/passthrough-delivery.ts +47 -8
  223. package/src/server/responses/passthrough-dispatch.ts +3 -0
  224. package/src/server/responses/request-prepare.ts +9 -5
  225. package/src/server/responses/request-send-budget.ts +1 -1
  226. package/src/server/responses/request-transport.ts +10 -2
  227. package/src/server/responses/sidecar-execution.ts +11 -4
  228. package/src/service/desktop-supervision.d.mts +2 -0
  229. package/src/service/desktop-supervision.mjs +5 -0
  230. package/src/service/windows-checked-stop-live.ts +28 -5
  231. package/src/stall-timeout.ts +11 -0
  232. package/src/types/config.ts +15 -92
  233. package/src/types/provider.ts +13 -0
  234. package/src/types/request.ts +23 -3
  235. package/src/types/routed-catalog-defaults.ts +17 -0
  236. package/src/types/routing-profile.ts +90 -0
  237. package/src/types.ts +1 -0
  238. package/src/update/index.ts +1 -1
  239. package/src/usage/expected-prices.ts +35 -0
  240. package/src/usage/ledger-scanner.ts +44 -10
  241. package/src/usage/log.ts +14 -4
  242. package/src/usage/telemetry-contract.ts +1 -0
  243. package/src/web-search/loop.ts +20 -2
  244. package/src/web-search/parse.ts +2 -12
  245. package/src/web-search/passthrough-bridge.ts +7 -0
  246. package/src/web-search/sources.ts +13 -0
  247. package/gui/dist/assets/brand-mark-XOLJbomA.js +0 -1
  248. package/gui/dist/assets/index-DQtCRNAw.css +0 -2
  249. package/gui/dist/classic/assets/quota-summary-Dy5_wfTT.js +0 -1
@@ -1157,6 +1157,12 @@ function buildPiClientConfig(ctx: ExportContext, options: PiExportOptions = {}):
1157
1157
  */
1158
1158
  const PI_EXPORT_OPTIONS: PiExportOptions = { sendSessionAffinityHeaders: true, foldDeveloperRole: true };
1159
1159
  const PI_NATIVE_SELECTOR_OPTIONS: PiExportOptions = { ...PI_EXPORT_OPTIONS, rawNestedModelIds: true, omitNativeInCodexDirect: true };
1160
+ /**
1161
+ * Prime and Aside run the Pi runtime and read the same models.json, so they need Pi's developer-role
1162
+ * statement (#8864): without it they send their system prompt as `developer`, which DashScope and
1163
+ * Moonshot reject with a 400. Session affinity stays Pi's alone (eb8cc9ab73).
1164
+ */
1165
+ const PI_DEVELOPER_ROLE_OPTIONS: PiExportOptions = { foldDeveloperRole: true };
1160
1166
 
1161
1167
  /** Do not let provider-controlled catalog text become an environment lookup. */
1162
1168
  function containsEnvInterpolation(value: string): boolean {
@@ -1413,7 +1419,7 @@ function buildGajaeContribution(ctx: ExportContext): ManagedContribution {
1413
1419
  * code is stamping the right client id on the ownership record.
1414
1420
  */
1415
1421
  function buildPrimeContribution(ctx: ExportContext): ManagedContribution {
1416
- const doc = buildPiClientConfig(ctx);
1422
+ const doc = buildPiClientConfig(ctx, PI_DEVELOPER_ROLE_OPTIONS);
1417
1423
  return singleFragment("prime", ["providers", OPENCODE_PROVIDER_ID], doc.providers[OPENCODE_PROVIDER_ID]);
1418
1424
  }
1419
1425
 
@@ -1436,7 +1442,7 @@ function buildPrimeContribution(ctx: ExportContext): ManagedContribution {
1436
1442
  * the fragment this client recorded and not one another client wrote.
1437
1443
  */
1438
1444
  function buildAsideContribution(ctx: ExportContext): ManagedContribution {
1439
- const doc = buildPiClientConfig(ctx);
1445
+ const doc = buildPiClientConfig(ctx, PI_DEVELOPER_ROLE_OPTIONS);
1440
1446
  return singleFragment("aside", ["providers", OPENCODE_PROVIDER_ID], doc.providers[OPENCODE_PROVIDER_ID]);
1441
1447
  }
1442
1448
 
@@ -1449,9 +1455,8 @@ function buildAsideContribution(ctx: ExportContext): ManagedContribution {
1449
1455
  * `thinkingLevelMap` levels. Evidence:
1450
1456
  * `devlog/_fin/260912_omo_client_integration/001_omo_contract.md`.
1451
1457
  *
1452
- * The flag is passed HERE as well as in the spec's `build`, which is the one
1453
- * thing Prime and Aside do not do. They pass the default on both paths, so they
1454
- * are consistent; passing it on only one would make `ocx export --client omo`
1458
+ * The flag is passed HERE as well as in the spec's `build`, the same rule Prime
1459
+ * and Aside follow with their own options; passing it on only one would make `ocx export --client omo`
1455
1460
  * emit a `compat` block while enable and refresh wrote a file without it, and
1456
1461
  * the two would drift apart at the first refresh.
1457
1462
  *
@@ -1668,7 +1673,7 @@ export const EXPORT_CLIENTS: Record<ExportClientId, ExportClientSpec> = {
1668
1673
  destination: env => primeConfigPath(env),
1669
1674
  apiKeyEnv: "",
1670
1675
  exportHint: "Prime Agent reads a non-secret placeholder from models.json; loopback needs no key.",
1671
- build: buildPiClientConfig,
1676
+ build: ctx => buildPiClientConfig(ctx, PI_DEVELOPER_ROLE_OPTIONS),
1672
1677
  format: "json",
1673
1678
  summarize: summarizePi,
1674
1679
  buildContribution: buildPrimeContribution,
@@ -1686,7 +1691,7 @@ export const EXPORT_CLIENTS: Record<ExportClientId, ExportClientSpec> = {
1686
1691
  destination: env => asideConfigPath(env),
1687
1692
  apiKeyEnv: "",
1688
1693
  exportHint: "Aside reads a non-secret placeholder from models.json; loopback needs no key.",
1689
- build: buildPiClientConfig,
1694
+ build: ctx => buildPiClientConfig(ctx, PI_DEVELOPER_ROLE_OPTIONS),
1690
1695
  format: "json",
1691
1696
  summarize: summarizePi,
1692
1697
  buildContribution: buildAsideContribution,
@@ -73,7 +73,9 @@ function purgeMainCodexAccountRuntimeState(): void {
73
73
  invalidateCodexWebSocketsForAccount(MAIN_CODEX_ACCOUNT_ID);
74
74
  }
75
75
 
76
- function observeMainCodexAccountIdentity(accountId: string): boolean {
76
+ /** One owned complete identity observation; retire the prior account before publishing the new generation. */
77
+ export function observeMainCodexAccountIdentity(accountId: string): boolean {
78
+ if (!accountId) return false;
77
79
  const previousAccountId = observedMainChatgptAccountId;
78
80
  observedMainChatgptAccountId = accountId;
79
81
  const changed = previousAccountId !== undefined && previousAccountId !== accountId;
@@ -2,6 +2,8 @@ import { randomUUID } from "node:crypto";
2
2
  import type { AccountPauseDetails } from "../types/account-auto-pause";
3
3
  import type { OcxConfig } from "../types";
4
4
  import { deleteConfigTopLevelKey } from "../config/rebase-provenance";
5
+ import { MAIN_CODEX_ACCOUNT_ID } from "./account-id";
6
+ import { invalidateRetainedNativeMainLogin } from "./native-main-credentials";
5
7
 
6
8
  /** Whether an account is administratively excluded from future pool selection. */
7
9
  export function isCodexAccountPaused(config: OcxConfig, accountId: string): boolean {
@@ -10,6 +12,8 @@ export function isCodexAccountPaused(config: OcxConfig, accountId: string): bool
10
12
 
11
13
  /** Persist the account's pool eligibility without changing credentials or runtime health. */
12
14
  export function setCodexAccountPaused(config: OcxConfig, accountId: string, paused: boolean, details?: AccountPauseDetails): void {
15
+ // Pausing main ends a retained native-main login; resuming never revives it (#7345).
16
+ if (paused && accountId === MAIN_CODEX_ACCOUNT_ID) invalidateRetainedNativeMainLogin("pause");
13
17
  config.codexAccountPauseState = { ...config.codexAccountPauseState,
14
18
  [accountId]: { revision: randomUUID(), ...(paused && details ? { details } : {}) } };
15
19
  const pausedIds = new Set(config.pausedCodexAccountIds ?? []);
@@ -1,6 +1,8 @@
1
1
  import { setDecisionAccountUsable } from "../lib/decision-quota-sink";
2
2
  import { captureConfigGeneration, type GenerationContext } from "../lib/state-store-sweeper";
3
3
  import { isCodexAccountGenerationLive } from "./account-store";
4
+ import { MAIN_CODEX_ACCOUNT_ID } from "./account-id";
5
+ import { invalidateRetainedNativeMainLogin } from "./native-main-credentials";
4
6
 
5
7
  /**
6
8
  * Accounts quarantined for reauthentication, each remembering WHICH credential produced the
@@ -25,6 +27,7 @@ const refusedMainRefreshGrants = new Set<string>();
25
27
  const MAX_REFUSED_MAIN_REFRESH_GRANTS = 64;
26
28
 
27
29
  export function markMainRefreshGrantRejected(key: string): void {
30
+ invalidateRetainedNativeMainLogin("revocation");
28
31
  refusedMainRefreshGrants.add(key);
29
32
  if (refusedMainRefreshGrants.size > MAX_REFUSED_MAIN_REFRESH_GRANTS) {
30
33
  refusedMainRefreshGrants.delete(refusedMainRefreshGrants.values().next().value!);
@@ -47,6 +50,7 @@ export function markAccountNeedsReauth(
47
50
  credentialGeneration?: number,
48
51
  ): void {
49
52
  if (writerGeneration < lastReconciledGeneration && !liveAccountIds.has(id)) return;
53
+ if (id === MAIN_CODEX_ACCOUNT_ID) invalidateRetainedNativeMainLogin("revocation");
50
54
  setDecisionAccountUsable(id === "__main__" ? "codex-main" : "codex", id, false, credentialGeneration);
51
55
  // An account-wide mark supersedes a generation-scoped one: it is the stronger claim.
52
56
  if (credentialGeneration === undefined || !reauthAccounts.has(id)) {
@@ -154,6 +154,8 @@ export interface MainAccountInfoProbeOptions {
154
154
  passive?: boolean;
155
155
  /** Exact owned result obtained before entering WHAM's shared credential claim. Never serialized. */
156
156
  preparedToken?: MainAccountToken | null;
157
+ /** Always use paced usage scheduling, so failure backoff and Retry-After are recorded in every mode. */
158
+ paced?: boolean;
157
159
  }
158
160
 
159
161
  export const EMPTY_MAIN_ACCOUNT_INFO: MainAccountInfo = { email: null, plan: null, quota: null };
@@ -215,7 +217,7 @@ export async function fetchMainAccountInfoAttempt(
215
217
  }
216
218
  }
217
219
  const probeOptions = preparedToken === undefined ? options : { ...options, preparedToken };
218
- const paced = sharedMainQuotaPacingEnabled(config ?? loadConfig());
220
+ const paced = options.paced === true || sharedMainQuotaPacingEnabled(config ?? loadConfig());
219
221
  const operation = async () => ({
220
222
  ...await fetchMainAccountInfoWhileOwned(forceRefresh, retriesRemaining, nativeMainLease, explicitRefresh, postReset, paced, probeOptions),
221
223
  identityGeneration: captureMainAccountIdentityGeneration(),
@@ -0,0 +1,172 @@
1
+ import type { OcxConfig } from "../../types";
2
+ import { MAIN_CODEX_ACCOUNT_ID } from "../account-id";
3
+ import { reconcileMainCodexAccountRuntimeState } from "../account-lifecycle";
4
+ import { isCodexAccountPaused } from "../account-pause";
5
+ import { isAccountNeedsReauth } from "../account-runtime-state";
6
+ import { getMainAccountHardLockStatus } from "../main-account-hard-lock";
7
+ import { getValidMainAccountToken, mainAccountTokenIsCurrent, mainAccountTokenQuotaWriter } from "../main-account";
8
+ import {
9
+ captureMainAccountIdentityGeneration, captureMainQuotaDispatch, getMainQuotaCredentialGeneration, getObservedMainQuotaIdentityKey,
10
+ isMainAccountIdentityGenerationLive, isMainQuotaDispatchLive, matchesMainQuotaCredential, observeMainQuotaCredential,
11
+ } from "../main-account-cache";
12
+ import { tryAcquireNativeMainProfileClaim } from "../native-main-admission";
13
+ import { isNativeMainTrafficBlocked } from "../native-profile-startup";
14
+ import {
15
+ getMainPolicyUsageObservedAt, isValidWhamHistoryObservation, parseMainPolicyUsageQuota, parseUsageQuota, setAccountQuotaFromParsed,
16
+ type WhamUsageResponse,
17
+ } from "../quota";
18
+ import { fetchCodexUsage, nextCodexUsageQueryAt } from "../quota-query-backoff";
19
+ import { WHAM_REQUEST_TIMEOUT_MS } from "../quota-recovery-timing";
20
+ import { captureConfigGeneration } from "../../lib/state-store-sweeper";
21
+ import type { AdmissionLease } from "../../lib/admission";
22
+ import { fetchMainAccountInfoAttempt } from "./main-account-probe";
23
+ import { isQuotaDispatchCurrent, nextQuotaDispatchSequence, publishQuotaDispatch } from "./pool-quota-probe";
24
+
25
+ /** A hard-lock reading younger than this is current enough to refuse on (#8113). */
26
+ export const MAIN_HARD_LOCK_REFUSAL_READ_AGE_MS = 60_000;
27
+ /** At most one refusal-triggered WHAM read per main identity in this window. */
28
+ export const MAIN_HARD_LOCK_REFUSAL_READ_INTERVAL_MS = 60_000;
29
+
30
+ // Last refusal read per main identity, kept for the whole interval so an A→B→A switch cannot reset it.
31
+ const lastReadAt = new Map<string, number>();
32
+ let inFlight: Promise<void> | undefined;
33
+
34
+ /**
35
+ * The caller's own credential when the refused request authenticates as the main login itself
36
+ * (caller-owned Direct, or a request-scoped main bearer in Pool). Such a request may not read the
37
+ * physical main credential, so its fresh read uses this bearer, which the lock already proved is
38
+ * the observed main credential.
39
+ */
40
+ export interface MainHardLockRefusalCaller {
41
+ bearer: string;
42
+ accountId: string;
43
+ }
44
+
45
+ /** Test-only: forget the per-identity pacing and any settled read. */
46
+ export function resetMainHardLockRefusalReadForTests(): void {
47
+ lastReadAt.clear();
48
+ inFlight = undefined;
49
+ }
50
+
51
+ /**
52
+ * Before a main hard-lock refusal, read WHAM once when the reading behind the lock is stale (#8113).
53
+ *
54
+ * A reset redeemed outside OpenCodex leaves the cached reading above the threshold until a later
55
+ * observation replaces it, and the paced background recovery may not run for minutes. When the
56
+ * cached reading is older than {@link MAIN_HARD_LOCK_REFUSAL_READ_AGE_MS}, this reads usage once:
57
+ * with the proxy-owned main credential and the native-main claim through the recovery probe, or,
58
+ * for a caller-owned main request, with the caller's own bearer, published only while that bearer
59
+ * still matches the observed main credential. Concurrent refusals share
60
+ * one read, and each main identity gets at most one read per
61
+ * {@link MAIN_HARD_LOCK_REFUSAL_READ_INTERVAL_MS}. Server-advised usage backoff, a paused main,
62
+ * reauthentication quarantine and native-main maintenance all skip the read. The read is passive:
63
+ * it never sets or clears the reauthentication quarantine.
64
+ *
65
+ * Returns `true` when the lock no longer blocks, so the caller may resolve the request again;
66
+ * `false` keeps the refusal. A failed read keeps the existing policy observation.
67
+ */
68
+ export async function refreshMainHardLockBeforeRefusal(
69
+ config: OcxConfig,
70
+ policy: Parameters<typeof getMainAccountHardLockStatus>[0] = config,
71
+ signal?: AbortSignal,
72
+ /** The caller-owned main credential; `null` when the request is caller-owned but unusable for a read. */
73
+ caller?: MainHardLockRefusalCaller | null,
74
+ now: () => number = Date.now,
75
+ ): Promise<boolean> {
76
+ const blocked = () => getMainAccountHardLockStatus(policy, now()).state === "blocked";
77
+ if (!blocked()) return true;
78
+ if (caller === null) return false;
79
+ // The usage measurement's age, not the snapshot's write time: credits-only merges rewrite the latter.
80
+ const observedAt = getMainPolicyUsageObservedAt();
81
+ if (observedAt !== undefined && now() - observedAt < MAIN_HARD_LOCK_REFUSAL_READ_AGE_MS) return false;
82
+ if (isNativeMainTrafficBlocked() || isAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID)
83
+ || isCodexAccountPaused(config, MAIN_CODEX_ACCOUNT_ID)) return false;
84
+ if (!inFlight) {
85
+ const identity = getObservedMainQuotaIdentityKey() ?? "";
86
+ for (const [key, at] of lastReadAt) {
87
+ if (now() - at >= MAIN_HARD_LOCK_REFUSAL_READ_INTERVAL_MS) lastReadAt.delete(key);
88
+ }
89
+ if (lastReadAt.has(identity)) return false;
90
+ const queryAfter = nextCodexUsageQueryAt(`main:${captureConfigGeneration()}:${getMainQuotaCredentialGeneration()}`);
91
+ if (queryAfter !== undefined && queryAfter > now()) return false;
92
+ let read: Promise<void>;
93
+ if (caller) {
94
+ // Without a live proof for the caller's credential there is nothing to read; keep the minute.
95
+ const dispatch = captureMainQuotaDispatch(caller.bearer, caller.accountId, captureConfigGeneration());
96
+ if (!dispatch) return false;
97
+ lastReadAt.set(identity, now());
98
+ read = readCallerMainUsage(caller, dispatch);
99
+ } else {
100
+ const lease = tryAcquireNativeMainProfileClaim();
101
+ if (!lease) return false;
102
+ lastReadAt.set(identity, now());
103
+ read = readMainUsage(config, lease).finally(() => lease.release());
104
+ }
105
+ read = read
106
+ .catch(() => { /* the refusal stands on the existing observation */ })
107
+ .finally(() => { if (inFlight === read) inFlight = undefined; });
108
+ inFlight = read;
109
+ }
110
+ await abortable(inFlight, signal);
111
+ return !blocked();
112
+ }
113
+
114
+ async function readMainUsage(config: OcxConfig, lease: AdmissionLease): Promise<void> {
115
+ reconcileMainCodexAccountRuntimeState();
116
+ const identityGeneration = captureMainAccountIdentityGeneration();
117
+ // Refresh can need an exclusive credential claim, so obtain the token before WHAM's shared claim.
118
+ const prepared = await getValidMainAccountToken({ preserveReauth: true });
119
+ if (!prepared) return;
120
+ if (mainAccountTokenQuotaWriter(prepared)) {
121
+ if (!mainAccountTokenIsCurrent(prepared)) return;
122
+ } else observeMainQuotaCredential(prepared.accessToken, prepared.chatgptAccountId);
123
+ if (!isMainAccountIdentityGenerationLive(identityGeneration) || isAccountNeedsReauth(MAIN_CODEX_ACCOUNT_ID)) return;
124
+ // Paced in every account mode: a failed or Retry-After answer must defer the next read.
125
+ await fetchMainAccountInfoAttempt(true, 1, lease, false, false, false, config,
126
+ { passive: true, preparedToken: prepared, paced: true });
127
+ }
128
+
129
+ /** Usage read with the caller's own main bearer: no physical credential read, no reauth state. */
130
+ async function readCallerMainUsage(
131
+ caller: MainHardLockRefusalCaller, dispatch: NonNullable<ReturnType<typeof captureMainQuotaDispatch>>,
132
+ ): Promise<void> {
133
+ // The dispatch proof also fences credential commits (refresh, reauthentication) that advance the
134
+ // mutation epoch before the observed credential itself changes.
135
+ const writerGeneration = dispatch.configGeneration;
136
+ // Ordered like the main probe: a response publishes only if no later dispatch already published.
137
+ const sequence = nextQuotaDispatchSequence();
138
+ const key = `main:${writerGeneration}:${dispatch.credentialGeneration}`;
139
+ const admission = await fetchCodexUsage(key, {
140
+ headers: { Authorization: `Bearer ${caller.bearer}`, "ChatGPT-Account-Id": caller.accountId },
141
+ signal: AbortSignal.timeout(WHAM_REQUEST_TIMEOUT_MS),
142
+ }, undefined, { pacingKey: key });
143
+ // A joined read belongs to another owner, which publishes its own evidence.
144
+ if (!admission || admission.kind === "joined") return;
145
+ let usable = false;
146
+ try {
147
+ if (!admission.response.ok) return;
148
+ const data = await admission.response.json() as WhamUsageResponse;
149
+ if (data === null || typeof data !== "object" || Array.isArray(data)) return;
150
+ // The main login may have changed while the read was in flight; never publish across it.
151
+ if (!isMainQuotaDispatchLive(dispatch) || !matchesMainQuotaCredential(caller.bearer, caller.accountId)
152
+ || writerGeneration !== captureConfigGeneration() || !isQuotaDispatchCurrent(sequence)) return;
153
+ const quota = parseUsageQuota(data);
154
+ if (!quota) return;
155
+ setAccountQuotaFromParsed(MAIN_CODEX_ACCOUNT_ID, quota, writerGeneration, dispatch.writer, parseMainPolicyUsageQuota(data),
156
+ undefined, false, false, isValidWhamHistoryObservation(data) ? quota : null);
157
+ publishQuotaDispatch(sequence);
158
+ usable = true;
159
+ } finally {
160
+ admission.settle(usable);
161
+ }
162
+ }
163
+
164
+ function abortable(promise: Promise<void>, signal?: AbortSignal): Promise<void> {
165
+ if (!signal) return promise;
166
+ signal.throwIfAborted();
167
+ return new Promise<void>((resolve, reject) => {
168
+ const onAbort = () => reject(signal.reason);
169
+ signal.addEventListener("abort", onAbort, { once: true });
170
+ promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
171
+ });
172
+ }
@@ -535,7 +535,7 @@ export class CodexReserveUnavailableError extends CodexAccountCooldownError {
535
535
  this.name = "CodexReserveUnavailableError";
536
536
  this.message = "Codex Reserve is unavailable for this main credential."
537
537
  + " Use the stored main login or its matching caller credential, and retry when OpenAI grants Reserve access."
538
- + " Reserve compatibility requires the effective local Desktop authless opt-in; it cannot switch accounts automatically.";
538
+ + " Reserve compatibility requires the local Reserve setting (codexReserveEnabled); it cannot switch accounts automatically.";
539
539
  }
540
540
  }
541
541
 
@@ -587,7 +587,8 @@ export class CodexRecoveryWithheldError extends CodexAccountCooldownError {
587
587
  }
588
588
 
589
589
  export type CodexAuthPolicyConfig = Readonly<Pick<OcxConfig,
590
- "codexMainAccountHardLock" | "codexMainAccountHardLockThresholds" | "codexDesktopAuthless" | "runtimeRole" | "pausedCodexAccountIds"
590
+ "codexMainAccountHardLock" | "codexMainAccountHardLockThresholds" | "codexDesktopAuthless" | "codexReserveEnabled"
591
+ | "codexReserveMigration" | "runtimeRole" | "pausedCodexAccountIds"
591
592
  | "creditCodexAccountIds" | "codexAccounts" | "codexUseRemainingQuotaAccountIds"
592
593
  >>;
593
594
 
@@ -1063,6 +1064,43 @@ export async function resolveCodexAuthContext(
1063
1064
  config: OcxConfig,
1064
1065
  mode: CodexAccountMode,
1065
1066
  options: ResolveCodexAuthContextOptions = {},
1067
+ ): Promise<CodexAuthContext> {
1068
+ try {
1069
+ return await resolveCodexAuthContextWithHint(headers, config, mode, options);
1070
+ } catch (error) {
1071
+ // #8113: a refusal resting on a reading older than 60 s first gets one fresh WHAM read, so a
1072
+ // reset redeemed outside OpenCodex lifts the lock now instead of at the next paced recovery.
1073
+ if (!(error instanceof CodexMainAccountHardLockError)) throw error;
1074
+ const { refreshMainHardLockBeforeRefusal } = await import("./auth-api/main-hard-lock-refusal-read");
1075
+ if (!await refreshMainHardLockBeforeRefusal(config, options.codexAuthPolicy ?? config, options.signal,
1076
+ callerOwnedMainRefusal(headers, mode, options))) throw error;
1077
+ return await resolveCodexAuthContextWithHint(headers, config, mode, options);
1078
+ }
1079
+ }
1080
+
1081
+ /**
1082
+ * A refusal for a request that authenticates as the main login itself. That request may never
1083
+ * read the physical main credential, so its fresh read uses the caller's own bearer (#8113).
1084
+ * Any other refusal is about the proxy-owned main credential.
1085
+ */
1086
+ function callerOwnedMainRefusal(
1087
+ headers: Headers, mode: CodexAccountMode, options: ResolveCodexAuthContextOptions,
1088
+ ): { bearer: string; accountId: string } | null | undefined {
1089
+ if (options.substituteMainCredentialForDirect === true || !hasCallerCodexBearer(headers)) return undefined;
1090
+ if (mode !== "direct" && options.requestScopedMainCredential !== true) return undefined;
1091
+ // An explicit stored-account selection resolves the proxy-owned credential, whatever bearer arrived.
1092
+ if (options.accountId !== undefined && options.requestScopedMainCredential !== true) return undefined;
1093
+ const bearer = authorizationCredential(headers);
1094
+ const accountId = headers.get("chatgpt-account-id") ?? (bearer ? extractAccountId(undefined, bearer) : undefined);
1095
+ // Caller-owned without a usable credential: no read at all, never the physical one.
1096
+ return bearer && accountId ? { bearer, accountId } : null;
1097
+ }
1098
+
1099
+ async function resolveCodexAuthContextWithHint(
1100
+ headers: Headers,
1101
+ config: OcxConfig,
1102
+ mode: CodexAccountMode,
1103
+ options: ResolveCodexAuthContextOptions,
1066
1104
  ): Promise<CodexAuthContext> {
1067
1105
  // Filled by the inner resolver with the request's own fenced model evidence, so the hint obeys it.
1068
1106
  const eligibility: RecoveryHintEligibility = {};
@@ -52,6 +52,7 @@ import { PICKER_ORDER_PRIORITY_BASE, SPAWN_PRIORITY_FIELD } from "./subagent-ros
52
52
  import { applyConfiguredUltraFast, configuredUltraFastSlugs } from "./configured-tiers";
53
53
  import { applyNativeUltraFastTier } from "./native-ultrafast";
54
54
  import { applyNativePriority, retainedNativeSourcePriorities, type NativePrioritySource } from "./native-priority";
55
+ import type { RoutedCatalogDefaults } from "../../config/schema/routed-catalog-defaults";
55
56
 
56
57
  export interface ObservedCatalogEntryBuildInput {
57
58
  readonly template: RawEntry | null;
@@ -76,6 +77,8 @@ export interface ObservedCatalogEntryBuildInput {
76
77
  /** Codex-only manual selector metadata; deliberately independent of live permission. */
77
78
  readonly reserve?: ReserveCatalogProjection;
78
79
  readonly nativeSource?: NativePrioritySource;
80
+ /** Captured `routedCatalogDefaults` (#6872); applied to routed rows only, never read from config here. */
81
+ readonly routedCatalogDefaults?: Readonly<RoutedCatalogDefaults>;
79
82
  }
80
83
 
81
84
  /** Build entries with the process-observed Codex feature state. */
@@ -96,6 +99,7 @@ export function buildCatalogEntries(
96
99
  keepNativeChatGptOnV1 = false,
97
100
  modelPickerOrder: readonly string[] = [],
98
101
  nativeSource?: NativePrioritySource,
102
+ routedCatalogDefaults?: Readonly<RoutedCatalogDefaults>,
99
103
  ): RawEntry[] {
100
104
  const entries = buildCatalogEntriesFromObservedState({
101
105
  template,
@@ -115,6 +119,7 @@ export function buildCatalogEntries(
115
119
  accountNativeSlugs,
116
120
  accountNativeSlugsBySelector,
117
121
  nativeSource,
122
+ routedCatalogDefaults,
118
123
  });
119
124
  // Live discovery does not run the disk merge; use the same captured declarations and row fences.
120
125
  const configured = configuredUltraFastSlugs(goModels);
@@ -148,6 +153,7 @@ export function buildCatalogEntriesFromObservedState({
148
153
  accountNativeSlugsBySelector,
149
154
  reserve,
150
155
  nativeSource,
156
+ routedCatalogDefaults,
151
157
  }: ObservedCatalogEntryBuildInput): RawEntry[] {
152
158
  // Codex's models-manager sorts by `priority` ASC and advertises the first 5 picker-visible
153
159
  // models to spawn_agent (sort_by_key(priority) + MAX_MODEL_OVERRIDES_IN_SPAWN_AGENT=5). Catalog
@@ -228,6 +234,8 @@ export function buildCatalogEntriesFromObservedState({
228
234
  5,
229
235
  nativeAlias,
230
236
  exactComboSlugs,
237
+ undefined,
238
+ routedCatalogDefaults,
231
239
  );
232
240
  routed.opencodex_catalog_kind = CODEX_NATIVE_ALIAS_CATALOG_KIND;
233
241
  const rankHit = rank.get(slug) ?? rank.get(`${nativeAlias.provider}/${nativeAlias.id}`);
@@ -286,6 +294,8 @@ export function buildCatalogEntriesFromObservedState({
286
294
  5,
287
295
  m,
288
296
  exactComboSlugs,
297
+ undefined,
298
+ routedCatalogDefaults,
289
299
  );
290
300
  if (m.provider === COMBO_NAMESPACE && m.nativeAlias === true && !slug.includes("/")) {
291
301
  e.opencodex_catalog_kind = CODEX_NATIVE_ALIAS_CATALOG_KIND;
@@ -28,6 +28,8 @@ import {
28
28
  import { CATALOG_INACTIVE_REASON_FIELD, SPAWN_PRIORITY_FIELD } from "./subagent-roster";
29
29
  import { OCX_NATIVE_SOURCE_PRIORITY_FIELD } from "./native-priority";
30
30
  import { applyRoutedDescription } from "./ownership";
31
+ import { applyRoutedCatalogDefaults } from "./routed-defaults";
32
+ import type { RoutedCatalogDefaults } from "../../config/schema/routed-catalog-defaults";
31
33
 
32
34
  export function finishUpstreamNativeEntry(clone: RawEntry, priority: number, contextCap?: NativeContextLimitsInput): RawEntry {
33
35
  if (priority !== 9) clone.priority = priority;
@@ -99,6 +101,8 @@ function preservePinnedNativeCustomReasoning(model?: CatalogModel): boolean {
99
101
  * Cria uma entrada nativa ou roteada a partir do snapshot upstream, de um clone
100
102
  * do template ou de campos mínimos. Aplica os metadados e limites pertinentes
101
103
  * sem alterar o template nem herdar sua marca de nome ou histórico de prioridade.
104
+ * `routedDefaults` (#6872) only reaches ordinary routed rows, between routed normalization
105
+ * and provider/model metadata; native rows and Codex-forward native aliases ignore it.
102
106
  */
103
107
  export function deriveEntry(
104
108
  template: RawEntry | null,
@@ -108,6 +112,7 @@ export function deriveEntry(
108
112
  model?: CatalogModel,
109
113
  exactComboSlugs: ReadonlySet<string> = new Set(),
110
114
  contextCap?: NativeContextLimitsInput,
115
+ routedDefaults?: Readonly<RoutedCatalogDefaults>,
111
116
  ): RawEntry {
112
117
  const preserveExact = isExactComboCatalogModel(model, exactComboSlugs);
113
118
  // Go exposes model-specific upstream enums; synthetic tiers mislead subagent overrides.
@@ -173,6 +178,7 @@ export function deriveEntry(
173
178
  // native tool/search/responses-lite contract while preserving the routed slug and wire id.
174
179
  if (!codexForwardNativeCapabilityAlias) {
175
180
  normalizeRoutedCatalogEntry(e, model?.parallelToolCalls === true, model?.codexToolMode);
181
+ applyRoutedCatalogDefaults(e, routedDefaults);
176
182
  } else if (model?.codexToolMode !== undefined) {
177
183
  applyRoutedCodexToolMode(e, model.codexToolMode);
178
184
  }
@@ -218,6 +224,7 @@ export function deriveEntry(
218
224
  applyRoutedDescription(entry, desc, model);
219
225
  if (isRouted) {
220
226
  applyRoutedCodexToolMode(entry, model?.codexToolMode);
227
+ if (model?.codexForwardNativeCapabilityAlias !== true) applyRoutedCatalogDefaults(entry, routedDefaults);
221
228
  applyReasoningLevels(
222
229
  entry,
223
230
  model?.reasoningEfforts,
@@ -53,6 +53,8 @@ import {
53
53
  NATIVE_GPT6_SOL_MODEL,
54
54
  NATIVE_GPT61_SOL_MODEL,
55
55
  NATIVE_GPT61_TERRA_MODEL,
56
+ NATIVE_GPT62_SOL_MODEL,
57
+ NATIVE_GPT62_ASTRA_MODEL,
56
58
  NATIVE_RESERVE_MODEL,
57
59
  NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
58
60
  NATIVE_OPENAI_MODELS,
@@ -80,6 +82,8 @@ export {
80
82
  NATIVE_GPT6_SOL_MODEL,
81
83
  NATIVE_GPT61_SOL_MODEL,
82
84
  NATIVE_GPT61_TERRA_MODEL,
85
+ NATIVE_GPT62_SOL_MODEL,
86
+ NATIVE_GPT62_ASTRA_MODEL,
83
87
  NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
84
88
  NATIVE_OPENAI_MODELS,
85
89
  SELF_DESCRIBED_NATIVE_OPENAI_MODELS,
@@ -103,6 +107,8 @@ export const DOCUMENTED_NATIVE_OPENAI_ADDITIONS = [
103
107
  NATIVE_GPT61_SOL_MODEL,
104
108
  // Terra's pinned row has the same client floor and backfills older installed catalogs too.
105
109
  NATIVE_GPT61_TERRA_MODEL,
110
+ NATIVE_GPT62_SOL_MODEL,
111
+ NATIVE_GPT62_ASTRA_MODEL,
106
112
  ];
107
113
 
108
114
  export function configuredNativeAliasSlugs(
@@ -213,6 +219,8 @@ export const NATIVE_OPENAI_CONTEXT_OVERRIDES: Record<string, { contextWindow?: n
213
219
  // raised its Codex & Work default to 500,000 on 2026-10-11; the 872,000 ceiling is unchanged.
214
220
  [NATIVE_GPT61_SOL_MODEL]: { ...NATIVE_GPT61_SOL_CONTEXT },
215
221
  [NATIVE_GPT61_TERRA_MODEL]: { ...NATIVE_GPT61_TERRA_CONTEXT },
222
+ [NATIVE_GPT62_SOL_MODEL]: { ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 },
223
+ [NATIVE_GPT62_ASTRA_MODEL]: { ...NATIVE_GPT6_CONTEXT },
216
224
  // Astra Minor borrows Astra's row, so it inherits Astra's numbers. No account we hold can reach
217
225
  // it, so this is inheritance, not a measurement.
218
226
  [NATIVE_GPT6_ASTRA_MINOR_MODEL]: { ...NATIVE_GPT6_CONTEXT },
@@ -57,6 +57,10 @@ export const NATIVE_GPT61_SOL_MODEL = "gpt-6.1-sol";
57
57
  */
58
58
  export const NATIVE_GPT61_TERRA_MODEL = "gpt-6.1-terra";
59
59
 
60
+ /** Self-described flagships pinned from openai/codex #62106. */
61
+ export const NATIVE_GPT62_SOL_MODEL = "gpt-6.2-sol";
62
+ export const NATIVE_GPT62_ASTRA_MODEL = "gpt-6.2-astra";
63
+
60
64
  /**
61
65
  * Unreleased GPT-6 Astra variant. No public row exists anywhere — neither the codex-rs bundle nor
62
66
  * the 2026-09-23 main-account roster probe carries it — so it is ACCOUNT-GATED: hidden and
@@ -72,7 +76,7 @@ export const NATIVE_GPT6_ASTRA_MINOR_MODEL = "gpt-6-astra-minor";
72
76
  * Context pair every GPT-6 native ships in its upstream row: a 272,000-token default window
73
77
  * against an 872,000-token ceiling (and input limit) reached only through the long-window opt-in.
74
78
  * The built-in GPT-6 rows and every configured native (below) inherit this one value, except
75
- * GPT-6.1 Sol and Terra, whose default windows are 500,000.
79
+ * GPT-6.1 Sol and Terra and GPT-6.2 Sol, whose default windows are 500,000.
76
80
  */
77
81
  export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
78
82
  Object.freeze({ contextWindow: 272_000, maxContextWindow: 872_000, maxInputTokens: 872_000 });
@@ -80,8 +84,8 @@ export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWi
80
84
  /**
81
85
  * GPT-6.1 Sol through Codex & Work: OpenAI raised the default context from 272k to 500k
82
86
  * (Tibo Sottiaux, 2026-10-11, https://x.com/thsottiaux/status/2109430343346581527), while
83
- * overrides stay allowed and the model maximum is described as 1M. The bundled codex-rs row
84
- * still reads 272,000 / 872,000, and built-in natives never take roster values, so the default
87
+ * overrides stay allowed and the model maximum is described as 1M. The original pinned row
88
+ * reads 272,000 / 872,000, and built-in natives never take roster values, so the default
85
89
  * lives here. The 872,000 ceiling (and input limit) is kept on purpose: the announcement does
86
90
  * not say how "1M" maps onto the native window and input fields, and raising maxInputTokens
87
91
  * would assert an input allowance nobody has measured. Overrides therefore clamp to 872,000.
@@ -94,7 +98,7 @@ export const NATIVE_GPT61_TERRA_CONTEXT: Readonly<{ contextWindow: number; maxCo
94
98
  Object.freeze({ ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 });
95
99
 
96
100
  /** Pinned row a configured native borrows its capability metadata from: the current Sol. */
97
- export const CONFIGURED_NATIVE_OPENAI_TEMPLATE_MODEL = NATIVE_GPT61_SOL_MODEL;
101
+ export const CONFIGURED_NATIVE_OPENAI_TEMPLATE_MODEL = NATIVE_GPT62_SOL_MODEL;
98
102
 
99
103
  /**
100
104
  * Native ChatGPT/Codex ids whose availability is proven per authenticated account.
@@ -162,6 +166,8 @@ const selfDescribedNativeModels = new Set<string>([
162
166
  NATIVE_GPT6_LUNA_MODEL,
163
167
  NATIVE_GPT61_SOL_MODEL,
164
168
  NATIVE_GPT61_TERRA_MODEL,
169
+ NATIVE_GPT62_SOL_MODEL,
170
+ NATIVE_GPT62_ASTRA_MODEL,
165
171
  ]);
166
172
 
167
173
  export const SELF_DESCRIBED_NATIVE_OPENAI_MODELS: ReadonlySet<string> = selfDescribedNativeModels;
@@ -238,7 +244,7 @@ export function configuredNativeOpenAiDisplayName(slug: string): string {
238
244
  function configuredNativePresentation(slug: string): { displayName: string; description: string } {
239
245
  return {
240
246
  displayName: configuredNativeOpenAiDisplayName(slug),
241
- description: "OpenAI native model added through providers.openai.models; uses GPT-6-Sol capabilities.",
247
+ description: "OpenAI native model added through providers.openai.models; uses GPT-6.2-Sol capabilities.",
242
248
  };
243
249
  }
244
250
 
@@ -266,6 +272,8 @@ const BUILT_IN_NATIVE_OPENAI_MODELS: readonly string[] = Object.freeze([
266
272
  NATIVE_GPT6_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL,
267
273
  NATIVE_GPT61_SOL_MODEL,
268
274
  NATIVE_GPT61_TERRA_MODEL,
275
+ NATIVE_GPT62_SOL_MODEL,
276
+ NATIVE_GPT62_ASTRA_MODEL,
269
277
  NATIVE_GPT6_ASTRA_MINOR_MODEL,
270
278
  ]);
271
279
 
@@ -283,7 +291,7 @@ export const SUPPORTED_NATIVE_OPENAI_SLUGS = new Set(NATIVE_OPENAI_MODELS);
283
291
  * canonical Codex forward provider, so a new upstream GPT model needs a config entry rather than a
284
292
  * release — the way a Claude id listed under `providers.anthropic.models` already works.
285
293
  *
286
- * A configured native borrows `gpt-6.1-sol`'s pinned row (ladder, modalities, instructions, speed
294
+ * A configured native borrows `gpt-6.2-sol`'s pinned row (ladder, modalities, instructions, speed
287
295
  * tiers) under its own generated name, uses the GPT-6 272k/872k context pair, and is never
288
296
  * account-gated. Filtering the config lives in `src/config/derived-registries.ts`; this module stays
289
297
  * import-free because the GUI bundles it. Registration runs inside `loadConfig` and every config
@@ -412,4 +420,6 @@ export const NATIVE_MAIN_DRAIN_SENTINEL_MODELS: ReadonlySet<string> = new Set([
412
420
  NATIVE_GPT6_LUNA_MODEL,
413
421
  NATIVE_GPT61_SOL_MODEL,
414
422
  NATIVE_GPT61_TERRA_MODEL,
423
+ NATIVE_GPT62_SOL_MODEL,
424
+ NATIVE_GPT62_ASTRA_MODEL,
415
425
  ]);
@@ -14,6 +14,7 @@ import rosterPinnedModels from "../data/roster-pinned-models.json";
14
14
  * 2026-09-30 from openai/codex `codex-rs/models-manager/models.json` after #49318 (bundled
15
15
  * upstream, but newer than this build's `upstream-models.json` pin), and `gpt-6.1-terra`,
16
16
  * copied verbatim from the same upstream file on 2026-10-27 after its 2026-10-26 release.
17
+ * GPT-6.2 Sol and Astra come from the bundled rows in openai/codex #62106.
17
18
  *
18
19
  * The snapshot always wins: a roster row is appended only when its slug is absent from the
19
20
  * snapshot. Once a codex-rs refresh bundles Sol or Luna, that row takes over automatically and
@@ -762,20 +762,20 @@ export async function fetchProviderModelsWithAuth(
762
762
  // name matches any baseUrl by design. Retargeted or renamed custom rows
763
763
  // fetch a different URL and keep the rejection.
764
764
  if (!maySendAnthropicDiscovery()) return observed(withConfiguredRetention(failedDiscoveryConfigured), "degraded");
765
- const outboundDependencies = { isCanonicalUrl: isRegistryModelDiscoveryUrl,
765
+ const outboundDependencies = (requestUrl: string) => ({ isCanonicalUrl: isRegistryModelDiscoveryUrl,
766
766
  beforeSend: () => maySendAnthropicDiscovery()
767
- && (!vertexSendGuard || (vertexAuth !== undefined && vertexDiscoveryAuthIsCurrent(prov, vertexAuth, headers))) };
767
+ && (!vertexSendGuard || (vertexAuth !== undefined && vertexDiscoveryAuthIsCurrent(prov, vertexAuth, headers, requestUrl))) });
768
768
  const antigravityObservation = cloudCodeAssist ? captureAntigravityModelObservation() : undefined;
769
769
  const res = request.method === "POST"
770
770
  ? await providerOutboundPost(name, prov, url, {
771
771
  headers,
772
772
  body: JSON.stringify({ project }),
773
773
  signal: AbortSignal.timeout(8000),
774
- }, outboundDependencies)
774
+ }, outboundDependencies(url))
775
775
  : await providerOutboundGet(name, prov, url, {
776
776
  headers,
777
777
  signal: vertexDeadline ?? AbortSignal.timeout(8000),
778
- }, outboundDependencies);
778
+ }, outboundDependencies(url));
779
779
  const redirectError = await providerRedirectError(res, url);
780
780
  if (redirectError) {
781
781
  const { models, fallback, shouldLog } = failedDiscoveryFallback({ reason: "http", httpStatus: res.status });
@@ -876,7 +876,7 @@ export async function fetchProviderModelsWithAuth(
876
876
  const listing = effectiveGoogleMode(name, prov) === "vertex"
877
877
  ? await collectVertexPublisherModelPages(url, bounded.value,
878
878
  { ...discovery, firstPageBytes: vertexFirstPage?.bytes(), signal: vertexDeadline },
879
- (pageUrl, signal) => providerOutboundGet(name, prov, pageUrl, { headers, signal }, outboundDependencies))
879
+ (pageUrl, signal) => providerOutboundGet(name, prov, pageUrl, { headers, signal }, outboundDependencies(pageUrl)))
880
880
  : { ok: true as const, value: bounded.value };
881
881
  if (!listing.ok) {
882
882
  const { models, fallback, shouldLog } = failedDiscoveryFallback({ reason: "invalid_response" });