@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,4 +1,5 @@
1
1
  import { isValidProviderName } from "../config/provider-name";
2
+ import { oauthCredentialSiblingsOf, oauthCredentialSlot } from "../oauth/credential-siblings";
2
3
  import { runCatalogAction } from "./catalog-command-result";
3
4
  import { CliUsageError, printData, runtimeBaseUrl, runtimeRequest, takeFlag, type RuntimeApiDeps } from "./runtime-api";
4
5
 
@@ -7,6 +8,20 @@ export interface LogoutCommandDeps extends RuntimeApiDeps {
7
8
  removeCredential?: (provider: string) => Promise<"removed" | "not-found">;
8
9
  }
9
10
 
11
+ /**
12
+ * A login shared by several provider rows (#8087: kimi and kimi-responses). Logging out of any of
13
+ * them removes the active account of the one shared slot, so the result names every row it reaches.
14
+ */
15
+ function sharedLogin(provider: string): { slot: string; rows: string[] } | null {
16
+ const slot = oauthCredentialSlot(provider);
17
+ const rows = [slot, ...oauthCredentialSiblingsOf(slot)];
18
+ return rows.length > 1 ? { slot, rows } : null;
19
+ }
20
+
21
+ function sharedLoginLine(shared: { slot: string; rows: string[] }): string {
22
+ return `This removed the active account of the shared ${shared.slot} login, so the ${shared.rows.join(" and ")} rows are both signed out of it. Another stored ${shared.slot} account, if any, is now active for both; neither row uses it while it is paused, and if it needs re-login, log in to it again.`;
23
+ }
24
+
10
25
  /** Explicit target selection precedes all credential access; never fall back between targets. */
