@bitkyc08/opencodex 2.100.4 → 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 (102) hide show
  1. package/gui/dist/assets/{App-DcpyI78f.js → App-BiOGtxDS.js} +21 -21
  2. package/gui/dist/assets/{Tray-CzjPJprT.js → Tray-BwsMejUO.js} +1 -1
  3. package/gui/dist/assets/{brand-mark-BTIi7e69.js → brand-mark-BY1dgACL.js} +1 -1
  4. package/gui/dist/assets/index-CwHSKMdG.js +138 -0
  5. package/gui/dist/assets/{segment-thumb-features-Bn6Y-g3R.js → segment-thumb-features-Bds9Hb_7.js} +1 -1
  6. package/gui/dist/classic/assets/{App-eYJAyNHM.js → App-CGLOiqQL.js} +20 -20
  7. package/gui/dist/classic/assets/{Tray-xHMYxLkV.js → Tray-Da4r2O70.js} +1 -1
  8. package/gui/dist/classic/assets/index-CvoKXKL9.js +138 -0
  9. package/gui/dist/classic/assets/{quota-summary-DyzHlkFl.js → quota-summary-DvqzfCmr.js} +1 -1
  10. package/gui/dist/classic/index.html +1 -1
  11. package/gui/dist/index.html +1 -1
  12. package/native/ocx-child/src/link_ws.rs +24 -19
  13. package/native/ocx-child/src/link_ws_frame.rs +136 -50
  14. package/package.json +3 -3
  15. package/src/adapters/anthropic-input-schema.ts +270 -0
  16. package/src/adapters/anthropic.ts +1 -63
  17. package/src/adapters/command-code-tool-text.ts +9 -1
  18. package/src/adapters/command-code.ts +18 -2
  19. package/src/adapters/devin/cloud-direct/chat.ts +24 -0
  20. package/src/adapters/devin/live-models.ts +11 -1
  21. package/src/adapters/kiro/reasoning.ts +3 -0
  22. package/src/adapters/kiro-tools.ts +14 -9
  23. package/src/adapters/openai-responses/passthrough.ts +3 -1
  24. package/src/adapters/openai-responses/request-strips.ts +1 -0
  25. package/src/adapters/tool-catalog-nudge.ts +1 -1
  26. package/src/claude/chat-tool-dispatch.ts +4 -1
  27. package/src/cli/logout-command.ts +23 -4
  28. package/src/cli/provider.ts +3 -2
  29. package/src/client/connect.ts +10 -2
  30. package/src/clients/config-export.ts +12 -7
  31. package/src/codex/account-lifecycle.ts +3 -1
  32. package/src/codex/catalog/metadata.ts +8 -0
  33. package/src/codex/catalog/native-models.ts +16 -6
  34. package/src/codex/catalog/pinned-models.ts +1 -0
  35. package/src/codex/catalog/provider-models.ts +5 -5
  36. package/src/codex/catalog-auto-refresh.ts +13 -2
  37. package/src/codex/config-drift-heal.ts +40 -12
  38. package/src/codex/config-write-lock.ts +39 -1
  39. package/src/codex/data/roster-pinned-models.json +346 -1
  40. package/src/codex/inject/config-write-section.ts +39 -1
  41. package/src/codex/inject/plan.ts +10 -8
  42. package/src/codex/inject/remove.ts +21 -19
  43. package/src/codex/inject/restore.ts +5 -1
  44. package/src/codex/inject-coordination.ts +58 -7
  45. package/src/codex/inject.ts +10 -12
  46. package/src/codex/journal-config-restore.ts +42 -0
  47. package/src/codex/journal.ts +62 -8
  48. package/src/codex/main-account.ts +7 -2
  49. package/src/codex/native-main-credentials.ts +11 -5
  50. package/src/combos/failover.ts +183 -0
  51. package/src/config/subagent-models.ts +20 -12
  52. package/src/generated/compatibility-version.json +99 -83
  53. package/src/generated/model-metadata.ts +3 -3
  54. package/src/lib/client-error-body.ts +6 -0
  55. package/src/lib/developer-role-rejection.ts +15 -0
  56. package/src/lib/upstream-retry.ts +1 -1
  57. package/src/messaging/remote-ports.ts +22 -10
  58. package/src/oauth/credential-siblings.ts +32 -0
  59. package/src/oauth/generic-account-failover.ts +25 -13
  60. package/src/oauth/index.ts +22 -14
  61. package/src/oauth/store.ts +38 -7
  62. package/src/providers/anthropic-reset-grants.ts +4 -0
  63. package/src/providers/claude-cli-usage.ts +2 -0
  64. package/src/providers/codebuddy-models.ts +11 -0
  65. package/src/providers/google-vertex-model-discovery.ts +43 -14
  66. package/src/providers/kiro-models.ts +5 -0
  67. package/src/providers/registry/entries-core.ts +9 -3
  68. package/src/providers/registry/entries-extended.ts +20 -9
  69. package/src/providers/registry/model-seeds.ts +4 -1
  70. package/src/providers/stale-context-window-migration.ts +2 -0
  71. package/src/responses/citation-markers.ts +26 -23
  72. package/src/server/management/link-enrollment.ts +3 -3
  73. package/src/server/management/link-route-request.ts +11 -5
  74. package/src/server/management/oauth-account-routes.ts +21 -8
  75. package/src/server/management/provider-credential-release.ts +44 -0
  76. package/src/server/management/provider-routes.ts +8 -8
  77. package/src/server/management/usage-aggregate-cache.ts +6 -3
  78. package/src/server/messages-native.ts +16 -2
  79. package/src/server/request-log-conversation.ts +6 -2
  80. package/src/server/request-log-failure-detail.ts +26 -9
  81. package/src/server/responses/adapter-continuation.ts +59 -25
  82. package/src/server/responses/adapter-dispatch.ts +8 -8
  83. package/src/server/responses/codex-tool-catalog.ts +47 -10
  84. package/src/server/responses/combo-session-recall.ts +26 -1
  85. package/src/server/responses/combo-stream-preflight.ts +35 -26
  86. package/src/server/responses/core-combo-failure.ts +6 -0
  87. package/src/server/responses/core-combo-native.ts +2 -1
  88. package/src/server/responses/core-combo.ts +43 -19
  89. package/src/server/responses/core-options.ts +2 -0
  90. package/src/server/responses/input-admission.ts +41 -3
  91. package/src/server/responses/request-send-budget.ts +1 -1
  92. package/src/server/responses/request-transport.ts +10 -2
  93. package/src/server/responses/sidecar-execution.ts +6 -4
  94. package/src/service/windows-checked-stop-live.ts +28 -5
  95. package/src/types/request.ts +4 -3
  96. package/src/usage/expected-prices.ts +35 -0
  97. package/src/usage/ledger-scanner.ts +44 -10
  98. package/src/web-search/loop.ts +20 -2
  99. package/src/web-search/parse.ts +2 -12
  100. package/src/web-search/sources.ts +13 -0
  101. package/gui/dist/assets/index-DVgU6S3y.js +0 -138
  102. package/gui/dist/classic/assets/index-DSaVRW4F.js +0 -138
