@bitkyc08/opencodex 2.100.3 → 2.100.4
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.
- package/AGENTS_INSTALL.md +23 -1
- package/bin/ocx.mjs +8 -1
- package/gui/dist/assets/{App-Dnb6VMsP.js → App-DcpyI78f.js} +20 -19
- package/gui/dist/assets/{Tray-BV4ms9U9.js → Tray-CzjPJprT.js} +1 -1
- package/gui/dist/assets/brand-mark-BTIi7e69.js +1 -0
- package/gui/dist/assets/index-DJxM-imn.css +2 -0
- package/gui/dist/assets/index-DVgU6S3y.js +138 -0
- package/gui/dist/assets/{segment-thumb-features-DXSidY6D.js → segment-thumb-features-Bn6Y-g3R.js} +1 -1
- package/gui/dist/classic/assets/{App-DA-scMPq.js → App-eYJAyNHM.js} +19 -18
- package/gui/dist/classic/assets/{Tray-BrHaVRAq.js → Tray-xHMYxLkV.js} +1 -1
- package/gui/dist/classic/assets/index-DSaVRW4F.js +138 -0
- package/gui/dist/classic/assets/quota-summary-DyzHlkFl.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/native/ocx-child/src/cli.rs +5 -3
- package/native/ocx-child/src/codex_home.rs +1 -0
- package/package.json +2 -2
- package/src/adapters/anthropic/per-message-effort.ts +296 -0
- package/src/adapters/anthropic.ts +3 -0
- package/src/adapters/claude-cli/adapter.ts +1 -0
- package/src/adapters/devin/cloud-direct/chat.ts +71 -14
- package/src/adapters/google-errors.ts +14 -2
- package/src/adapters/qoder/adapter.ts +9 -1
- package/src/adapters/zed.ts +4 -2
- package/src/claude/desktop-remote-store.ts +60 -10
- package/src/cli/account-api.ts +4 -0
- package/src/cli/account-auth.ts +30 -2
- package/src/cli/account-extended.ts +33 -2
- package/src/cli/capabilities-access-remote.ts +3 -3
- package/src/cli/capabilities-accounts.ts +3 -3
- package/src/cli/capabilities-base.ts +11 -6
- package/src/cli/capabilities-observe-system.ts +2 -2
- package/src/cli/claude.ts +3 -3
- package/src/cli/disconnect-runtime.ts +16 -6
- package/src/cli/dispatch.ts +7 -1
- package/src/cli/index.ts +2 -2
- package/src/cli/link-apply-restart.ts +4 -2
- package/src/cli/link-routes.ts +4 -1
- package/src/cli/link.ts +5 -4
- package/src/cli/preflight-exemptions.ts +3 -0
- package/src/cli/registry.ts +5 -2
- package/src/cli/resolve.ts +23 -8
- package/src/cli/restart-failure.ts +11 -1
- package/src/cli/runtime-api.ts +4 -0
- package/src/cli/status.ts +4 -1
- package/src/cli/system-command.ts +1 -1
- package/src/cli/system-restart-client.ts +9 -3
- package/src/cli/system-settings-parity.ts +2 -1
- package/src/client/connect.ts +63 -9
- package/src/client/desktop-refusal.ts +38 -0
- package/src/client/lifecycle-lock.ts +29 -4
- package/src/client/runtime-restart.ts +27 -15
- package/src/client/runtime.ts +4 -2
- package/src/client/state.ts +14 -0
- package/src/codex/account-pause.ts +4 -0
- package/src/codex/account-runtime-state.ts +4 -0
- package/src/codex/auth-api/main-account-probe.ts +3 -1
- package/src/codex/auth-api/main-hard-lock-refusal-read.ts +172 -0
- package/src/codex/auth-context.ts +40 -2
- package/src/codex/catalog/build-entries.ts +10 -0
- package/src/codex/catalog/derive-entry.ts +7 -0
- package/src/codex/catalog/reserve-warn.ts +7 -5
- package/src/codex/catalog/reserve.ts +4 -3
- package/src/codex/catalog/retained-sync.ts +2 -0
- package/src/codex/catalog/routed-defaults.ts +35 -0
- package/src/codex/convergence.ts +2 -0
- package/src/codex/loopback-target.ts +22 -8
- package/src/codex/main-account.ts +88 -29
- package/src/codex/native-main-auth-file.ts +14 -0
- package/src/codex/native-main-credentials.ts +270 -0
- package/src/codex/native-main-owner.ts +3 -0
- package/src/codex/native-main-refresh-mode.ts +14 -1
- package/src/codex/quota.ts +63 -14
- package/src/combos/failover.ts +12 -1
- package/src/combos/index.ts +5 -0
- package/src/combos/resolve.ts +115 -19
- package/src/config/diagnostics.ts +3 -0
- package/src/config/live-reconcile.ts +6 -3
- package/src/config/load-degrade.ts +2 -0
- package/src/config/persisted-mutation.ts +2 -2
- package/src/config/persisted-projections.ts +18 -0
- package/src/config/process-state.ts +4 -3
- package/src/config/reserve-capability.ts +96 -0
- package/src/config/schema/config-schema.ts +6 -0
- package/src/config/schema/leaf-validators.ts +2 -0
- package/src/config/schema/routed-catalog-defaults.ts +49 -0
- package/src/config.ts +7 -7
- package/src/desktop-update/acquire.ts +202 -0
- package/src/desktop-update/cli.ts +168 -0
- package/src/desktop-update/drain.ts +40 -0
- package/src/desktop-update/headless.ts +285 -0
- package/src/desktop-update/image.ts +85 -0
- package/src/desktop-update/install.ts +53 -0
- package/src/desktop-update/msi.ts +72 -0
- package/src/desktop-update/release.ts +128 -0
- package/src/desktop-update/runtime.ts +155 -0
- package/src/desktop-update/staging.ts +118 -0
- package/src/desktop-update/trust.ts +45 -0
- package/src/generated/compatibility-version.json +246 -130
- package/src/images/fulfill-video.ts +3 -3
- package/src/images/loop.ts +6 -2
- package/src/images/plan.ts +147 -11
- package/src/images/types.ts +13 -4
- package/src/images/xai-video-client.ts +72 -10
- package/src/lib/gcp-adc.ts +48 -4
- package/src/lib/offline-resend.ts +150 -0
- package/src/lib/paced-stream.ts +3 -3
- package/src/lib/provider-outbound.ts +17 -6
- package/src/lib/request-failure-model.ts +2 -0
- package/src/lib/response-body-inactivity.ts +23 -1
- package/src/lib/upstream-retry.ts +38 -5
- package/src/link/explicit-route.ts +4 -4
- package/src/link/remote-windows.ts +79 -31
- package/src/link/residual-recovery.ts +20 -8
- package/src/messaging/budget.ts +23 -5
- package/src/messaging/rpc.ts +4 -4
- package/src/oauth/antigravity-risk.ts +126 -0
- package/src/oauth/generic-account-failover.ts +89 -18
- package/src/oauth/generic-session-affinity.ts +10 -3
- package/src/oauth/login-cli.ts +35 -1
- package/src/oauth/pool-kernel.ts +3 -3
- package/src/providers/anthropic-billing-refusal.ts +27 -3
- package/src/providers/google-vertex-model-discovery.ts +6 -1
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/quota/workbuddy.ts +6 -2
- package/src/providers/workbuddy-credit-balance.ts +125 -16
- package/src/responses/effort-history.ts +732 -0
- package/src/routing/history/integrity.ts +41 -4
- package/src/server/auth-cors.ts +13 -3
- package/src/server/codex-model-list.ts +2 -1
- package/src/server/direct-local-http.ts +26 -3
- package/src/server/index/link-listener.ts +20 -14
- package/src/server/index/serve-options.ts +1 -0
- package/src/server/index.ts +3 -2
- package/src/server/link-turn.ts +17 -5
- package/src/server/management/config-routes.ts +39 -3
- package/src/server/management/link-child-preflight.ts +1 -1
- package/src/server/management/link-route-edit.ts +20 -1
- package/src/server/management/oauth-account-routes.ts +22 -5
- package/src/server/management/provider-overwrite-carry.ts +3 -0
- package/src/server/management/provider-routes.ts +4 -4
- package/src/server/management/static-catalog-probe.ts +33 -0
- package/src/server/proxy-liveness.ts +54 -9
- package/src/server/relay.ts +6 -1
- package/src/server/request-log-conversation.ts +2 -2
- package/src/server/request-log.ts +5 -1
- package/src/server/reserve-capability-startup.ts +32 -0
- package/src/server/responses/adapter-delivery.ts +2 -0
- package/src/server/responses/adapter-dispatch.ts +31 -10
- package/src/server/responses/antigravity-fault-rotation.ts +24 -0
- package/src/server/responses/antigravity-validation-refusal.ts +43 -6
- package/src/server/responses/combo-selection-keepalive.ts +254 -0
- package/src/server/responses/core-combo.ts +24 -9
- package/src/server/responses/core-errors.ts +9 -6
- package/src/server/responses/core-options.ts +8 -0
- package/src/server/responses/core.ts +21 -0
- package/src/server/responses/estimated-usage.ts +115 -0
- package/src/server/responses/jev-model-invoke.ts +7 -2
- package/src/server/responses/passthrough-completion.ts +6 -3
- package/src/server/responses/passthrough-delivery.ts +47 -8
- package/src/server/responses/passthrough-dispatch.ts +3 -0
- package/src/server/responses/request-prepare.ts +9 -5
- package/src/server/responses/sidecar-execution.ts +5 -0
- package/src/service/desktop-supervision.d.mts +2 -0
- package/src/service/desktop-supervision.mjs +5 -0
- package/src/stall-timeout.ts +11 -0
- package/src/types/config.ts +15 -92
- package/src/types/provider.ts +13 -0
- package/src/types/request.ts +19 -0
- package/src/types/routed-catalog-defaults.ts +17 -0
- package/src/types/routing-profile.ts +90 -0
- package/src/types.ts +1 -0
- package/src/update/index.ts +1 -1
- package/src/usage/log.ts +14 -4
- package/src/usage/telemetry-contract.ts +1 -0
- package/src/web-search/passthrough-bridge.ts +7 -0
- package/gui/dist/assets/brand-mark-XOLJbomA.js +0 -1
- package/gui/dist/assets/index-DCdXsMyZ.js +0 -105
- package/gui/dist/assets/index-DQtCRNAw.css +0 -2
- package/gui/dist/classic/assets/index-BqOaGLf5.js +0 -105
- package/gui/dist/classic/assets/quota-summary-Dy5_wfTT.js +0 -1
package/src/combos/resolve.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { sleepWithAbort } from "../lib/upstream-retry";
|
|
|
6
6
|
import {
|
|
7
7
|
clearComboTargetCooldownIfUnchanged,
|
|
8
8
|
comboTargetCooldownRevision,
|
|
9
|
+
comboTargetCooldownStatus,
|
|
9
10
|
coolComboTarget,
|
|
10
11
|
earliestComboCooldown,
|
|
11
12
|
isComboTargetInCooldown,
|
|
@@ -71,11 +72,49 @@ export function comboTargetLogLabel(config: OcxConfig, comboId: string, target:
|
|
|
71
72
|
|
|
72
73
|
export type ComboExclusionReasons = string & { readonly [exclusionBrand]: true };
|
|
73
74
|
|
|
75
|
+
/** One target's coarse failure class in a `combo_unavailable` answer (#7965). */
|
|
76
|
+
export type ComboTargetUnavailableCause = "quota" | "permission" | "transient" | "unsupported" | "unavailable";
|
|
77
|
+
/** The combo-level class: the one class every classified target shares, `mixed` when they differ, `unknown` when none was classified. */
|
|
78
|
+
export type ComboUnavailableCause = ComboTargetUnavailableCause | "mixed" | "unknown";
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Machine-readable fields on the public `combo_unavailable` error (#7965). Counts and closed classes
|
|
82
|
+
* only: no combo id, provider name, model, account or upstream text.
|
|
83
|
+
*/
|
|
84
|
+
export interface ComboUnavailableDiagnostics {
|
|
85
|
+
readonly cause: ComboUnavailableCause;
|
|
86
|
+
/** Targets configured on the combo. */
|
|
87
|
+
readonly targets: number;
|
|
88
|
+
/** Targets this request dispatched before the answer. */
|
|
89
|
+
readonly attempted: number;
|
|
90
|
+
/** How many targets fell in each class; classes no target fell in are omitted. */
|
|
91
|
+
readonly causes: Readonly<Partial<Record<ComboTargetUnavailableCause, number>>>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Fold per-target classes into the combo-level diagnostics. */
|
|
95
|
+
export function comboUnavailableDiagnostics(
|
|
96
|
+
targets: number,
|
|
97
|
+
attempted: number,
|
|
98
|
+
classes: readonly ComboTargetUnavailableCause[],
|
|
99
|
+
): ComboUnavailableDiagnostics {
|
|
100
|
+
const causes: Partial<Record<ComboTargetUnavailableCause, number>> = {};
|
|
101
|
+
for (const value of classes) causes[value] = (causes[value] ?? 0) + 1;
|
|
102
|
+
const distinct = Object.keys(causes) as ComboTargetUnavailableCause[];
|
|
103
|
+
const cause: ComboUnavailableCause = distinct.length === 0 ? "unknown" : distinct.length === 1 ? distinct[0]! : "mixed";
|
|
104
|
+
return { cause, targets, attempted, causes };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Why a combo had no target to pick: the readable message suffix and its machine-readable form. */
|
|
108
|
+
export interface ComboExclusion {
|
|
109
|
+
readonly reasons: ComboExclusionReasons;
|
|
110
|
+
readonly diagnostics: ComboUnavailableDiagnostics;
|
|
111
|
+
}
|
|
112
|
+
|
|
74
113
|
export class NoAvailableComboTargetsError extends Error {
|
|
75
114
|
readonly code = "combo_unavailable";
|
|
76
115
|
|
|
77
|
-
constructor(readonly comboId: string, readonly
|
|
78
|
-
super(`No available targets for combo${
|
|
116
|
+
constructor(readonly comboId: string, readonly exclusion?: ComboExclusion) {
|
|
117
|
+
super(`No available targets for combo${exclusion ? ` (${exclusion.reasons})` : ""}`);
|
|
79
118
|
this.name = "NoAvailableComboTargetsError";
|
|
80
119
|
}
|
|
81
120
|
}
|
|
@@ -107,32 +146,89 @@ export function comboTargetSkipTrigger(
|
|
|
107
146
|
return providerExclusionReason(config, target, now) === "quota exhausted" ? "quota_exhausted" : "unavailable";
|
|
108
147
|
}
|
|
109
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The class a skipped target contributes to `combo_unavailable` diagnostics. A cooldown is
|
|
151
|
+
* classified by the HTTP status its entry kept: 429/402 is quota, 401/403 is permission, and any
|
|
152
|
+
* other or missing status is transient.
|
|
153
|
+
*/
|
|
154
|
+
function exclusionCause(reason: ComboExclusionReason, comboId: string, target: OcxComboTarget, now: number): ComboTargetUnavailableCause {
|
|
155
|
+
if (reason === "quota exhausted") return "quota";
|
|
156
|
+
if (reason === "ineligible for this request") return "unsupported";
|
|
157
|
+
if (reason !== "cooldown") return "unavailable";
|
|
158
|
+
const status = comboTargetCooldownStatus(comboId, target, now);
|
|
159
|
+
return status === 429 || status === 402 ? "quota" : status === 401 || status === 403 ? "permission" : "transient";
|
|
160
|
+
}
|
|
161
|
+
|
|
110
162
|
/**
|
|
111
163
|
* Why each target of a combo cannot be picked right now, for a zero-attempt refusal. Only the
|
|
112
|
-
* target index, validated provider label and a closed exclusion reason are named
|
|
164
|
+
* target index, validated provider label and a closed exclusion reason are named; the same pass
|
|
165
|
+
* yields the machine-readable diagnostics.
|
|
113
166
|
*/
|
|
114
|
-
|
|
167
|
+
/** Why the picker would pass over one target, in picker order: provider, cooldown, then request eligibility. */
|
|
168
|
+
function targetExclusionReason(
|
|
169
|
+
config: OcxConfig,
|
|
170
|
+
comboId: string,
|
|
171
|
+
target: NormalizedComboTarget,
|
|
172
|
+
eligible: ((target: NormalizedComboTarget) => boolean) | undefined,
|
|
173
|
+
now: number,
|
|
174
|
+
): ComboExclusionReason | undefined {
|
|
175
|
+
let reason = providerExclusionReason(config, target, now);
|
|
176
|
+
const cooldown = reason ? undefined : earliestComboCooldown(comboId, [target], now);
|
|
177
|
+
if (cooldown) reason = "cooldown";
|
|
178
|
+
if (!reason && eligible) {
|
|
179
|
+
try {
|
|
180
|
+
if (!eligible(target)) reason = "ineligible for this request";
|
|
181
|
+
} catch {
|
|
182
|
+
// An eligibility check can exhaust the translator budget; the target still was not picked.
|
|
183
|
+
reason = "ineligible for this request";
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return reason;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* One target's `combo_unavailable` class, from the same checks and precedence as
|
|
191
|
+
* {@link comboExclusion}, or `undefined` when nothing excludes it.
|
|
192
|
+
*/
|
|
193
|
+
export function comboTargetUnavailableCause(
|
|
115
194
|
config: OcxConfig,
|
|
116
195
|
comboId: string,
|
|
196
|
+
target: NormalizedComboTarget,
|
|
117
197
|
eligible?: (target: NormalizedComboTarget) => boolean,
|
|
118
198
|
now = Date.now(),
|
|
119
|
-
):
|
|
199
|
+
): ComboTargetUnavailableCause | undefined {
|
|
200
|
+
const reason = targetExclusionReason(config, comboId, target, eligible, now);
|
|
201
|
+
return reason ? exclusionCause(reason, comboId, target, now) : undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function comboExclusion(
|
|
205
|
+
config: OcxConfig,
|
|
206
|
+
comboId: string,
|
|
207
|
+
eligible?: (target: NormalizedComboTarget) => boolean,
|
|
208
|
+
now = Date.now(),
|
|
209
|
+
): ComboExclusion {
|
|
120
210
|
const targets = getCombo(config, comboId)?.targets ?? [];
|
|
211
|
+
const classes: ComboTargetUnavailableCause[] = [];
|
|
121
212
|
const reasons = targets.flatMap((target, index) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
if (!eligible(target)) reason = "ineligible for this request";
|
|
128
|
-
} catch {
|
|
129
|
-
// An eligibility check can exhaust the translator budget; the target still was not picked.
|
|
130
|
-
reason = "ineligible for this request";
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return reason ? [`target ${index + 1} (${errorDestinationText(providerErrorDestinationLabel(target.provider))}): ${reason}`] : [];
|
|
213
|
+
const reason = targetExclusionReason(config, comboId, target, eligible, now);
|
|
214
|
+
if (!reason) return [];
|
|
215
|
+
classes.push(exclusionCause(reason, comboId, target, now));
|
|
216
|
+
return [`target ${index + 1} (${errorDestinationText(providerErrorDestinationLabel(target.provider))}): ${reason}`];
|
|
134
217
|
}).join("; ");
|
|
135
|
-
return
|
|
218
|
+
return {
|
|
219
|
+
reasons: `${targets.length} target${targets.length === 1 ? "" : "s"}${reasons ? `; ${reasons}` : ""}` as ComboExclusionReasons,
|
|
220
|
+
diagnostics: comboUnavailableDiagnostics(targets.length, 0, classes),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** The readable half of {@link comboExclusion}. */
|
|
225
|
+
export function comboExclusionReasons(
|
|
226
|
+
config: OcxConfig,
|
|
227
|
+
comboId: string,
|
|
228
|
+
eligible?: (target: NormalizedComboTarget) => boolean,
|
|
229
|
+
now = Date.now(),
|
|
230
|
+
): ComboExclusionReasons {
|
|
231
|
+
return comboExclusion(config, comboId, eligible, now).reasons;
|
|
136
232
|
}
|
|
137
233
|
|
|
138
234
|
/** Capture usable providers' quota cooldowns; request eligibility is deferred to exhaustion. */
|
|
@@ -760,6 +856,6 @@ export function tryPickComboModel(config: OcxConfig, modelId: string, preview =
|
|
|
760
856
|
if (!comboId) return null;
|
|
761
857
|
if (!getCombo(config, comboId)) throw new UnknownComboError(comboId);
|
|
762
858
|
const picked = pickComboTarget(config, comboId, { preview, allowCooldownReprobe: false });
|
|
763
|
-
if (!picked) throw new NoAvailableComboTargetsError(comboId,
|
|
859
|
+
if (!picked) throw new NoAvailableComboTargetsError(comboId, comboExclusion(config, comboId));
|
|
764
860
|
return picked;
|
|
765
861
|
}
|
|
@@ -11,6 +11,7 @@ import * as z from "zod/v4";
|
|
|
11
11
|
import { compactionRecoveryConfigError } from "./schema/compaction-recovery";
|
|
12
12
|
import { nativeReasoningRetentionConfigError } from "./schema/native-reasoning-retention";
|
|
13
13
|
import { WORKFLOW_BUDGET_SHAPE_HINT, workflowBudgetConfigError } from "./schema/workflow-budget";
|
|
14
|
+
import { ROUTED_CATALOG_DEFAULTS_SHAPE_HINT, routedCatalogDefaultsConfigError } from "./schema/routed-catalog-defaults";
|
|
14
15
|
import { desktopCompatibilityConfigError } from "./schema/desktop-compatibility";
|
|
15
16
|
import { blockedModelRedirectsError } from "./schema/blocked-model-redirects";
|
|
16
17
|
import { mainAccountHardLockFallbackError } from "./schema/main-account-hard-lock-fallback";
|
|
@@ -151,6 +152,7 @@ function validFileConfigDiagnostics(config: OcxConfig, rawParsed: unknown): Conf
|
|
|
151
152
|
if (blockedModelRedirectsError(rawParsed)) warnings.push("blockedModelRedirects ignored: expected a map of nonempty model keys to nonempty string targets");
|
|
152
153
|
if (nativeReasoningRetentionConfigError(rawParsed)) warnings.push("nativeReasoningRetention ignored: expected only optional boolean modelSwitch and accountSwitch fields; both remain off");
|
|
153
154
|
if (workflowBudgetConfigError(rawParsed)) warnings.push("workflowBudget ignored: " + WORKFLOW_BUDGET_SHAPE_HINT + "; the built-in ceilings remain");
|
|
155
|
+
if (routedCatalogDefaultsConfigError(rawParsed)) warnings.push("routedCatalogDefaults ignored: " + ROUTED_CATALOG_DEFAULTS_SHAPE_HINT + "; routed catalog rows keep their derived values");
|
|
154
156
|
if (mainAccountHardLockFallbackError(rawParsed)) warnings.push("codexMainAccountHardLockFallback ignored: expected a nonblank model selector and an optional declared reasoningEffort");
|
|
155
157
|
if (fallbackPolicyError(rawParsed)) warnings.push("fallback partly ignored: expected boolean model/provider switches, providers/routes/devices maps of them, and devices.<id>.localFallback; ignored leaves keep today's fallback behavior");
|
|
156
158
|
const quotaAutoRefreshWarning = degradedCodexQuotaAutoRefreshWarning(rawParsed, normalized);
|
|
@@ -778,6 +780,7 @@ export function validateConfigCandidate(value: unknown): { ok: true; config: Ocx
|
|
|
778
780
|
?? fallbackPolicyError(value)
|
|
779
781
|
?? nativeReasoningRetentionConfigError(value)
|
|
780
782
|
?? workflowBudgetConfigError(value)
|
|
783
|
+
?? routedCatalogDefaultsConfigError(value)
|
|
781
784
|
?? mainAccountHardLockFallbackError(value)
|
|
782
785
|
?? compactionRecoveryConfigError(value) ?? desktopCompatibilityConfigError(value) ?? configReasoningPinsConfigError(value)
|
|
783
786
|
?? blankHostnameError(value)
|
|
@@ -2,7 +2,8 @@ import { observeAccountAutoPauseRevisions, snapshotAutoPauseFingerprints } from
|
|
|
2
2
|
import type { OcxConfig, OcxProviderConfig, ProviderCostOverlay } from "../types";
|
|
3
3
|
import { configReasoningPinsConfigError } from "./provider-validation";
|
|
4
4
|
import { carryPersistedTelemetry } from "./telemetry-carry";
|
|
5
|
-
import {
|
|
5
|
+
import { adoptPersistedConfigMigrations, projectPersistedConfigMigrations } from "./persisted-projections";
|
|
6
|
+
import { RESERVE_CAPABILITY_KEYS } from "./reserve-capability";
|
|
6
7
|
import { refreshPreservedProviderOwner } from "../usage/user-cost-overlays";
|
|
7
8
|
import { refreshConfigDerivedRegistries } from "./derived-registries";
|
|
8
9
|
import {
|
|
@@ -598,6 +599,8 @@ export function saveConfigPreservingClaudeCode(config: OcxConfig): void {
|
|
|
598
599
|
...(provenanceExists
|
|
599
600
|
? Object.keys(persistedDiagnostics.config as unknown as Record<string, unknown>)
|
|
600
601
|
: []),
|
|
602
|
+
// An absent Reserve value reads as off, so a disk-only value is never left behind.
|
|
603
|
+
...RESERVE_CAPABILITY_KEYS,
|
|
601
604
|
]);
|
|
602
605
|
for (const key of Object.keys(persistedDiagnostics.config as unknown as Record<string, unknown>)) {
|
|
603
606
|
if (!rebaseableKeys.has(key)) skipped.add(key);
|
|
@@ -640,7 +643,7 @@ export function saveConfigPreservingClaudeCode(config: OcxConfig): void {
|
|
|
640
643
|
if (diskDeletedKeys.size) durableProjection.configRebaseProvenance = { version: 1,
|
|
641
644
|
deletedTopLevelKeys: [...new Set([...configRebaseDeletionKeys(durableProjection), ...diskDeletedKeys])].sort() };
|
|
642
645
|
const provenanceProjection = projectConfigRebaseProvenance(durableProjection);
|
|
643
|
-
const projectedConfig =
|
|
646
|
+
const projectedConfig = projectPersistedConfigMigrations(
|
|
644
647
|
onDisk,
|
|
645
648
|
durableProjection,
|
|
646
649
|
);
|
|
@@ -661,7 +664,7 @@ export function saveConfigPreservingClaudeCode(config: OcxConfig): void {
|
|
|
661
664
|
} else {
|
|
662
665
|
persist(projectedConfig);
|
|
663
666
|
}
|
|
664
|
-
|
|
667
|
+
adoptPersistedConfigMigrations(config, projectedConfig);
|
|
665
668
|
captureLiveTopologyBaseline(config);
|
|
666
669
|
if (claudeCodeBaseline.has(config)) {
|
|
667
670
|
claudeCodeBaseline.set(config, structuredClone(config.claudeCode));
|
|
@@ -5,6 +5,7 @@ import { join } from "node:path";
|
|
|
5
5
|
import { compactionRecoveryConfigError } from "./schema/compaction-recovery";
|
|
6
6
|
import { nativeReasoningRetentionConfigError } from "./schema/native-reasoning-retention";
|
|
7
7
|
import { workflowBudgetConfigError } from "./schema/workflow-budget";
|
|
8
|
+
import { routedCatalogDefaultsConfigError } from "./schema/routed-catalog-defaults";
|
|
8
9
|
import { desktopCompatibilityConfigError } from "./schema/desktop-compatibility";
|
|
9
10
|
import { blockedModelRedirectsError } from "./schema/blocked-model-redirects";
|
|
10
11
|
import { mainAccountHardLockFallbackError } from "./schema/main-account-hard-lock-fallback";
|
|
@@ -141,6 +142,7 @@ export function warnDegradedCompactionRouting(rawParsed: unknown, validated: Ocx
|
|
|
141
142
|
export function warnDegradedTopLevelOptIns(rawParsed: unknown, validated: OcxConfig): void {
|
|
142
143
|
if (nativeReasoningRetentionConfigError(rawParsed)) console.warn("⚠️ invalid nativeReasoningRetention disabled; model and account switch allowances remain off");
|
|
143
144
|
if (workflowBudgetConfigError(rawParsed)) console.warn("⚠️ invalid workflowBudget ignored; the built-in workflow ceilings stay in force");
|
|
145
|
+
if (routedCatalogDefaultsConfigError(rawParsed)) console.warn("⚠️ invalid routedCatalogDefaults ignored; routed catalog rows keep their derived values");
|
|
144
146
|
setCodexWsReuseAcrossTurns(validated.codexWsReuseAcrossTurns === true);
|
|
145
147
|
const retentionWarning = degradedReasoningRetentionWarning(rawParsed, validated);
|
|
146
148
|
if (retentionWarning) console.warn(retentionWarning);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OcxConfig } from "../types";
|
|
2
|
-
import {
|
|
2
|
+
import { projectPersistedConfigMigrations } from "./persisted-projections";
|
|
3
3
|
import { readConfigFileSnapshot, type ConfigFileSnapshot } from "./diagnostics";
|
|
4
4
|
import { bumpGenerationForCooperatingConfigWrite, withConfigMutationLockSync } from "./mutation-lock";
|
|
5
5
|
import { persistConfigUnlocked } from "./persist-unlocked";
|
|
@@ -89,7 +89,7 @@ export function mutatePersistedConfig<T>(
|
|
|
89
89
|
continue;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const projected =
|
|
92
|
+
const projected = projectPersistedConfigMigrations(
|
|
93
93
|
commitBase.diagnostics.config,
|
|
94
94
|
projectConfigRebaseProvenance(confirmedConfig),
|
|
95
95
|
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OcxConfig } from "../types";
|
|
2
|
+
import { adoptCustomModelCatalogMigration, projectCustomModelCatalogMigration } from "../codex/custom-model-catalog-migration";
|
|
3
|
+
import { adoptReserveCapabilityMigration, projectReserveCapabilityMigration } from "./reserve-capability";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Every one-time migration a whole-config write must carry, projected against the same pre-write
|
|
7
|
+
* document. Writers call this once instead of each migration separately, so a new migration cannot
|
|
8
|
+
* be wired into some write paths and silently missed by others.
|
|
9
|
+
*/
|
|
10
|
+
export function projectPersistedConfigMigrations(persisted: unknown, candidate: OcxConfig): OcxConfig {
|
|
11
|
+
return projectReserveCapabilityMigration(persisted, projectCustomModelCatalogMigration(persisted, candidate));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Copy the migration state a successful projected write established onto the live object. */
|
|
15
|
+
export function adoptPersistedConfigMigrations(target: OcxConfig, projected: OcxConfig): void {
|
|
16
|
+
adoptCustomModelCatalogMigration(target, projected);
|
|
17
|
+
adoptReserveCapabilityMigration(target, projected);
|
|
18
|
+
}
|
|
@@ -166,9 +166,10 @@ export type RuntimePortState = {
|
|
|
166
166
|
servingGeneration?: string;
|
|
167
167
|
/**
|
|
168
168
|
* The owner a client runtime classified from positive evidence (src/client/runtime-restart.ts
|
|
169
|
-
*
|
|
170
|
-
* runtimes older than this field; `ocx disconnect` restarts only a runtime whose
|
|
171
|
-
*
|
|
169
|
+
* recordedRestartOwner: desktop, service-manager or none), or legacy-flag for a bare OCX_SERVICE=1
|
|
170
|
+
* (#8545). Absent for runtimes older than this field; `ocx disconnect` restarts only a runtime whose
|
|
171
|
+
* record states a proven owner, and gives the re-register advice for legacy-flag. Any string is
|
|
172
|
+
* accepted here so a later value never invalidates the record.
|
|
172
173
|
*/
|
|
173
174
|
restartOwner?: string;
|
|
174
175
|
/**
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { OcxConfig } from "../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Luna Reserve's own capability switch (#4961).
|
|
5
|
+
*
|
|
6
|
+
* Reserve used to ride `codexDesktopAuthless`, a flag documented as controlling whether the Codex app
|
|
7
|
+
* asks for a sign-in. It is now `codexReserveEnabled`, seeded once from that flag and independent of
|
|
8
|
+
* it afterwards. `codexReserveMigration` records that the seed happened.
|
|
9
|
+
*
|
|
10
|
+
* Until a document carries the marker, Reserve reads the legacy flag, which is exactly the value the
|
|
11
|
+
* migration persists. Startup records the seed for every unmarked file once, so after the first start
|
|
12
|
+
* on this version a hand edit of authless cannot move Reserve. Writers record it only when it matters:
|
|
13
|
+
* when a write changes authless (the seed then comes from the persisted pre-write document, so the
|
|
14
|
+
* change cannot move Reserve), when Reserve is set explicitly, or when a new document is created with
|
|
15
|
+
* authless on (new documents start disabled). Other writes leave an unmarked document byte-for-byte
|
|
16
|
+
* alone. Once the marker exists, an absent `codexReserveEnabled` means off, so deleting the field
|
|
17
|
+
* cannot bring the inheritance back.
|
|
18
|
+
*
|
|
19
|
+
* Enabling the capability never manufactures permission: every Reserve request still needs the
|
|
20
|
+
* upstream, credential-bound Reserve allowance, a non-client role and a loopback admission.
|
|
21
|
+
*/
|
|
22
|
+
export const RESERVE_CAPABILITY_MIGRATION_VERSION = 1;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The two Reserve fields. A live save always rebases them against disk, even when the live config and
|
|
26
|
+
* its baseline both omit them: after the marker an absent value reads as off, so skipping a value only
|
|
27
|
+
* another process wrote would silently turn Reserve off. Explicit live edits still win the merge.
|
|
28
|
+
*/
|
|
29
|
+
export const RESERVE_CAPABILITY_KEYS: readonly string[] = ["codexReserveEnabled", "codexReserveMigration"];
|
|
30
|
+
|
|
31
|
+
type ReserveCapabilityFields = Pick<OcxConfig, "codexReserveEnabled" | "codexReserveMigration" | "codexDesktopAuthless">;
|
|
32
|
+
|
|
33
|
+
function configRecord(value: unknown): Record<string, unknown> | undefined {
|
|
34
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value as Record<string, unknown> : undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isMigratedMarker(value: unknown): value is number {
|
|
38
|
+
return typeof value === "number" && Number.isInteger(value) && value >= RESERVE_CAPABILITY_MIGRATION_VERSION;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isReserveCapabilityMigrated(config: unknown): boolean {
|
|
42
|
+
return isMigratedMarker(configRecord(config)?.codexReserveMigration);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Whether the operator enabled Luna Reserve. Runtime role and listener admission are checked separately. */
|
|
46
|
+
export function isCodexReserveEnabled(config: Partial<ReserveCapabilityFields> | undefined): boolean {
|
|
47
|
+
if (!config) return false;
|
|
48
|
+
if (typeof config.codexReserveEnabled === "boolean") return config.codexReserveEnabled;
|
|
49
|
+
if (isMigratedMarker(config.codexReserveMigration)) return false;
|
|
50
|
+
return config.codexDesktopAuthless === true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Seed this document from its own legacy flag, in place. Returns whether anything changed. */
|
|
54
|
+
export function migrateReserveCapability(config: OcxConfig): boolean {
|
|
55
|
+
if (isMigratedMarker(config.codexReserveMigration)) return false;
|
|
56
|
+
if (typeof config.codexReserveEnabled !== "boolean") config.codexReserveEnabled = config.codexDesktopAuthless === true;
|
|
57
|
+
config.codexReserveMigration = RESERVE_CAPABILITY_MIGRATION_VERSION;
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Carry the migration onto a whole-config write. `persisted` is the document on disk before the
|
|
63
|
+
* write (undefined when none exists yet) and is the only authority for the legacy seed; a candidate
|
|
64
|
+
* without the marker is a snapshot taken before migration and never decides the seed itself.
|
|
65
|
+
*/
|
|
66
|
+
export function projectReserveCapabilityMigration(persisted: unknown, candidate: OcxConfig): OcxConfig {
|
|
67
|
+
if (isMigratedMarker(candidate.codexReserveMigration)) return candidate;
|
|
68
|
+
const prior = configRecord(persisted);
|
|
69
|
+
if (prior && isMigratedMarker(prior.codexReserveMigration)) {
|
|
70
|
+
const projected = { ...candidate };
|
|
71
|
+
if (typeof projected.codexReserveEnabled !== "boolean") {
|
|
72
|
+
if (typeof prior.codexReserveEnabled === "boolean") projected.codexReserveEnabled = prior.codexReserveEnabled;
|
|
73
|
+
else delete projected.codexReserveEnabled;
|
|
74
|
+
}
|
|
75
|
+
// Same key order as the seed below, so carrying an unchanged state rewrites identical bytes.
|
|
76
|
+
projected.codexReserveMigration = prior.codexReserveMigration;
|
|
77
|
+
return projected;
|
|
78
|
+
}
|
|
79
|
+
const explicit = typeof candidate.codexReserveEnabled === "boolean";
|
|
80
|
+
// A new document has no earlier authless value to carry: it starts disabled.
|
|
81
|
+
const legacy = prior ? prior.codexDesktopAuthless === true : false;
|
|
82
|
+
// Nothing to record while authless keeps its persisted value: the reading is unchanged.
|
|
83
|
+
if (!explicit && (candidate.codexDesktopAuthless === true) === legacy) return candidate;
|
|
84
|
+
const projected = { ...candidate };
|
|
85
|
+
if (!explicit) projected.codexReserveEnabled = legacy;
|
|
86
|
+
projected.codexReserveMigration = RESERVE_CAPABILITY_MIGRATION_VERSION;
|
|
87
|
+
return projected;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** After the projected write succeeds, the live object holds what was written. */
|
|
91
|
+
export function adoptReserveCapabilityMigration(target: OcxConfig, projected: OcxConfig): void {
|
|
92
|
+
if (projected.codexReserveMigration === undefined) delete target.codexReserveMigration;
|
|
93
|
+
else target.codexReserveMigration = projected.codexReserveMigration;
|
|
94
|
+
if (projected.codexReserveEnabled === undefined) delete target.codexReserveEnabled;
|
|
95
|
+
else target.codexReserveEnabled = projected.codexReserveEnabled;
|
|
96
|
+
}
|
|
@@ -8,6 +8,7 @@ import { anthropicAccountPoolSchema } from "./anthropic-account-pool";
|
|
|
8
8
|
import { compactionRecoverySchema } from "./compaction-recovery";
|
|
9
9
|
import { nativeReasoningRetentionSchema } from "./native-reasoning-retention";
|
|
10
10
|
import { workflowBudgetSchema } from "./workflow-budget";
|
|
11
|
+
import { routedCatalogDefaultsSchema } from "./routed-catalog-defaults";
|
|
11
12
|
import { desktopCompatibilitySchema } from "./desktop-compatibility";
|
|
12
13
|
import { blockedModelRedirectsSchema } from "./blocked-model-redirects";
|
|
13
14
|
import { mainAccountHardLockFallbackSchema } from "./main-account-hard-lock-fallback";
|
|
@@ -234,6 +235,8 @@ export const configSchema = z.object({
|
|
|
234
235
|
nativeReasoningRetention: nativeReasoningRetentionSchema.optional().catch(undefined),
|
|
235
236
|
// A bad hand edit falls back to the built-in ceilings; it never turns the guard off.
|
|
236
237
|
workflowBudget: workflowBudgetSchema.optional().catch(undefined),
|
|
238
|
+
// A bad hand edit drops the whole block, so routed rows keep today's derivation (#6872).
|
|
239
|
+
routedCatalogDefaults: routedCatalogDefaultsSchema.optional().catch(undefined),
|
|
237
240
|
desktopCompatibility: desktopCompatibilitySchema.optional().catch(undefined),
|
|
238
241
|
// A hand-edited malformed phase disables only that phase instead of rejecting
|
|
239
242
|
// providers/apiKeys, matching the load-time degradation notice; the management write
|
|
@@ -344,6 +347,9 @@ export const configSchema = z.object({
|
|
|
344
347
|
}).strict().optional().catch(undefined)),
|
|
345
348
|
codexShimAutoRestore: z.boolean().optional(),
|
|
346
349
|
codexDesktopAuthless: z.boolean().optional().catch(undefined),
|
|
350
|
+
codexReserveEnabled: z.boolean().optional().catch(undefined),
|
|
351
|
+
// A malformed marker degrades to unmigrated, which reseeds from the persisted authless flag.
|
|
352
|
+
codexReserveMigration: z.number().int().positive().optional().catch(undefined),
|
|
347
353
|
codexClientCompaction: z.boolean().optional().catch(undefined),
|
|
348
354
|
// Presentation-only label for the injected provider. A malformed value degrades to undefined
|
|
349
355
|
// and the default label is emitted, rather than failing the parse or writing a config Codex
|
|
@@ -458,8 +458,10 @@ export const providerConfigSchema = z.object({
|
|
|
458
458
|
}).strict().optional(),
|
|
459
459
|
responsesSnapshotRepair: z.boolean().optional(),
|
|
460
460
|
messagePhaseInference: z.boolean().optional(),
|
|
461
|
+
estimateMissingUsage: z.boolean().optional(),
|
|
461
462
|
hideRawReasoning: z.boolean().optional(),
|
|
462
463
|
forwardAdvisorTool: z.boolean().optional(),
|
|
464
|
+
perMessageEffort: z.boolean().optional(),
|
|
463
465
|
// Invalid blocks degrade to "absent" rather than failing the whole config load: an unusable
|
|
464
466
|
// bridge block must never send an operator through invalid-config recovery for an opt-in
|
|
465
467
|
// feature that is off by default. The management write boundary still rejects it loudly.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import type { OcxConfig } from "../../types";
|
|
3
|
+
import type { OcxRoutedCatalogDefaultsConfig } from "../../types/routed-catalog-defaults";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Operator defaults for routed Codex catalog rows (#6872), stored as top-level
|
|
7
|
+
* `routedCatalogDefaults` in config.json.
|
|
8
|
+
*
|
|
9
|
+
* The allowlist is the owner's decision: the three `include_*_usage_instructions` prompt-block
|
|
10
|
+
* flags plus `default_verbosity`. Nothing else is accepted, because the
|
|
11
|
+
* neighbouring row fields (tool mode, search, truncation, auto review, identity) carry execution or
|
|
12
|
+
* protocol contracts that an operator default must not be able to undo. Every field is optional;
|
|
13
|
+
* an omitted field keeps today's derivation, and explicit `false` stays `false`.
|
|
14
|
+
*/
|
|
15
|
+
export const ROUTED_CATALOG_VERBOSITIES = ["low", "medium", "high"] as const;
|
|
16
|
+
|
|
17
|
+
export const routedCatalogDefaultsSchema = z.object({
|
|
18
|
+
includeSkillsUsageInstructions: z.boolean().optional(),
|
|
19
|
+
includeAppsUsageInstructions: z.boolean().optional(),
|
|
20
|
+
includePluginUsageInstructions: z.boolean().optional(),
|
|
21
|
+
defaultVerbosity: z.enum(ROUTED_CATALOG_VERBOSITIES).optional(),
|
|
22
|
+
}).strict() satisfies z.ZodType<OcxRoutedCatalogDefaultsConfig>;
|
|
23
|
+
|
|
24
|
+
export type RoutedCatalogDefaults = OcxRoutedCatalogDefaultsConfig;
|
|
25
|
+
|
|
26
|
+
export const ROUTED_CATALOG_DEFAULTS_SHAPE_HINT = "accepts only optional boolean includeSkillsUsageInstructions,"
|
|
27
|
+
+ " includeAppsUsageInstructions and includePluginUsageInstructions, and an optional"
|
|
28
|
+
+ " defaultVerbosity of \"low\", \"medium\" or \"high\"";
|
|
29
|
+
|
|
30
|
+
/** Write-boundary check; also drives the load-time and diagnostics warnings for a degraded block. */
|
|
31
|
+
export function routedCatalogDefaultsConfigError(value: unknown): string | null {
|
|
32
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
33
|
+
const block = (value as Record<string, unknown>).routedCatalogDefaults;
|
|
34
|
+
return block === undefined || routedCatalogDefaultsSchema.safeParse(block).success
|
|
35
|
+
? null : "schema_invalid: routedCatalogDefaults: " + ROUTED_CATALOG_DEFAULTS_SHAPE_HINT;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Capture the defaults once per catalog build. Catalog derivation receives this frozen snapshot as
|
|
40
|
+
* an input instead of reading mutable config while it derives rows. A malformed synthetic value
|
|
41
|
+
* resolves the same way as a degraded disk block, and an empty block is the same as no block.
|
|
42
|
+
*/
|
|
43
|
+
export function resolveRoutedCatalogDefaults(
|
|
44
|
+
config: Pick<OcxConfig, "routedCatalogDefaults">,
|
|
45
|
+
): Readonly<RoutedCatalogDefaults> | undefined {
|
|
46
|
+
const parsed = routedCatalogDefaultsSchema.safeParse(config.routedCatalogDefaults);
|
|
47
|
+
if (!parsed.success || Object.keys(parsed.data).length === 0) return undefined;
|
|
48
|
+
return Object.freeze({ ...parsed.data });
|
|
49
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { configReasoningPinsConfigError } from "./config/provider-validation";
|
|
|
6
6
|
import { recordOwnedConfigPath } from "./lib/config-ownership";
|
|
7
7
|
import { assertNotRealHomeUnderTest } from "./lib/test-home-guard";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./
|
|
9
|
+
adoptPersistedConfigMigrations,
|
|
10
|
+
projectPersistedConfigMigrations,
|
|
11
|
+
} from "./config/persisted-projections";
|
|
12
12
|
import { refreshConfigDerivedRegistries } from "./config/derived-registries";
|
|
13
13
|
import {
|
|
14
14
|
clearPendingConfigDeletions,
|
|
@@ -355,7 +355,7 @@ export function initializePersistedConfigIfMissing(
|
|
|
355
355
|
const persisted = withConfigMutationLockSync((): OcxConfig | "exists" | "invalid" => {
|
|
356
356
|
const current = observeInitialConfigState();
|
|
357
357
|
if (current !== "missing") return current;
|
|
358
|
-
const projected =
|
|
358
|
+
const projected = projectPersistedConfigMigrations(undefined, projectConfigRebaseProvenance(config));
|
|
359
359
|
normalizeAccountAutoPauseRevisions(undefined, projected);
|
|
360
360
|
// Creating config.json never introduces a telemetry decision: one made before the file existed
|
|
361
361
|
// is held in telemetry-state.json, where another process may have replaced it (see
|
|
@@ -372,7 +372,7 @@ export function initializePersistedConfigIfMissing(
|
|
|
372
372
|
return projected;
|
|
373
373
|
});
|
|
374
374
|
if (typeof persisted === "string") return persisted;
|
|
375
|
-
|
|
375
|
+
adoptPersistedConfigMigrations(config, persisted);
|
|
376
376
|
if (telemetry?.carried) adoptPersistedTelemetry(config, telemetry.value);
|
|
377
377
|
if (persisted.configRebaseProvenance === undefined) delete config.configRebaseProvenance;
|
|
378
378
|
else config.configRebaseProvenance = structuredClone(persisted.configRebaseProvenance);
|
|
@@ -393,14 +393,14 @@ export function saveConfig(config: OcxConfig): void {
|
|
|
393
393
|
assertNotRealHomeUnderTest(getConfigDir());
|
|
394
394
|
withConfigMutationLockSync(() => {
|
|
395
395
|
const onDisk = readRawConfigJson();
|
|
396
|
-
const withProvenance =
|
|
396
|
+
const withProvenance = projectPersistedConfigMigrations(
|
|
397
397
|
onDisk,
|
|
398
398
|
projectConfigRebaseProvenance(config),
|
|
399
399
|
);
|
|
400
400
|
// Telemetry consent is owned by the file, as in the live save (see carryPersistedTelemetry).
|
|
401
401
|
const telemetry = carryPersistedTelemetry(withProvenance, onDisk);
|
|
402
402
|
if (persistConfigUnlocked(withProvenance)) bumpGenerationForCooperatingConfigWrite();
|
|
403
|
-
|
|
403
|
+
adoptPersistedConfigMigrations(config, withProvenance);
|
|
404
404
|
if (telemetry.carried) adoptPersistedTelemetry(config, telemetry.value);
|
|
405
405
|
if (withProvenance.configRebaseProvenance === undefined) delete config.configRebaseProvenance;
|
|
406
406
|
else config.configRebaseProvenance = structuredClone(withProvenance.configRebaseProvenance);
|