11
26
  export async function handleLogoutCommand(argv: string[], deps: LogoutCommandDeps = {}): Promise<number> {
12
27
  return runCatalogAction(async () => {
@@ -17,9 +32,11 @@ export async function handleLogoutCommand(argv: string[], deps: LogoutCommandDep
17
32
  if (!provider || !isValidProviderName(provider) || args.length) {
18
33
  throw new CliUsageError("Expected one provider and no unknown or repeated options.", "Usage: ocx logout <provider> [--live] [--json]");
19
34
  }
35
+ const shared = sharedLogin(provider);
36
+ const sharedFields = shared ? { credentialSlot: shared.slot, affectedRows: shared.rows } : {};
20
37
  if (live) {
21
38
  const { isPublicOAuthProvider } = await import("../oauth");
22
- if (!isPublicOAuthProvider(provider)) throw new CliUsageError("Live logout requires a public OAuth provider; Codex and native-main logout are not supported.");
39
+ if (!isPublicOAuthProvider(oauthCredentialSlot(provider))) throw new CliUsageError("Live logout requires a public OAuth provider; Codex and native-main logout are not supported.");
23
40
  const pinned = { ...deps, baseUrl: await runtimeBaseUrl(deps) };
24
41
  const data = await runtimeRequest<unknown>(`/api/oauth/logout?provider=${encodeURIComponent(provider)}`, {
25
42
  method: "POST", redirect: "error",
@@ -27,18 +44,20 @@ export async function handleLogoutCommand(argv: string[], deps: LogoutCommandDep
27
44
  if (!data || typeof data !== "object" || Array.isArray(data) || (data as Record<string, unknown>).success !== true) {
28
45
  throw new Error("Unverified logout result");
29
46
  }
30
- printData({ schemaVersion: 1, success: true, provider, live: true }, json, [`Logged out of ${provider} on the selected proxy.`]);
47
+ printData({ schemaVersion: 1, success: true, provider, live: true, ...sharedFields }, json,
48
+ [`Logged out of ${provider} on the selected proxy.`, ...(shared ? [sharedLoginLine(shared)] : [])]);
31
49
  return 0;
32
50
  }
33
51
  const remove = deps.removeCredential ?? (await import("../oauth/store")).removeCredential;
34
- const outcome = await remove(provider);
52
+ const outcome = await remove(oauthCredentialSlot(provider));
35
53
  if (outcome === "not-found") {
36
54
  if (json) printData({ schemaVersion: 1, ok: false, provider, removed: false, reason: "not_found" }, true);
37
55
  else console.error(`No stored credential for '${provider}'.`);
38
56
  return 4;
39
57
  }
40
58
  if (outcome !== "removed") throw new Error("Unverified local logout result");
41
- printData({ schemaVersion: 1, ok: true, provider, removed: true }, json, [`Logged out of ${provider}.`]);
59
+ printData({ schemaVersion: 1, ok: true, provider, removed: true, ...sharedFields }, json,
60
+ [`Logged out of ${provider}.`, ...(shared ? [sharedLoginLine(shared)] : [])]);
42
61
  return 0;
43
62
  });
44
63
  }
@@ -16,6 +16,7 @@ import { hasHelpFlag, printSubcommandUsage } from "./help";
16
16
  import { getProviderRegistryEntry, PROVIDER_REGISTRY } from "../providers/registry";
17
17
  import { providerConfigSeed } from "../providers/derive";
18
18
  import { assertAnthropicInstanceLoginConfig } from "../oauth/store-anthropic-instance";
19
+ import { oauthCredentialSlot } from "../oauth/credential-siblings";
19
20
  import { dropProviderCustomModels } from "../providers/provider-id-rewrite";
20
21
  import { cleanupRemovedGcpCredentials, commitProviderGcpCredentialRemoval, providerGcpCredentialMarkers } from "../providers/gcp-credential-cleanup";
21
22
  import { providerCredentialInputError } from "../providers/api-keys";
@@ -281,7 +282,7 @@ async function handleAdd(args: string[], deps: ProviderCommandDeps): Promise<voi
281
282
  if ((authMode ?? registryEntry.authKind) === "forward") {
282
283
  console.warn(`Warning: provider "${name}" uses ChatGPT login (forward auth); --api-key is ignored.`);
283
284
  } else if ((authMode ?? registryEntry.authKind) === "oauth") {
284
- console.warn(`Warning: provider "${name}" uses OAuth auth; --api-key is ignored. Run: ocx login ${name}`);
285
+ console.warn(`Warning: provider "${name}" uses OAuth auth; --api-key is ignored. Run: ocx login ${oauthCredentialSlot(name)}`);
285
286
  } else {
286
287
  provConfig.apiKey = apiKey;
287
288
  }
@@ -452,7 +453,7 @@ async function handleAdd(args: string[], deps: ProviderCommandDeps): Promise<voi
452
453
  for (const line of modelSelectionGuidance(name)) console.log(line);
453
454
  if (setDefault) console.log(` Set as default provider.`);
454
455
  if (registryEntry?.authKind === "oauth") {
455
- console.log(` Authenticate with: ocx login ${name}`);
456
+ console.log(` Authenticate with: ocx login ${oauthCredentialSlot(name)}`);
456
457
  }
457
458
  if (registryEntry?.authKind === "key" && !apiKey) {
458
459
  const envKey = `${name.toUpperCase().replace(/[^A-Z0-9]+/g, "_")}_API_KEY`;
@@ -38,6 +38,7 @@ import {
38
38
  journalOwner,
39
39
  restoreJournalState,
40
40
  } from "../codex/journal";
41
+ import { ConfigWriteContentChanged } from "../codex/config-write-lock";
41
42
  import { readCodexHomeJournal } from "../codex/codex-home-owner";
42
43
  import { DEFAULT_CATALOG_PATH, getCodexHome } from "../codex/paths";
43
44
  import {
@@ -894,8 +895,15 @@ async function connectClientUnlocked(
894
895
  } catch (error) {
895
896
  const rollbackFailures: string[] = [];
896
897
  if (injectionCommitted) {
897
- const restored = restoreJournalState();
898
- if (!restored.complete) rollbackFailures.push("Codex journal restore was partial");
898
+ try {
899
+ const restored = restoreJournalState();
900
+ if (!restored.complete) rollbackFailures.push("Codex journal restore was partial");
901
+ } catch (restoreError) {
902
+ // A concurrent config.toml write refuses the restore and keeps the journal; report it as a
903
+ // partial rollback instead of abandoning the rest of the rollback.
904
+ if (!(restoreError instanceof ConfigWriteContentChanged)) throw restoreError;
905
+ rollbackFailures.push("Codex journal restore deferred: config.toml changed during rollback");
906
+ }
899
907
  }
900
908
  try {
901
909
  withClientLifecycleSync(() => withConfigMutationLockSync(() => {
@@ -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;
@@ -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" });
@@ -47,6 +47,9 @@ let liveIntervalMs: number | null = null;
47
47
  * so a converge still in flight when the timer stops cannot publish into the next generation.
48
48
  */
49
49
  let generation = 0;
50
+ /** Keys the last drift heal found missing, and whether this process already warned about one. */
51
+ let lastHealMissingKeys: readonly string[] = [];
52
+ let healReported = false;
50
53
  /** setInterval does not skip a firing while the previous callback is still awaiting. */
51
54
  let inFlight = false;
52
55
 
@@ -134,7 +137,7 @@ export function selectDriftHealCatalogPath(
134
137
 
135
138
  /** Repair only the missing config roots; catalog convergence remains the later tick step. */
136
139
  async function healCodexConfigDrift(config: OcxConfig, entryGeneration: number): Promise<"none" | "healed" | "not-healed"> {
137
- const [{ codexConfigDrift }, { JOURNAL_PATH, journaledInjectedOpenaiBaseUrl, journaledInjectedRealtimeWsBaseUrl }, { shouldSyncCodexOnStart }, { injectCodexConfig }, { DEFAULT_CATALOG_PATH, resolveCodexConfigPath }, { loadConfig }, { inspectNativeCodexOwnership }] =
140
+ const [{ codexConfigDrift }, { JOURNAL_PATH, journaledInjectedCatalogPath, journaledInjectedOpenaiBaseUrl, journaledInjectedRealtimeWsBaseUrl, journaledInjectedRootValues }, { shouldSyncCodexOnStart }, { injectCodexConfig }, { DEFAULT_CATALOG_PATH, resolveCodexConfigPath }, { loadConfig }, { inspectNativeCodexOwnership }] =
138
141
  await Promise.all([
139
142
  import("./config-drift-heal"),
140
143
  import("./journal"),
@@ -151,9 +154,15 @@ async function healCodexConfigDrift(config: OcxConfig, entryGeneration: number):
151
154
  const journaled = {
152
155
  injectedOpenaiBaseUrl: journaledInjectedOpenaiBaseUrl({ readOnly: true }),
153
156
  injectedRealtimeWsBaseUrl: journaledInjectedRealtimeWsBaseUrl({ readOnly: true }),
157
+ injectedCatalogPath: journaledInjectedCatalogPath(),
158
+ injectedRootValues: {
159
+ openai_base_url: journaledInjectedRootValues("openai_base_url", { readOnly: true }),
160
+ experimental_realtime_ws_base_url: journaledInjectedRootValues("experimental_realtime_ws_base_url", { readOnly: true }),
161
+ },
154
162
  };
155
163
  const drift = codexConfigDrift(() => journaled);
156
164
  if (!drift.drifted) return "none";
165
+ lastHealMissingKeys = drift.missingKeys;
157
166
  const { readRuntimePort } = await import("../config/process-state");
158
167
  if (!current()) return "none";
159
168
  const runtime = readRuntimePort(process.pid);
@@ -243,7 +252,9 @@ async function tick(): Promise<void> {
243
252
  const heal = await healCodexConfigDrift(config, entryGeneration);
244
253
  if (entryGeneration !== generation) return;
245
254
  if (heal === "healed") {
246
- console.info("[catalog-auto-refresh] injected Codex config keys were rewritten externally; re-injected");
255
+ const { codexConfigHealNotice } = await import("./config-drift-heal");
256
+ console.info(codexConfigHealNotice(lastHealMissingKeys, !healReported));
257
+ healReported = true;
247
258
  } else if (heal === "not-healed") {
248
259
  console.info("[catalog-auto-refresh] injected Codex config keys were rewritten externally; not re-injected this tick");
249
260
  }
@@ -23,10 +23,7 @@
23
23
 
24
24
  import { existsSync, readFileSync } from "node:fs";
25
25
  import { CODEX_CONFIG_PATH } from "./paths";
26
- import {
27
- REALTIME_WS_BASE_URL_KEY,
28
- rootTomlString,
29
- } from "./injected-marker";
26
+ import { REALTIME_WS_BASE_URL_KEY } from "./injected-marker";
30
27
 
31
28
  export interface CodexConfigDrift {
32
29
  /**
@@ -48,8 +45,17 @@ export interface CodexConfigDrift {
48
45
  * `keptUserBaseUrl`, and re-journaled as null) own that case, so a heal triggered on a
49
46
  * missing key runs into them and stops on its own rather than stomping a user's routing.
50
47
  */
48
+ export interface JournaledCodexConfigKeys {
49
+ injectedOpenaiBaseUrl?: string | null;
50
+ injectedRealtimeWsBaseUrl?: string | null;
51
+ /** The catalog path the last injection wrote; its root key going missing is drift too. */
52
+ injectedCatalogPath?: string | null;
53
+ /** Every URL injections under this journal wrote per root key, so a write-back of an older one is drift. */
54
+ injectedRootValues?: Partial<Record<"openai_base_url" | typeof REALTIME_WS_BASE_URL_KEY, readonly string[]>>;
55
+ }
56
+
51
57
  export function codexConfigDrift(
52
- readJournal: () => { injectedOpenaiBaseUrl?: string | null; injectedRealtimeWsBaseUrl?: string | null } | null,
58
+ readJournal: () => JournaledCodexConfigKeys | null,
53
59
  configPath: string = CODEX_CONFIG_PATH,
54
60
  readFile: (path: string) => string = path => readFileSync(path, "utf-8"),
55
61
  fileExists: (path: string) => boolean = existsSync,
@@ -57,7 +63,8 @@ export function codexConfigDrift(
57
63
  const journal = readJournal();
58
64
  const journaledBaseUrl = journal?.injectedOpenaiBaseUrl;
59
65
  const journaledRealtimeWsUrl = journal?.injectedRealtimeWsBaseUrl;
60
- if (!journaledBaseUrl && !journaledRealtimeWsUrl) {
66
+ const journaledCatalogPath = journal?.injectedCatalogPath;
67
+ if (!journaledBaseUrl && !journaledRealtimeWsUrl && !journaledCatalogPath) {
61
68
  return { drifted: false, missingKeys: [] };
62
69
  }
63
70
  if (!fileExists(configPath)) {
@@ -69,12 +76,33 @@ export function codexConfigDrift(
69
76
  } catch {
70
77
  return { drifted: false, missingKeys: [] };
71
78
  }
79
+ // Presence comes from the parsed document, so a multiline assignment counts as present. A file
80
+ // that does not parse is present-unknown: nothing is reported missing and no heal is started.
81
+ let root: Record<string, unknown>;
82
+ try { root = Bun.TOML.parse(content.replace(/^\uFEFF/, "")) as Record<string, unknown>; }
83
+ catch { return { drifted: false, missingKeys: [] }; }
72
84
  const missingKeys: string[] = [];
73
- if (journaledBaseUrl && rootTomlString(content, "openai_base_url") === null) {
74
- missingKeys.push("openai_base_url");
75
- }
76
- if (journaledRealtimeWsUrl && rootTomlString(content, REALTIME_WS_BASE_URL_KEY) === null) {
77
- missingKeys.push(REALTIME_WS_BASE_URL_KEY);
78
- }
85
+ // Missing, or rewritten back to a value an EARLIER injection wrote (the Codex app restoring its
86
+ // own older copy). Another value is the user's and stays out of this check.
87
+ const drifted = (key: "openai_base_url" | typeof REALTIME_WS_BASE_URL_KEY, latest: string) => {
88
+ if (!Object.hasOwn(root, key)) return true;
89
+ const value = root[key];
90
+ return typeof value === "string" && value !== latest && (journal?.injectedRootValues?.[key] ?? []).includes(value);
91
+ };
92
+ if (journaledBaseUrl && drifted("openai_base_url", journaledBaseUrl)) missingKeys.push("openai_base_url");
93
+ if (journaledRealtimeWsUrl && drifted(REALTIME_WS_BASE_URL_KEY, journaledRealtimeWsUrl)) missingKeys.push(REALTIME_WS_BASE_URL_KEY);
94
+ if (journaledCatalogPath && !Object.hasOwn(root, "model_catalog_json")) missingKeys.push("model_catalog_json");
79
95
  return { drifted: missingKeys.length > 0, missingKeys };
80
96
  }
97
+
98
+ /**
99
+ * What to print after a heal. The first heal in a process says what happened and what was kept;
100
+ * later ones are one quiet line, so an app that keeps rewriting the file is explained once instead
101
+ * of on every tick.
102
+ */
103
+ export function codexConfigHealNotice(missingKeys: readonly string[], firstReport: boolean): string {
104
+ if (!firstReport) return "[catalog-auto-refresh] injected Codex config keys were rewritten externally; re-injected";
105
+ return "[catalog-auto-refresh] Codex rewrote config.toml without OpenCodex's " + missingKeys.join(", ")
106
+ + "; re-injected only those keys and other settings were kept. If this repeats, the Codex app is"
107
+ + " rewriting config.toml from its own copy; run 'ocx sync' once it settles.";
108
+ }
@@ -41,7 +41,7 @@
41
41
  */
42
42
  import { atomicWriteFileStreamed, type AtomicWriteHooks } from "../config/atomic-write";
43
43
  import { lstatSync, readFileSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
44
- import { randomUUID } from "node:crypto";
44
+ import { createHash, randomUUID } from "node:crypto";
45
45
  import { basename, dirname, join, resolve } from "node:path";
46
46
  import { release, stillHeld, tryAcquire, type AcquireResult, type LockHandle } from "./prompt-lock";
47
47
 
@@ -146,16 +146,52 @@ export function publishConfigWrite<T>(configPath: string, held: LockHandle, run:
146
146
  return run(canonical, {
147
147
  validateBeforeRename: () => { assertConfigWriteDestination(configPath, held); },
148
148
  afterRename: () => {
149
+ const payloadKnown = payloadDigestPending.delete(held);
149
150
  const recovery = recoveries.get(held);
150
151
  if (recovery?.canonical === canonical) recovery.identity = canonicalFileIdentity(canonical);
151
152
  const after = destination(configPath);
152
153
  if (!stillHeld(held) || after.canonical !== canonical) throw new Error("Codex configuration destination changed; recovery evidence was preserved.");
153
154
  destinations.set(held, after);
155
+ // A payload-aware publisher records the digest of what it wrote; this re-read only
156
+ // covers writers whose bytes this process never sees (a native child, the empty file).
157
+ // Known limit for a native child: the `codex` CLI renames its own file and exits, and this
158
+ // re-read runs after it exits, so a write by a non-OpenCodex process (the Codex app, an
159
+ // editor) landing between the child's rename and this line is recorded as OpenCodex's and a
160
+ // later compensation in the same section could revert it. The child cannot report its bytes.
161
+ if (!payloadKnown) publishedConfigDigests.set(held, fileDigest(canonical));
154
162
  const watched = targets.get(held);
155
163
  if (watched) for (const [path, expected] of watched) if (expected.canonical === canonical) watched.set(path, after);
156
164
  },
157
165
  });
158
166
  }
167
+ /** config.toml no longer holds the bytes a writer decided from; nothing was written. */
168
+ export class ConfigWriteContentChanged extends Error {
169
+ readonly retryable = true;
170
+ constructor() {
171
+ super("Codex config.toml changed while OpenCodex was writing it; nothing was overwritten. Retry the command.");
172
+ }
173
+ }
174
+ /**
175
+ * The digest of the config.toml bytes this lock section last published, `null` for a removal,
176
+ * `undefined` when it published none. Compensation reverts only a file still holding them.
177
+ */
178
+ const publishedConfigDigests = new WeakMap<LockHandle, string | null>();
179
+ const payloadDigestPending = new WeakSet<LockHandle>();
180
+ export function publishedConfigDigest(held: LockHandle): string | null | undefined {
181
+ return publishedConfigDigests.get(held);
182
+ }
183
+ /** Called by a publisher that knows its payload, before the rename's afterRename hook runs. */
184
+ export function recordPublishedConfigDigest(held: LockHandle, digest: string | null): void {
185
+ publishedConfigDigests.set(held, digest);
186
+ payloadDigestPending.add(held);
187
+ }
188
+ export function configDigest(bytes: string | null): string | null {
189
+ return bytes === null ? null : createHash("sha256").update(bytes).digest("hex");
190
+ }
191
+ function fileDigest(path: string): string | null {
192
+ try { return createHash("sha256").update(readFileSync(path)).digest("hex"); }
193
+ catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") return null; throw error; }
194
+ }
159
195
  /** Native children use the acquisition witness, never a fresh home resolution. */
160
196
  export class ConfigWriteDestinationChanged extends Error {
161
197
  readonly retryable = false;
@@ -212,6 +248,8 @@ export function withConfigWriteRecovery<T>(
212
248
  assertConfigWriteDestination(configPath, held);
213
249
  return value;
214
250
  } catch (error) {
251
+ // Refused before this scope published anything: there is nothing to recover.
252
+ if (error instanceof ConfigWriteContentChanged && recovery.identity === identity) throw error;
215
253
  let changed = error instanceof ConfigWriteDestinationChanged;
216
254
  try { assertConfigWriteDestination(configPath, held); } catch { changed = true; }
217
255
  try {