@@ -1,6 +1,7 @@
1
1
  import { closeSync, constants as fsConstants, fstatSync, openSync } from "node:fs";
2
2
  import { readNativeMainAuthBytesWithIdentity } from "./native-main-auth-file";
3
3
  import { codexCredentialMutationEpoch } from "./credential-mutation-epoch";
4
+ import { captureMainAccountIdentityGeneration, isMainAccountIdentityGenerationLive } from "./main-account-cache";
4
5
  import { sameFileIdentity, type FileIdentity } from "../lib/file-identity";
5
6
 
6
7
  /**
@@ -62,9 +63,10 @@ export interface NativeMainLoginOwner {
62
63
  readonly path: string;
63
64
  }
64
65
 
65
- /** Captured before an observation starts; a completion under an older generation is stale. */
66
+ /** A retention/identity fence; refreshes capture it before the asynchronous exchange. */
66
67
  export interface NativeMainObservationTicket {
67
68
  readonly generation: number;
69
+ readonly identityGeneration: number;
68
70
  }
69
71
 
70
72
  export interface RetainNativeMainLoginOptions {
@@ -79,6 +81,7 @@ interface RetainedLogin {
79
81
  readonly identity: FileIdentity;
80
82
  readonly fingerprint: string;
81
83
  readonly configuredRefreshMode: string;
84
+ readonly identityGeneration: number;
82
85
  readonly fd: number | undefined;
83
86
  mutationEpoch: number;
84
87
  credential: unknown;
@@ -145,7 +148,7 @@ export function observeNativeMainAuthFile(path: string): NativeMainAuthObservati
145
148
  }
146
149
 
147
150
  export function beginNativeMainObservation(): NativeMainObservationTicket {
148
- return { generation };
151
+ return { generation, identityGeneration: captureMainAccountIdentityGeneration() };
149
152
  }
150
153
 
151
154
  /** End retention now. Pending observations captured before this call can no longer retain. */
@@ -170,7 +173,7 @@ function holdFile(path: string, identity: FileIdentity): number | undefined | nu
170
173
 
171
174
  /**
172
175
  * Record a complete login. Refused for a stale ticket (an invalidation happened while the
173
- * observation or refresh was in flight) or an unknown or moved file identity.
176
+ * observation or refresh was in flight), an account identity change, or an unknown or moved file identity.
174
177
  */
175
178
  export function retainNativeMainLogin(
176
179
  ticket: NativeMainObservationTicket,
@@ -179,13 +182,14 @@ export function retainNativeMainLogin(
179
182
  credential: unknown,
180
183
  options: RetainNativeMainLoginOptions,
181
184
  ): boolean {
182
- if (ticket.generation !== generation) return false;
185
+ if (ticket.generation !== generation || !isMainAccountIdentityGenerationLive(ticket.identityGeneration)) return false;
183
186
  if (!identity) {
184
187
  drop();
185
188
  return false;
186
189
  }
187
190
  const current = retained;
188
191
  if (current && current.owner.codexHome === owner.codexHome && current.owner.path === owner.path
192
+ && current.identityGeneration === ticket.identityGeneration
189
193
  && sameFileIdentity(current.identity, identity) && current.fingerprint === options.fingerprint) {
190
194
  current.mutationEpoch = codexCredentialMutationEpoch();
191
195
  current.credential = credential;
@@ -199,6 +203,7 @@ export function retainNativeMainLogin(
199
203
  identity,
200
204
  fingerprint: options.fingerprint,
201
205
  configuredRefreshMode: options.configuredRefreshMode(),
206
+ identityGeneration: ticket.identityGeneration,
202
207
  fd,
203
208
  mutationEpoch: codexCredentialMutationEpoch(),
204
209
  credential,
@@ -231,7 +236,8 @@ export function retainedNativeMainLogin<T>(
231
236
  invalidateRetainedNativeMainLogin("ownership-loss");
232
237
  return undefined;
233
238
  }
234
- if (entry.mutationEpoch !== codexCredentialMutationEpoch() || !identity
239
+ if (!isMainAccountIdentityGenerationLive(entry.identityGeneration)
240
+ || entry.mutationEpoch !== codexCredentialMutationEpoch() || !identity
235
241
  || !sameFileIdentity(identity, entry.identity) || !heldFileStillLinked(entry.fd)) {
236
242
  invalidateRetainedNativeMainLogin("account-replacement");
237
243
  return undefined;
@@ -998,6 +998,171 @@ function isResponseFormatCapabilityRefusal(
998
998
  return false;
999
999
  }
1000
1000
 
1001
+ /**
1002
+ * Codes, types and params an unoffered-tool-call refusal may carry. The reported carrier uses
1003
+ * `type: "upstream_error"` with `code: null` -- an aggregator re-wrapping the model backend's
1004
+ * 400 -- while request-validation spellings stay accepted because gateways disagree on which
1005
+ * they emit. Anything outside these closed sets fails closed.
1006
+ */
1007
+ const UNOFFERED_TOOL_CALL_CODES = new Set(["", "invalid_request_error", "invalid_argument", "upstream_error"]);
1008
+ const UNOFFERED_TOOL_CALL_TYPES = new Set(["", "invalid_request_error", "upstream_error", "ai_apicallerror"]);
1009
+ const UNOFFERED_TOOL_CALL_PARAMS = new Set(["tools", "tool_choice"]);
1010
+ /**
1011
+ * The provider's own verdict sentences for target-local model failures, each anchored so a
1012
+ * validation message that merely quotes or reflects one cannot impersonate the verdict -- the
1013
+ * same failure mode moderation-refusal matching guards against. Both observed carriers arrive
1014
+ * as `type: "upstream_error"` with `code: null` behind aggregator re-wraps.
1015
+ */
1016
+ const UNOFFERED_TOOL_CALL_MESSAGES = [
1017
+ /^the model called a function that was not offered in tools\.?$/i,
1018
+ /^the model returned an unexpected parser control marker; no output was published\.?$/i,
1019
+ ] as const;
1020
+ /** Sibling records that could smuggle a competing verdict this classifier does not inspect. */
1021
+ const UNOFFERED_TOOL_CALL_CARRIERS = ["response", "last_error", "details", "detail", "errors"] as const;
1022
+
1023
+ function isUnofferedToolCallVerdict(text: string): boolean {
1024
+ const value = text.trim().replace(/^Provider error \d{3}: /, "").trim();
1025
+ return UNOFFERED_TOOL_CALL_MESSAGES.some(pattern => pattern.test(value));
1026
+ }
1027
+
1028
+ /**
1029
+ * A root message that carries its own envelope prefix is peeled and its contents must still
1030
+ * support the verdict: `Provider error 400: Invalid value for tools` contradicts a nested
1031
+ * refusal even though the prefix itself is recognized.
1032
+ */
1033
+ function isUnofferedToolCallCarrierVerdict(text: string): boolean {
1034
+ let value = text.trim();
1035
+ for (let depth = 0; depth < 3; depth += 1) {
1036
+ const proxyPrefix = /^Provider error \d{3}: /.exec(value);
1037
+ if (proxyPrefix) {
1038
+ value = value.slice(proxyPrefix[0].length).trim();
1039
+ continue;
1040
+ }
1041
+ if (value.startsWith("data:") && !value.includes("\n")) {
1042
+ value = value.slice("data:".length).trim();
1043
+ continue;
1044
+ }
1045
+ break;
1046
+ }
1047
+ return isUnofferedToolCallVerdict(value);
1048
+ }
1049
+
1050
+ function hasUnofferedToolCallCarrierPrefix(text: string): boolean {
1051
+ return /^Provider error \d{3}: /.test(text) || (text.startsWith("data:") && !text.includes("\n"));
1052
+ }
1053
+
1054
+ function unofferedToolCallRecordShape(record: Record<string, unknown>): boolean {
1055
+ if (record.code !== undefined && record.code !== null && typeof record.code !== "string" && typeof record.code !== "number") return false;
1056
+ if (record.type !== undefined && record.type !== null && typeof record.type !== "string") return false;
1057
+ if (record.param !== undefined && record.param !== null) {
1058
+ if (typeof record.param === "string") {
1059
+ if (!UNOFFERED_TOOL_CALL_PARAMS.has(record.param.trim().toLowerCase())) return false;
1060
+ } else if (typeof record.param === "object" && !Array.isArray(record.param)) {
1061
+ // An AI-SDK gateway wraps the verdict in an error object under `param`; accept it only
1062
+ // when a nested string field independently carries the same anchored verdict, so the
1063
+ // object cannot smuggle a different claim.
1064
+ const nested = record.param as Record<string, unknown>;
1065
+ const diagnostics = [nested.error, nested.message].filter((v) => v !== undefined && v !== null);
1066
+ if (diagnostics.length === 0) return false;
1067
+ for (const diagnostic of diagnostics) {
1068
+ if (typeof diagnostic !== "string" || !isUnofferedToolCallVerdict(diagnostic)) return false;
1069
+ }
1070
+ // The nested record is held to the same closed code/type sets and carrier ban as the
1071
+ // envelope, so a policy code tucked inside `param` cannot ride the verdict into a hop.
1072
+ if (nested.param !== undefined && nested.param !== null) return false;
1073
+ if (nested.code !== undefined && nested.code !== null
1074
+ && (typeof nested.code !== "string" && typeof nested.code !== "number"
1075
+ || !UNOFFERED_TOOL_CALL_CODES.has(normalizedFailureCode(nested.code)))) return false;
1076
+ if (nested.type !== undefined && nested.type !== null
1077
+ && (typeof nested.type !== "string" || !UNOFFERED_TOOL_CALL_TYPES.has(normalizedFailureCode(nested.type)))) return false;
1078
+ if (UNOFFERED_TOOL_CALL_CARRIERS.some(carrier => nested[carrier] !== undefined && nested[carrier] !== null)) return false;
1079
+ } else {
1080
+ return false;
1081
+ }
1082
+ }
1083
+ if (!UNOFFERED_TOOL_CALL_CODES.has(normalizedFailureCode(record.code as string | number | undefined))) return false;
1084
+ if (!UNOFFERED_TOOL_CALL_TYPES.has(normalizedFailureCode(record.type as string | undefined))) return false;
1085
+ for (const carrier of UNOFFERED_TOOL_CALL_CARRIERS) {
1086
+ if (record[carrier] !== undefined && record[carrier] !== null) return false;
1087
+ }
1088
+ return true;
1089
+ }
1090
+
1091
+ /**
1092
+ * A target-local model verdict -- an unoffered tool call, or output the transport could not
1093
+ * publish -- is evidence a later combo target may not repeat: the provider answered, the
1094
+ * request fit, and the failure arrives before any output commits, so advancing is replay-safe.
1095
+ *
1096
+ * The envelope is bounded like its siblings: a depth budget, one `Provider error NNN:` or
1097
+ * single-line `data:` unwrap per level, closed code/type/param sets, and fail-closed treatment
1098
+ * of any record carrying a competing diagnostic carrier or a contradicting root message.
1099
+ * Bare verdict text is also a carrier: a chat gateway can surface the sentence with no JSON
1100
+ * envelope at all.
1101
+ */
1102
+ export function isUnofferedToolCallRefusal(
1103
+ status: number,
1104
+ message: string,
1105
+ code?: string | number | null,
1106
+ ): boolean {
1107
+ if (status !== 400 || message.length > 16_384) return false;
1108
+ if (code !== undefined && code !== null && typeof code !== "string" && typeof code !== "number") return false;
1109
+ if (!UNOFFERED_TOOL_CALL_CODES.has(normalizedFailureCode(code))) return false;
1110
+ let text = message.trim();
1111
+ for (let depth = 0; depth < 4; depth += 1) {
1112
+ const proxyPrefix = /^Provider error \d{3}: /.exec(text);
1113
+ if (proxyPrefix) text = text.slice(proxyPrefix[0].length).trim();
1114
+ if (text.startsWith("data:") && !text.includes("\n")) text = text.slice("data:".length).trim();
1115
+ let payload: unknown;
1116
+ try {
1117
+ payload = JSON.parse(text);
1118
+ } catch {
1119
+ return isUnofferedToolCallVerdict(text);
1120
+ }
1121
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return false;
1122
+ const root = payload as Record<string, unknown>;
1123
+ if (!unofferedToolCallRecordShape(root)) return false;
1124
+ const error = root.error;
1125
+ // A nested verdict must agree with the root's own message. When the root carries no error
1126
+ // record its message IS the payload carrier and is validated by the flat path below.
1127
+ if (error !== undefined && error !== null
1128
+ && typeof root.message === "string" && root.message.trim() !== ""
1129
+ && !isUnofferedToolCallCarrierVerdict(root.message)) return false;
1130
+ if (error === undefined || error === null) {
1131
+ if (typeof root.message !== "string") return false;
1132
+ if (hasUnofferedToolCallCarrierPrefix(root.message.trim())) {
1133
+ text = root.message.trim();
1134
+ continue;
1135
+ }
1136
+ return isUnofferedToolCallVerdict(root.message);
1137
+ }
1138
+ if (typeof error === "string") {
1139
+ if (hasUnofferedToolCallCarrierPrefix(error.trim())) {
1140
+ text = error.trim();
1141
+ continue;
1142
+ }
1143
+ return isUnofferedToolCallVerdict(error);
1144
+ }
1145
+ if (typeof error !== "object" || Array.isArray(error)) return false;
1146
+ const record = error as Record<string, unknown>;
1147
+ if (!unofferedToolCallRecordShape(record)) return false;
1148
+ if (record.error !== undefined && record.error !== null) {
1149
+ if (typeof record.error !== "string") return false;
1150
+ if (record.error.trim() !== "" && !isUnofferedToolCallVerdict(record.error)) return false;
1151
+ }
1152
+ if (root.param !== undefined && root.param !== null && record.param !== undefined && record.param !== null
1153
+ && String(root.param).trim().toLowerCase() !== String(record.param).trim().toLowerCase()) return false;
1154
+ if (typeof record.message !== "string") return false;
1155
+ const inner = record.message.trim();
1156
+ if (hasUnofferedToolCallCarrierPrefix(inner)) {
1157
+ // Our own wrapper, re-wrapped by a downstream hop. Peel it and look again, within budget.
1158
+ text = inner;
1159
+ continue;
1160
+ }
1161
+ return isUnofferedToolCallVerdict(record.message);
1162
+ }
1163
+ return false;
1164
+ }
1165
+
1001
1166
  /** The classification text the combo path bounds a body to (src/server/responses/core-errors.ts). */
1002
1167
  const MODERATION_EVIDENCE_LIMIT = 500;
1003
1168
 
@@ -1324,6 +1489,7 @@ export function comboFailureCooldownScope(
1324
1489
  code?: string | number | null;
1325
1490
  malformedResponseFormat?: boolean;
1326
1491
  openRouterOpaque400?: boolean;
1492
+ unofferedToolCallRefusal?: boolean;
1327
1493
  /** Whole-body moderation verdict from a reader that saw the complete bounded body. */
1328
1494
  providerModerationRefusal?: boolean;
1329
1495
  },
@@ -1345,6 +1511,13 @@ export function comboFailureCooldownScope(
1345
1511
  // A capability gap says the target is healthy and the request did not fit it, which is the
1346
1512
  // same reason every other entry here refuses to cool a target.
1347
1513
  || isResponseFormatCapabilityRefusal(status, message, rawCode)
1514
+ // The provider answered and its model simply called a function it was never offered: the
1515
+ // request fit and the target is healthy, so this must not cool it either. A caller that
1516
+ // classified the intact bounded body supplies the verdict directly; the display-truncated
1517
+ // text here would fail the envelope parse on a long body.
1518
+ || (options?.unofferedToolCallRefusal !== undefined
1519
+ ? options.unofferedToolCallRefusal
1520
+ : isUnofferedToolCallRefusal(status, message, rawCode))
1348
1521
  ) return "none";
1349
1522
  if (isProviderScopedQuotaCap(status, message, rawCode)) return "provider";
1350
1523
  // A rejected or unpaid credential is provider-wide evidence: every target that routes
@@ -1491,6 +1664,7 @@ export function comboFailureDecision(
1491
1664
  verifiedPlanRefusal?: boolean;
1492
1665
  malformedResponseFormat?: boolean;
1493
1666
  openRouterOpaque400?: boolean;
1667
+ unofferedToolCallRefusal?: boolean;
1494
1668
  /** Whole-body moderation verdict from a reader that saw the complete bounded body. */
1495
1669
  providerModerationRefusal?: boolean;
1496
1670
  },
@@ -1519,6 +1693,7 @@ function decideComboFailure(
1519
1693
  verifiedPlanRefusal?: boolean;
1520
1694
  malformedResponseFormat?: boolean;
1521
1695
  openRouterOpaque400?: boolean;
1696
+ unofferedToolCallRefusal?: boolean;
1522
1697
  /** Whole-body moderation verdict from a reader that saw the complete bounded body. */
1523
1698
  providerModerationRefusal?: boolean;
1524
1699
  },
@@ -1610,6 +1785,14 @@ function decideComboFailure(
1610
1785
  // could have served the request (#4903).
1611
1786
  if (isResponseFormatCapabilityRefusal(status, message, rawCode)) return "hop";
1612
1787
  if (providerModerationHop(status, message, rawCode, options?.providerModerationRefusal, options?.malformedResponseFormat)) return "hop";
1788
+ // A model that calls a function the request never offered hallucinated the call: target-local
1789
+ // behavior on a healthy target, arriving as a pre-output 400. Must precede the generic
1790
+ // invalid_request_error stop, which is where this envelope ended the chain. A caller that
1791
+ // classified the intact bounded body supplies the verdict directly; the display-truncated
1792
+ // text here would fail the envelope parse on a long body.
1793
+ if (options?.unofferedToolCallRefusal !== undefined
1794
+ ? options.unofferedToolCallRefusal
1795
+ : isUnofferedToolCallRefusal(status, message, rawCode)) return "hop";
1613
1796
  if (isAnthropicBillingFailure(status, message, rawCode)) return "hop";
1614
1797
  if (isAnthropicExtraUsageFailure(status, message, rawCode)) return "hop";
1615
1798
  // Kiro's body validator rejects the request for the identity it was routed under. The account
@@ -4,15 +4,17 @@ import {
4
4
  NATIVE_GPT6_LUNA_MODEL,
5
5
  NATIVE_GPT6_SOL_MODEL,
6
6
  NATIVE_GPT61_SOL_MODEL,
7
+ NATIVE_GPT62_ASTRA_MODEL,
8
+ NATIVE_GPT62_SOL_MODEL,
7
9
  } from "../codex/catalog/native-models";
8
10
 
9
- export const SUBAGENT_MODELS_VERSION = 3;
11
+ export const SUBAGENT_MODELS_VERSION = 4;
10
12
 
11
13
  /**
12
- * Native featured defaults: Astra, the current Sol (GPT-6.1) and Luna. Codex advertises at most
13
- * five picker-visible rows. Only Sol received a 6.1 release, so Astra and Luna stay on GPT-6.
14
+ * Native featured defaults: GPT-6.2 Astra, GPT-6.2 Sol and GPT-6 Luna. Codex advertises at most
15
+ * five picker-visible rows.
14
16
  */
15
- export const DEFAULT_SUBAGENT_MODELS = [NATIVE_GPT6_ASTRA_MODEL, NATIVE_GPT61_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL];
17
+ export const DEFAULT_SUBAGENT_MODELS = [NATIVE_GPT62_ASTRA_MODEL, NATIVE_GPT62_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL];
16
18
 
17
19
  /** Bare native families the version-2 upgrade removes from a roster. */
18
20
  const RETIRED_ROSTER_FAMILY = /^gpt-5\.[56](?:-|$)/;
@@ -45,13 +47,16 @@ function upgradeRetiredRosterRows(models: readonly string[]): string[] {
45
47
  * moves; a routed or account-qualified id keeps its exact spelling. GPT-6 Sol stays a supported
46
48
  * model, so a user who adds it back afterwards keeps it.
47
49
  */
48
- function upgradeSolTo61(models: readonly string[]): string[] {
49
- const upgraded: string[] = [];
50
- for (const model of models) {
51
- const next = model === NATIVE_GPT6_SOL_MODEL ? NATIVE_GPT61_SOL_MODEL : model;
52
- if (!upgraded.includes(next)) upgraded.push(next);
53
- }
54
- return upgraded;
50
+ const ROSTER_V3_SUCCESSORS = new Map([[NATIVE_GPT6_SOL_MODEL, NATIVE_GPT61_SOL_MODEL]]);
51
+
52
+ // V4 replaces the prior bare defaults. Qualified targets and earlier user re-selections keep their ids.
53
+ const ROSTER_V4_SUCCESSORS = new Map([
54
+ [NATIVE_GPT6_ASTRA_MODEL, NATIVE_GPT62_ASTRA_MODEL],
55
+ [NATIVE_GPT61_SOL_MODEL, NATIVE_GPT62_SOL_MODEL],
56
+ ]);
57
+
58
+ function upgradeRosterRows(models: readonly string[], successors: ReadonlyMap<string, string>): string[] {
59
+ return [...new Set(models.map(model => successors.get(model) ?? model))];
55
60
  }
56
61
 
57
62
  /** One-time upgrades; later user edits (including removing Astra) remain authoritative. */
@@ -71,7 +76,10 @@ export function migrateSubagentModels(config: OcxConfig): boolean {
71
76
  if (version < 2 && config.subagentModels !== undefined) {
72
77
  config.subagentModels = upgradeRetiredRosterRows(config.subagentModels);
73
78
  }
74
- if (config.subagentModels !== undefined) config.subagentModels = upgradeSolTo61(config.subagentModels);
79
+ if (config.subagentModels !== undefined) {
80
+ if (version < 3) config.subagentModels = upgradeRosterRows(config.subagentModels, ROSTER_V3_SUCCESSORS);
81
+ config.subagentModels = upgradeRosterRows(config.subagentModels, ROSTER_V4_SUCCESSORS);
82
+ }
75
83
  config.subagentModelsVersion = SUBAGENT_MODELS_VERSION;
76
84
  return true;
77
85
  }