@bitkyc08/opencodex 2.100.0 → 2.100.2

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 (178) hide show
  1. package/gui/dist/assets/App-BpJOzw4F.js +59 -0
  2. package/gui/dist/assets/Tray-BcaI-VCr.js +1 -0
  3. package/gui/dist/assets/brand-mark-DU-0Vdkr.js +1 -0
  4. package/gui/dist/assets/index-Bbor_y80.js +94 -0
  5. package/gui/dist/assets/index-DJEkIDAi.css +2 -0
  6. package/gui/dist/assets/{segment-thumb-features-CcxZBnxv.js → segment-thumb-features-e9A_FogJ.js} +1 -1
  7. package/gui/dist/classic/assets/{App-aYgIQMxI.js → App-BrIlUiLc.js} +18 -18
  8. package/gui/dist/classic/assets/{Tray-D8jfUXpQ.js → Tray-DT146AhS.js} +1 -1
  9. package/gui/dist/classic/assets/index-DyJHagvT.js +94 -0
  10. package/gui/dist/classic/assets/quota-summary-CakPe9Ni.js +1 -0
  11. package/gui/dist/classic/index.html +1 -1
  12. package/gui/dist/index.html +2 -2
  13. package/package.json +2 -2
  14. package/src/adapters/anthropic-image-normalize.ts +1 -1
  15. package/src/adapters/client-fingerprint.ts +6 -4
  16. package/src/adapters/cursor/native-exec.ts +3 -2
  17. package/src/adapters/cursor/tool-guidance.ts +3 -3
  18. package/src/adapters/cursor/tool-wording.ts +10 -1
  19. package/src/adapters/devin/cloud-direct/tool-schema.ts +20 -2
  20. package/src/adapters/google-antigravity-wire.ts +13 -6
  21. package/src/adapters/google-truncation.ts +4 -2
  22. package/src/adapters/google.ts +8 -2
  23. package/src/adapters/openai-chat/mistral-image-limit.ts +28 -15
  24. package/src/adapters/openai-chat/tool-schema.ts +9 -0
  25. package/src/adapters/openai-chat-images.ts +100 -0
  26. package/src/adapters/openai-chat.ts +6 -9
  27. package/src/adapters/openai-responses/tool-schema.ts +18 -4
  28. package/src/adapters/run-turn-queue.ts +139 -5
  29. package/src/adapters/upstream-http-error.ts +4 -2
  30. package/src/bridge/sse.ts +8 -1
  31. package/src/claude/chat-tool-dispatch.ts +233 -0
  32. package/src/claude/inbound-tool-loading.ts +42 -17
  33. package/src/cli/account-api.ts +6 -0
  34. package/src/cli/account-extended.ts +60 -6
  35. package/src/cli/account-key-quota.ts +22 -2
  36. package/src/cli/account.ts +1 -1
  37. package/src/cli/capabilities-access-remote.ts +10 -0
  38. package/src/cli/capabilities-agents-routing.ts +2 -2
  39. package/src/cli/capabilities-base.ts +2 -2
  40. package/src/cli/claude.ts +19 -14
  41. package/src/cli/config-command.ts +24 -1
  42. package/src/cli/connect.ts +36 -3
  43. package/src/cli/gui-pair-client.ts +23 -2
  44. package/src/cli/help.ts +1 -1
  45. package/src/cli/hub.ts +18 -1
  46. package/src/cli/link-child-ops.ts +136 -0
  47. package/src/cli/link-status-child.ts +94 -0
  48. package/src/cli/link.ts +22 -9
  49. package/src/cli/registry.ts +3 -2
  50. package/src/cli/sync-command.ts +3 -1
  51. package/src/cli/sync-fanout.ts +8 -81
  52. package/src/client/link-readiness.ts +16 -6
  53. package/src/client/link-tunnel-status.ts +76 -0
  54. package/src/clients/config-export.ts +14 -1
  55. package/src/codex/account-resume-health.ts +41 -0
  56. package/src/codex/auth-api/login-flow.ts +6 -0
  57. package/src/codex/auth-api/routes.ts +35 -2
  58. package/src/codex/catalog/gather-capture.ts +2 -0
  59. package/src/codex/catalog/provider-models.ts +13 -8
  60. package/src/codex/convergence-types.ts +2 -0
  61. package/src/codex/quota.ts +111 -6
  62. package/src/combos/cooldown-store.ts +208 -0
  63. package/src/combos/failover.ts +432 -35
  64. package/src/config/salvage.ts +1 -0
  65. package/src/config/schema/config-schema.ts +6 -3
  66. package/src/config/schema/leaf-validators.ts +34 -12
  67. package/src/generated/compatibility-version.json +227 -135
  68. package/src/lib/catalog-etag.ts +10 -0
  69. package/src/lib/client-error-body.ts +15 -0
  70. package/src/lib/config-ownership.ts +9 -2
  71. package/src/lib/context-overflow-verdict.ts +266 -9
  72. package/src/lib/failure-detail.ts +72 -3
  73. package/src/lib/hard-refusal.ts +259 -0
  74. package/src/link/child-activity.ts +57 -0
  75. package/src/link/child-catalog-freshness.ts +149 -0
  76. package/src/link/child-gated-ocx.ts +117 -0
  77. package/src/link/child-observations.ts +205 -0
  78. package/src/link/child-observe.ts +121 -0
  79. package/src/link/child-ops-engine.ts +162 -0
  80. package/src/link/child-update-contract.ts +165 -0
  81. package/src/link/paths.ts +5 -0
  82. package/src/link/remote-windows.ts +42 -6
  83. package/src/link/ssh-argv.ts +126 -32
  84. package/src/link/status-projection.ts +73 -0
  85. package/src/link/sync-fanout-classify.ts +98 -0
  86. package/src/link/tunnel-state.ts +10 -4
  87. package/src/messaging/mcp-queue-rpc.ts +2 -1
  88. package/src/messaging/mcp-queue-server.ts +5 -0
  89. package/src/messaging/mcp-reply-tools.ts +24 -9
  90. package/src/messaging/mcp-reply-wait.ts +70 -0
  91. package/src/oauth/account-resume-health.ts +60 -0
  92. package/src/oauth/anthropic-model-quota.ts +12 -0
  93. package/src/oauth/anthropic-routing.ts +11 -4
  94. package/src/oauth/index.ts +1 -0
  95. package/src/oauth/kiro-iam-identity-center.ts +4 -1
  96. package/src/oauth/store.ts +44 -1
  97. package/src/providers/api-key-pause-state.ts +23 -0
  98. package/src/providers/api-key-pause.ts +68 -10
  99. package/src/providers/api-key-selection-capture.ts +3 -1
  100. package/src/providers/api-key-selection.ts +3 -2
  101. package/src/providers/api-keys.ts +18 -5
  102. package/src/providers/claude-cli-identity.ts +9 -3
  103. package/src/providers/claude-cli-usage-state.ts +11 -6
  104. package/src/providers/claude-cli-usage.ts +27 -8
  105. package/src/providers/codex-capacity.ts +11 -2
  106. package/src/providers/key-failover.ts +13 -6
  107. package/src/providers/model-discovery-config.ts +31 -0
  108. package/src/providers/model-discovery-diagnostic.ts +34 -3
  109. package/src/providers/model-discovery.ts +43 -7
  110. package/src/providers/model-rename-fields.ts +2 -0
  111. package/src/providers/openai-sidecar.ts +15 -2
  112. package/src/providers/provider-id-rewrite.ts +3 -0
  113. package/src/providers/quota/account-cache.ts +52 -34
  114. package/src/providers/quota/anthropic-family-headers.ts +8 -1
  115. package/src/providers/quota/anthropic-usage-windows.ts +66 -9
  116. package/src/providers/quota/report-cache.ts +53 -5
  117. package/src/providers/quota/vendor-probes-key.ts +73 -0
  118. package/src/providers/quota/vendor-probes-oauth.ts +57 -3
  119. package/src/providers/quota-key-accounts.ts +12 -5
  120. package/src/providers/quota-mistral-budget.ts +18 -0
  121. package/src/providers/quota-types.ts +32 -0
  122. package/src/providers/quota.ts +22 -22
  123. package/src/providers/reasoning-metadata.ts +1051 -12
  124. package/src/providers/registry/entries-extended.ts +3 -1
  125. package/src/providers/registry/model-ids.ts +1 -0
  126. package/src/providers/registry/types.ts +6 -0
  127. package/src/quota/reset-observer.ts +4 -2
  128. package/src/quota/reset-seen-store.ts +9 -0
  129. package/src/quota/window-mapping.ts +1 -0
  130. package/src/quota-pool/assemble.ts +4 -1
  131. package/src/responses/hosted-tool-policy.ts +56 -12
  132. package/src/responses/retained-compaction.ts +31 -5
  133. package/src/router.ts +2 -0
  134. package/src/server/auth-cors.ts +11 -8
  135. package/src/server/catalog-download.ts +3 -5
  136. package/src/server/chat-native.ts +11 -2
  137. package/src/server/claude-messages.ts +2 -1
  138. package/src/server/images.ts +41 -13
  139. package/src/server/index/link-listener.ts +16 -2
  140. package/src/server/index/link-relay-sessions.ts +43 -2
  141. package/src/server/index/optional-listeners.ts +18 -0
  142. package/src/server/management/config-routes.ts +7 -1
  143. package/src/server/management/context.ts +1 -1
  144. package/src/server/management/link-child-ops-routes.ts +116 -0
  145. package/src/server/management/link-route-state.ts +10 -0
  146. package/src/server/management/link-routes.ts +10 -0
  147. package/src/server/management/oauth-account-routes.ts +33 -4
  148. package/src/server/management/provider-overwrite-carry.ts +28 -3
  149. package/src/server/management/provider-routes.ts +16 -11
  150. package/src/server/management/route-registry.ts +3 -0
  151. package/src/server/messages-native.ts +5 -0
  152. package/src/server/request-log-failure-detail.ts +59 -1
  153. package/src/server/responses/adapter-dispatch.ts +35 -44
  154. package/src/server/responses/combo-stream-preflight.ts +146 -29
  155. package/src/server/responses/compact.ts +27 -4
  156. package/src/server/responses/context-overflow.ts +58 -2
  157. package/src/server/responses/core-combo-failure.ts +29 -4
  158. package/src/server/responses/core-combo-native.ts +3 -1
  159. package/src/server/responses/core-combo.ts +30 -3
  160. package/src/server/responses/core-errors.ts +3 -1
  161. package/src/server/responses/core-opaque-recovery.ts +45 -2
  162. package/src/server/responses/core-options.ts +12 -0
  163. package/src/server/responses/passthrough-dispatch.ts +30 -38
  164. package/src/server/responses/request-transport.ts +43 -14
  165. package/src/server/responses/reset-replay.ts +58 -2
  166. package/src/server/responses/run-turn-execution.ts +56 -30
  167. package/src/types/claude-tool-loading.ts +48 -0
  168. package/src/types/config.ts +5 -35
  169. package/src/types/provider.ts +21 -0
  170. package/src/types.ts +1 -0
  171. package/src/web-search/parse.ts +44 -4
  172. package/gui/dist/assets/App-CitvEefy.js +0 -59
  173. package/gui/dist/assets/Tray-CeKVWQyB.js +0 -1
  174. package/gui/dist/assets/brand-mark-M92UnxX2.js +0 -1
  175. package/gui/dist/assets/index-BP47do6-.js +0 -94
  176. package/gui/dist/assets/index-DmDooSAG.css +0 -2
  177. package/gui/dist/classic/assets/index-CfGqHooN.js +0 -94
  178. package/gui/dist/classic/assets/quota-summary-R-ih7OlS.js +0 -1
@@ -0,0 +1,41 @@
1
+ import type { OcxConfig } from "../types";
2
+ import { isCodexAccountPaused } from "./account-pause";
3
+ import { isCodexAccountGenerationLive } from "./account-store";
4
+ import { MAIN_CODEX_ACCOUNT_ID } from "./account-id";
5
+ import { PERMANENT_PAUSE_REASONS, type ResumeHealthRefusal } from "../oauth/account-resume-health";
6
+ import type { PoolQuotaResult } from "./auth-api/pool-quota-probe";
7
+
8
+ export type CodexResumeHealthVerdict = { ok: true; pauseRevision: string | undefined } | { ok: false; reason: ResumeHealthRefusal };
9
+
10
+ /** An explicit refresh probe of one pool account: forced, operator-initiated, never a cached read. */
11
+ export type CodexHealthProbe = (accountId: string, plan: string | undefined) => Promise<PoolQuotaResult>;
12
+
13
+ const defaultProbe: CodexHealthProbe = async (accountId, plan) => {
14
+ const { fetchPoolAccountQuota } = await import("./auth-api/pool-quota-probe");
15
+ return await fetchPoolAccountQuota(accountId, true, plan, undefined, false, undefined, undefined, true);
16
+ };
17
+
18
+ /**
19
+ * Health gate for `ocx account resume openai <id> --if-healthy` (#8398): the same rules as the OAuth
20
+ * gate, read through the pool's own WHAM quota probe, which may refresh a pool credential. Healthy
21
+ * means a fresh quota read by a credential generation that is still live; an exhausted window is
22
+ * still healthy, because routing already handles a spent window. Null when the account is not paused.
23
+ */
24
+ export async function checkCodexResumeHealth(config: OcxConfig, accountId: string, probe: CodexHealthProbe = defaultProbe): Promise<CodexResumeHealthVerdict | null> {
25
+ if (!isCodexAccountPaused(config, accountId)) return null;
26
+ const state = config.codexAccountPauseState?.[accountId];
27
+ if (state?.details && PERMANENT_PAUSE_REASONS.has(state.details.reason)) return { ok: false, reason: "pause_not_remote_clearable" };
28
+ if (accountId === MAIN_CODEX_ACCOUNT_ID) return { ok: false, reason: "health_check_unsupported" };
29
+ const pauseRevision = state?.revision;
30
+ const plan = (config.codexAccounts ?? []).find(account => account.id === accountId && !account.isMain)?.plan;
31
+ let result: PoolQuotaResult | undefined;
32
+ try { result = await probe(accountId, plan); } catch { result = undefined; }
33
+ if (!result) return { ok: false, reason: "usage_read_failed" };
34
+ if (result.needsReauth) return { ok: false, reason: "needs_reauth" };
35
+ const generation = result.freshCredentialGeneration;
36
+ if (!result.freshQuota || generation === undefined || !isCodexAccountGenerationLive(accountId, generation)) return { ok: false, reason: "usage_read_failed" };
37
+ if (!isCodexAccountPaused(config, accountId) || config.codexAccountPauseState?.[accountId]?.revision !== pauseRevision) {
38
+ return { ok: false, reason: "account_changed" };
39
+ }
40
+ return { ok: true, pauseRevision };
41
+ }
@@ -1,4 +1,5 @@
1
1
  import { withCodexAccountLogLabel } from "../account-label";
2
+ import { isCodexAccountPaused, setCodexAccountPaused } from "../account-pause";
2
3
  import { getCodexAccountCredential, markCodexAccountValidated, readCodexAccountRecord, saveCodexAccountCredential, CodexCredentialRefreshLockTimeoutError, CodexCredentialRefreshBusyError, CodexCredentialRefreshStaleError } from "../account-store";
3
4
  import { clearAccountQuota, isCodexQuotaExhausted, parseUsageQuota, poolWhamPolicyObservation, setAccountQuotaFromParsed } from "../quota";
4
5
  import type { StoredAccountQuota, WhamUsageResponse } from "../quota";
@@ -404,6 +405,11 @@ export async function handleCodexAuthLoginStart(req: Request, config: OcxConfig,
404
405
  isMain: false,
405
406
  }, accounts);
406
407
  latestConfig.codexAccounts = accounts;
408
+ // A successful login replaced the credential an automatic pause described (#8398);
409
+ // an operator pause carries no details and stays.
410
+ if (isCodexAccountPaused(latestConfig, accountId) && latestConfig.codexAccountPauseState?.[accountId]?.details) {
411
+ setCodexAccountPaused(latestConfig, accountId, false);
412
+ }
407
413
  saveRuntimeConfig(config, latestConfig);
408
414
  } else {
409
415
  const addedAccount = withCodexAccountLogLabel({ id: accountId, email, plan, isMain: false }, accounts);
@@ -28,6 +28,7 @@ import { getRuntimeConfig, saveRuntimeConfig, configuredPoolAccount } from "./ru
28
28
  import { captureConfigTopLevelRollback } from "../../config/rebase-provenance";
29
29
  import { getEffectiveCodexAutoSwitchThreshold, isCodexAccountAutoSwitchThresholdKey, parseCodexAutoSwitchThreshold, setCodexAccountAutoSwitchThresholdOverride } from "../account-auto-switch";
30
30
  import { withCodexAccountPauseGroup } from "./account-pause-group";
31
+ import { PERMANENT_PAUSE_REASONS } from "../../oauth/account-resume-health";
31
32
 
32
33
  export async function handleCodexAuthAPI(
33
34
  req: Request,
@@ -99,20 +100,52 @@ export async function handleCodexAuthAPI(
99
100
  }
100
101
 
101
102
  if (url.pathname === "/api/codex-auth/accounts/pause" && req.method === "PUT") {
102
- const body = await req.json().catch(() => ({})) as { id?: unknown; paused?: unknown };
103
+ const body = await req.json().catch(() => ({})) as { id?: unknown; paused?: unknown; ifHealthy?: unknown };
103
104
  const id = typeof body.id === "string" ? body.id.trim() : "";
104
105
  if (id !== MAIN_CODEX_ACCOUNT_ID && !isValidCodexAccountId(id)) {
105
106
  return jsonResponse({ error: "Invalid account id format" }, 400);
106
107
  }
107
108
  if (typeof body.paused !== "boolean") return jsonResponse({ error: "paused must be a boolean" }, 400);
109
+ if (body.ifHealthy !== undefined && typeof body.ifHealthy !== "boolean") return jsonResponse({ error: "ifHealthy must be a boolean" }, 400);
110
+ if (body.ifHealthy === true && body.paused !== false) return jsonResponse({ error: "ifHealthy applies only to a resume (paused: false)" }, 400);
108
111
 
109
- const runtimeConfig = getRuntimeConfig(config);
112
+ let runtimeConfig = getRuntimeConfig(config);
110
113
  const exists = id === MAIN_CODEX_ACCOUNT_ID
111
114
  || (runtimeConfig.codexAccounts ?? []).some(account => isSelectableCodexPoolAccount(account) && account.id === id);
112
115
  if (!exists) return jsonResponse({ error: "Account not found" }, 404);
116
+ let healthPauseRevision: string | undefined;
117
+ if (body.ifHealthy === true) {
118
+ // Explicit resume gated on a forced pool quota read (#8398); the read can take a while, so
119
+ // the pause is committed against the configuration as it is after the read.
120
+ const { checkCodexResumeHealth } = await import("../account-resume-health");
121
+ const verdict = await checkCodexResumeHealth(runtimeConfig, id);
122
+ runtimeConfig = getRuntimeConfig(config);
123
+ const refusal = verdict && !verdict.ok ? verdict.reason
124
+ : verdict && (!isCodexAccountPaused(runtimeConfig, id) || runtimeConfig.codexAccountPauseState?.[id]?.revision !== verdict.pauseRevision)
125
+ ? "account_changed" : undefined;
126
+ if (refusal) return jsonResponse({ error: `account was not resumed: ${refusal}`, code: "resume_refused", reason: refusal, id }, 409);
127
+ // Not paused when checked: a no-op that never enters the pause group.
128
+ if (!verdict) return jsonResponse({ ok: true, id, paused: false, unchanged: true, activeCodexAccountId: getEffectiveActiveCodexAccountId(runtimeConfig) ?? null });
129
+ if (verdict.ok) healthPauseRevision = verdict.pauseRevision;
130
+ }
113
131
 
114
132
  const paused = body.paused;
115
133
  return withCodexAccountPauseGroup(runtimeConfig, id, accountIds => {
134
+ if (body.ifHealthy === true) {
135
+ // Recheck right before the write: the pause-group claim above can wait, and an operator
136
+ // re-pause meanwhile must not be overwritten by this health-gated resume.
137
+ runtimeConfig = getRuntimeConfig(config);
138
+ if (!isCodexAccountPaused(runtimeConfig, id) || runtimeConfig.codexAccountPauseState?.[id]?.revision !== healthPauseRevision) {
139
+ return jsonResponse({ error: "account was not resumed: account_changed", code: "resume_refused", reason: "account_changed", id }, 409);
140
+ }
141
+ }
142
+ // A linked account resumes with the named one, so a permanent reason on any of them refuses (#8398).
143
+ if (body.ifHealthy === true && accountIds.some(accountId => {
144
+ const reason = runtimeConfig.codexAccountPauseState?.[accountId]?.details?.reason;
145
+ return reason !== undefined && PERMANENT_PAUSE_REASONS.has(reason);
146
+ })) {
147
+ return jsonResponse({ error: "account was not resumed: pause_not_remote_clearable", code: "resume_refused", reason: "pause_not_remote_clearable", id }, 409);
148
+ }
116
149
  // Publish every exclusion before reconciling: a duplicate must never become the fallback.
117
150
  for (const accountId of accountIds) setCodexAccountPaused(runtimeConfig, accountId, paused);
118
151
  if (paused) {
@@ -414,6 +414,7 @@ export function captureProviderGather(
414
414
  ...(resolved.spec ? { spec: resolved.spec } : {}),
415
415
  maxResponseBytes: resolved.maxResponseBytes,
416
416
  maxModels: resolved.maxModels,
417
+ ...(resolved.skipInvalidRows ? { skipInvalidRows: true as const } : {}),
417
418
  });
418
419
  const trustedOpenAiApi = captureTrustedOpenAiApiPolicy(name, registryTransportMatch);
419
420
  const policy = detachedFrozen({
@@ -431,6 +432,7 @@ export function captureProviderGather(
431
432
  preferFirst: capturedField(discovery.spec, "preferFirst"),
432
433
  maxResponseBytes: discovery.maxResponseBytes,
433
434
  maxModels: discovery.maxModels,
435
+ skipInvalidRows: discovery.skipInvalidRows === true,
434
436
  trustedOpenAiApi,
435
437
  });
436
438
  const effectiveAlias = effectiveProviderAliasDecision(name, configured, config);
@@ -9,6 +9,7 @@ import { createHash, createHmac, randomBytes } from "node:crypto";
9
9
  import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
10
10
  import { delimiter, dirname, join, resolve } from "node:path";
11
11
  import { atomicWriteFile, expandUserPath, getConfigDir, websocketsEnabled } from "../../config";
12
+ import { isProviderApiKeyPaused } from "../../providers/api-key-pause";
12
13
  import { resolveProviderApiKey } from "../../providers/key-store";
13
14
  import { captureOAuthAccountSelection, credentialGeneration, getAccountCredentialWithStatus, getAccountSet } from "../../oauth/store";
14
15
  import { readKiroAccountModels, kiroObservedContextWindow } from "../../providers/kiro-model-catalog";
@@ -89,7 +90,7 @@ import {
89
90
  providerRedirectError,
90
91
  } from "../../lib/provider-outbound";
91
92
  import { redactSecretString } from "../../lib/redact";
92
- import { invalidModelDiscoveryHint } from "../../providers/model-discovery-diagnostic";
93
+ import { invalidModelDiscoveryHint, shouldWarnSkippedModelRows } from "../../providers/model-discovery-diagnostic";
93
94
  import {
94
95
  extractProviderModelItems,
95
96
  isRegistryModelDiscoveryUrl,
@@ -292,6 +293,9 @@ export async function fetchProviderModelsWithAuth(
292
293
  : { apiKey: await resolveModelsAuthToken(name, prov), observed: false }
293
294
  : resolveAuth.resolve(name, prov));
294
295
  const apiKey = auth.apiKey;
296
+ if ((prov.authMode === "oauth" && !apiKey) || isProviderApiKeyPaused(prov)) {
297
+ return observed(configured, "degraded");
298
+ }
295
299
  if (name === "github-copilot" && apiKey) {
296
300
  const transport = resolveGithubCopilotTransport({ ...prov, apiKey }, prov.authMode === "oauth"
297
301
  ? resolveCopilotApiBaseUrl(auth.oauthApiBaseUrl) : undefined);
@@ -649,12 +653,6 @@ export async function fetchProviderModelsWithAuth(
649
653
  "degraded",
650
654
  );
651
655
  }
652
- if (prov.authMode === "oauth" && !apiKey) {
653
- // No usable token (logged out, or account marked needsReauth). Still surface the
654
- // configured static catalog so the GUI Models tab / rail counts are not empty —
655
- // matching Cursor's !apiKey → configured degradation and fetch-failure fallback.
656
- return observed(configured, "degraded");
657
- }
658
656
  const cloudCodeAssist = effectiveGoogleMode(name, prov) === "cloud-code-assist";
659
657
  const project = prov.project ?? auth.oauthProjectId;
660
658
  if (cloudCodeAssist && !project) return observed(configured, "degraded");
@@ -864,11 +862,18 @@ export async function fetchProviderModelsWithAuth(
864
862
  };
865
863
  if (shouldLog) {
866
864
  console.warn(
867
- `[opencodex] Provider model discovery for "${name}" ${diagnostic[extracted.reason]} [status=${res.status}, contentType=${contentType}, urlClass=${urlClass}, fallback=${fallback}]${extracted.reason === "invalid_shape" ? invalidModelDiscoveryHint("diagnostic" in extracted ? extracted.diagnostic : undefined) : "."}`,
865
+ `[opencodex] Provider model discovery for "${name}" ${diagnostic[extracted.reason]} [status=${res.status}, contentType=${contentType}, urlClass=${urlClass}, fallback=${fallback}]${extracted.reason === "invalid_shape" ? invalidModelDiscoveryHint("diagnostic" in extracted ? extracted.diagnostic : undefined, discovery.skipInvalidRows === true) : "."}`,
868
866
  );
869
867
  }
870
868
  return observed(models, "degraded");
871
869
  }
870
+ // The operator opted into skipping invalid rows (#7910): say how many, once, never which.
871
+ const skippedInvalidRows = "skippedInvalidRows" in extracted ? extracted.skippedInvalidRows ?? 0 : 0;
872
+ if (shouldWarnSkippedModelRows(name, skippedInvalidRows, extracted.rawCount)) {
873
+ console.warn(
874
+ `[opencodex] Provider model discovery for "${name}" skipped ${skippedInvalidRows} invalid of ${extracted.rawCount} rows (modelDiscovery.skipInvalidRows) [status=${res.status}, urlClass=${urlClass}].`,
875
+ );
876
+ }
872
877
  const items = extracted.items;
873
878
  // Ollama Cloud enrichment: /v1/models carries no per-model context or capability metadata,
874
879
  // so a newly announced id would otherwise publish generic defaults. /api/show fills that
@@ -451,6 +451,8 @@ export interface CatalogProviderDiscoveryPolicySnapshot {
451
451
  readonly preferFirst: CatalogDiscoveryPolicyField<readonly ProviderModelDiscoveryPredicate[] | undefined>;
452
452
  readonly maxResponseBytes: number;
453
453
  readonly maxModels: number;
454
+ /** Operator opt-in `modelDiscovery.skipInvalidRows` (#7910). */
455
+ readonly skipInvalidRows: boolean;
454
456
  readonly trustedOpenAiApi: CatalogTrustedOpenAiApiPolicySnapshot;
455
457
  }
456
458
 
@@ -266,6 +266,78 @@ function shortResetHasElapsed(resetAt: number | undefined, now: number): boolean
266
266
  return resetAtToMs(resetAt) <= now;
267
267
  }
268
268
 
269
+ /**
270
+ * Whether the account's reset tickets went DOWN, which means one was just redeemed.
271
+ *
272
+ * A manual reset zeroes the current window's usage without ending it: the deadline moves further
273
+ * out, but the account keeps spending in what is effectively a fresh window. The percentage we
274
+ * cached before the redemption measures the window that was thrown away, so it must not be
275
+ * carried into the reset one — the user has, by definition, just bought themselves an empty
276
+ * window, and reporting the old 98% keeps them locked out of the quota they paid to recover.
277
+ *
278
+ * Only a DECREASE counts. Upstream periodically grants new tickets (`available_count` rising),
279
+ * which says nothing about current usage and must never invalidate a reading.
280
+ *
281
+ * This is the one signal that catches a redemption made outside this process — in the ChatGPT web
282
+ * UI, or on another machine. The header stream carries no reset-ticket field at all, so it can
283
+ * only ever be learned from the `/wham/usage` payload, and the hard lock delays that probe by
284
+ * minutes-to-an-hour. Keeping the judgement data-driven and here means the moment any observation
285
+ * does carry the new count, the stale percentage is retired instead of replayed.
286
+ */
287
+ function resetTicketWasRedeemed(
288
+ incoming: Omit<StoredAccountQuota, "updatedAt">,
289
+ existing: StoredAccountQuota | undefined,
290
+ ): boolean {
291
+ const previousCount = existing?.resetCredits;
292
+ const nextCount = incoming.resetCredits;
293
+ if (typeof previousCount !== "number" || !Number.isFinite(previousCount)) return false;
294
+ if (typeof nextCount !== "number" || !Number.isFinite(nextCount)) return false;
295
+ return nextCount < previousCount;
296
+ }
297
+
298
+ /**
299
+ * Whether the stored weekly reading belongs to a window that is demonstrably over.
300
+ *
301
+ * This is the weekly counterpart of `shortResetHasElapsed`. The short (5h) branch has always
302
+ * expired a carried tuple whose reset had passed; the weekly branch never did, so a stale
303
+ * weekly percentage could outlive its own deadline indefinitely as long as observations omitted
304
+ * the weekly header. Either of these retires the reading (an observation that carries the weekly
305
+ * window itself, including a later deadline, already replaces the tuple before this is consulted):
306
+ *
307
+ * 1. The stored deadline has already elapsed. Usage only accumulates inside an open window, so a
308
+ * percentage pinned to a closed one is history, not current state. This is exactly the rule
309
+ * `shortResetHasElapsed` applies to the 5h tuple and it is what lets a stuck account re-measure.
310
+ * 2. A reset ticket was redeemed (`resetTicketWasRedeemed`) — the window's usage was zeroed on
311
+ * purpose, so the pre-redemption percentage describes a window nobody is spending in any more.
312
+ *
313
+ * Why this matters beyond a cosmetic bar: this display/rotation snapshot feeds quota exhaustion and
314
+ * the pool rotation score. A percentage that can never expire keeps a recovered account excluded and
315
+ * its card at "usage limit reached" while upstream shows a nearly-empty window. The main-account hard
316
+ * lock is unaffected: it reads the separate policy snapshot, which these signals never touch.
317
+ *
318
+ * Policy callers must NOT use these signals. The hard lock's contract is that only an explicit
319
+ * observation that replaces a blocking reading may release it — "a predicted reset is not
320
+ * recovery evidence". There, a clock elapsing, an advanced deadline, and a redeemed ticket are
321
+ * all non-events; the arriving low percentage is what releases it.
322
+ *
323
+ * Observed live, twice:
324
+ * - Upstream had rolled the window over while every response carried only credits headers, so the
325
+ * old 98% was replayed for ~20h against a true 4%.
326
+ * - The user then redeemed a reset ticket in the web UI. Upstream reported 0% used with a deadline
327
+ * 4.84 days further out, but the cache still said 98%, so the hard lock kept refusing to send.
328
+ * Both times only manual cache surgery recovered the account.
329
+ */
330
+ function weeklyWindowRolledOver(
331
+ incoming: Omit<StoredAccountQuota, "updatedAt">,
332
+ existing: StoredAccountQuota | undefined,
333
+ now: number,
334
+ ): boolean {
335
+ if (resetTicketWasRedeemed(incoming, existing)) return true;
336
+ const previousReset = existing?.weeklyResetAt;
337
+ if (typeof previousReset !== "number" || !Number.isFinite(previousReset) || previousReset <= 0) return false;
338
+ return resetAtToMs(previousReset) <= now;
339
+ }
340
+
269
341
  /** Display/rotation carry expires; a reset clock cannot retract blocking hard-lock evidence. */
270
342
  function assignCarriedShort(
271
343
  next: StoredAccountQuota,
@@ -409,8 +481,14 @@ function mergeAccountQuota(
409
481
  }
410
482
 
411
483
  if (creditsOnly) {
412
- if (existing?.weeklyPercent !== undefined) next.weeklyPercent = existing.weeklyPercent;
413
- if (existing?.weeklyResetAt !== undefined) next.weeklyResetAt = existing.weeklyResetAt;
484
+ // A credits-only refresh says nothing about usage windows, so it normally carries the known
485
+ // ones. The exception is a weekly window upstream has already rolled over: replaying that
486
+ // percentage would report the previous window's usage as the current one, and a
487
+ // credits-only-only stream would keep doing so indefinitely. Policy evidence is exempt for
488
+ // the same reason as below: only an explicit lower observation may release the hard lock.
489
+ const weeklyRolledOver = !policyEvidence && weeklyWindowRolledOver(quota, existing, updatedAt);
490
+ if (existing?.weeklyPercent !== undefined && !weeklyRolledOver) next.weeklyPercent = existing.weeklyPercent;
491
+ if (existing?.weeklyResetAt !== undefined && !weeklyRolledOver) next.weeklyResetAt = existing.weeklyResetAt;
414
492
  if (existing?.monthlyPercent !== undefined) next.monthlyPercent = existing.monthlyPercent;
415
493
  if (existing?.monthlyResetAt !== undefined) next.monthlyResetAt = existing.monthlyResetAt;
416
494
  if (existing?.monthlyIsPrimaryWindow === true) next.monthlyIsPrimaryWindow = true;
@@ -422,9 +500,19 @@ function mergeAccountQuota(
422
500
  }
423
501
 
424
502
  const existingWeeklyPercent = existing?.weeklyPercent;
503
+ // The one thing a stale reading must never survive: proof that its window is over.
504
+ // Display only. Policy evidence obeys a stricter contract — see preserveKnownWeekly below.
505
+ const weeklyRolledOver = weeklyWindowRolledOver(quota, existing, updatedAt);
425
506
  // A reset-only weekly observation is not a lower reading. Policy mode keeps a blocking weekly
426
507
  // tuple whole, exactly like preserveKnownShort; a governing monthly-primary observation still
427
508
  // replaces it, so that release path does not depend on this guard.
509
+ //
510
+ // This guard is deliberately NOT relaxed for a rolled-over or advanced window. Policy evidence
511
+ // is the hard lock's only input, and "a predicted reset is not recovery evidence" is a pinned
512
+ // contract: `main-account-hard-lock-policy` asserts that advancing `weeklyResetAt` from now+60s
513
+ // to now+120s alone must NOT clear a retained 99. Releasing the lock has to stay a deliberate,
514
+ // explicitly-observed decision, so the policy path is left exactly as upstream wrote it. The
515
+ // display path below is where a dead reading is allowed to expire.
428
516
  const preserveKnownWeekly = policyEvidence
429
517
  && quota.weeklyPercent === undefined
430
518
  && quota.monthlyIsPrimaryWindow !== true
@@ -438,7 +526,17 @@ function mergeAccountQuota(
438
526
  && (!policyEvidence || quota.monthlyIsPrimaryWindow === true)) {
439
527
  // Legacy monthly-only clearing is unchanged (#382). Policy needs a governing
440
528
  // monthly-primary observation: a tertiary-only header cannot retract weekly99.
441
- } else if (existing?.weeklyPercent !== undefined) {
529
+ } else if (existing?.weeklyPercent !== undefined
530
+ && (policyEvidence || !weeklyRolledOver)) {
531
+ // Carry-forward is for windows whose deadline upstream has not moved. Once it has, the
532
+ // percentage we hold belongs to the closed window; re-publishing it would hand the next
533
+ // window a usage figure it never earned. Leaving the field unset is correct here — the
534
+ // caller treats "unknown" as "needs a fresh measurement", which is exactly the state that
535
+ // lets quota auto-refresh recover.
536
+ //
537
+ // Policy mode is exempt and always carries: it must only ever change through an explicit
538
+ // observation, so it never expires on its own clock. That is the pinned contract above, and
539
+ // admitting either signal here re-opens the "predicted reset releases the lock" hole.
442
540
  next.weeklyPercent = existing.weeklyPercent;
443
541
  if (existing.weeklyResetAt !== undefined) next.weeklyResetAt = existing.weeklyResetAt;
444
542
  }
@@ -685,23 +783,30 @@ export function updateAccountQuota(
685
783
  if (nextWeekly === undefined && nextMonthly === undefined && resetCredits === undefined) return;
686
784
  hydrateAccountQuotasFromDisk();
687
785
  const existing = accountQuota.get(accountId);
786
+ // The WHAM/usage path carries the same staleness hazard as `mergeAccountQuota`: pre-seeding
787
+ // from `existing` and only overwriting when a new value arrives replays an expired weekly
788
+ // reading forever, because a caller that omits the weekly window never clears it. That is the
789
+ // second half of the "weekly bar stuck at 98%" bug - the header path is fixed above, and
790
+ // without this the WHAM path would keep the stale value alive on its own.
791
+ const now = Date.now();
792
+ const weeklyExpired = weeklyWindowRolledOver({}, existing, now);
688
793
 
689
794
  const quota: StoredAccountQuota = {
690
- ...(existing?.weeklyPercent !== undefined ? { weeklyPercent: existing.weeklyPercent } : {}),
795
+ ...(existing?.weeklyPercent !== undefined && !weeklyExpired ? { weeklyPercent: existing.weeklyPercent } : {}),
691
796
  ...(existing?.monthlyPercent !== undefined ? { monthlyPercent: existing.monthlyPercent } : {}),
692
797
  // Carry provenance with the value it describes. Dropping it here would downgrade a proven
693
798
  // explicit-primary reading to "unproven" on the next unrelated weekly update.
694
799
  ...(existing?.monthlyPercent !== undefined && existing.monthlyIsPrimaryWindow === true
695
800
  ? { monthlyIsPrimaryWindow: true }
696
801
  : {}),
697
- ...(existing?.weeklyResetAt !== undefined ? { weeklyResetAt: existing.weeklyResetAt } : {}),
802
+ ...(existing?.weeklyResetAt !== undefined && !weeklyExpired ? { weeklyResetAt: existing.weeklyResetAt } : {}),
698
803
  ...(existing?.monthlyResetAt !== undefined ? { monthlyResetAt: existing.monthlyResetAt } : {}),
699
804
  ...(existing?.customWindows !== undefined ? { customWindows: existing.customWindows } : {}),
700
805
  ...(existing?.resetCredits !== undefined ? { resetCredits: existing.resetCredits } : {}),
701
806
  ...(existing?.credits !== undefined ? { credits: existing.credits } : {}),
702
807
  ...(existing?.credits === null && existing.creditObservationUnavailable === true
703
808
  ? { creditObservationUnavailable: true as const } : {}),
704
- updatedAt: Date.now(),
809
+ updatedAt: now,
705
810
  };
706
811
  assignCarriedShort(quota, existing, quota.updatedAt);
707
812
 
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Disk-backed cooldown map for combo targets.
3
+ *
4
+ * A cooldown that lives only in memory is forgotten on every restart, so a freshly restarted proxy
5
+ * re-offers a target that upstream said to leave alone until its reset. This Map subclass loads
6
+ * `<config dir>/combo-cooldowns.json` on first use and writes back what this process changed.
7
+ * Expiry is stored as an absolute epoch, so reset-aware cooldowns stay correct across restarts.
8
+ * Pattern adopted from Hermes-agent (MIT, NousResearch): rate-limit state persisted per
9
+ * (provider, model) so a restart does not retry a known-exhausted route.
10
+ *
11
+ * Several proxies can share one home, so a write never replaces the file wholesale:
12
+ * - `set()` marks its key dirty. A flush re-reads the file under the config mutation lock and
13
+ * overlays only dirty keys, keeping the later of the two expiries, so it never shortens a
14
+ * cooldown another process wrote and never rewrites a row it did not touch.
15
+ * - `dropLocal()` (and the Map `delete()`/`clear()` it backs) forgets a row in memory only. Expiry
16
+ * checks, sweeps and the revision-guarded probe lift use it, so an expired local copy can never
17
+ * erase a row another process has since extended.
18
+ * - `clearPersisted()` / `clearAllPersisted()` are the only deletes written to disk: they record
19
+ * user-requested clears (combo save, rename, delete). Clearing everything is a global reset.
20
+ * A busy lock or I/O failure keeps the pending state and retries with bounded backoff.
21
+ *
22
+ * Loading: once per config dir, on first use. Rows already in memory win; a file row loads only
23
+ * while unexpired and gets a fresh revision from the caller's counter (revisions are never stored).
24
+ * A running process does not re-read other processes' rows later.
25
+ */
26
+ import { mkdirSync, readFileSync } from "node:fs";
27
+ import { join } from "node:path";
28
+ import { atomicWriteFile } from "../config/atomic-write";
29
+ import { withConfigMutationLockSync } from "../config/mutation-lock";
30
+ import { getConfigDir } from "../config/paths";
31
+
32
+ export interface PersistableCooldown { cooldownUntil: number; revision: number; status?: number }
33
+ type StoredRow = { cooldownUntil: number; status?: number };
34
+
35
+ const FILE = "combo-cooldowns.json";
36
+ const FLUSH_DELAY_MS = 250;
37
+ const MAX_FLUSH_DELAY_MS = 4_000;
38
+ const MAX_LOAD_ATTEMPTS = 3;
39
+ const SHUTDOWN_ATTEMPTS = 5;
40
+ const SHUTDOWN_RETRY_MS = 200;
41
+
42
+ function errorCode(error: unknown): string | undefined {
43
+ return error && typeof error === "object" && "code" in error ? String((error as { code?: unknown }).code) : undefined;
44
+ }
45
+
46
+ /** Valid rows of the file. Missing file or unparsable JSON is empty; other read errors throw. */
47
+ function readStoredRows(path: string): Record<string, StoredRow> {
48
+ let text: string;
49
+ try {
50
+ text = readFileSync(path, "utf8");
51
+ } catch (error) {
52
+ if (errorCode(error) === "ENOENT") return {};
53
+ throw error;
54
+ }
55
+ let parsed: unknown;
56
+ try { parsed = JSON.parse(text); } catch { return {}; }
57
+ const rows: Record<string, StoredRow> = {};
58
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return rows;
59
+ for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {
60
+ const row = value as { cooldownUntil?: unknown; status?: unknown } | null;
61
+ if (typeof row?.cooldownUntil !== "number" || !Number.isFinite(row.cooldownUntil)) continue;
62
+ rows[key] = { cooldownUntil: row.cooldownUntil, ...(typeof row.status === "number" ? { status: row.status } : {}) };
63
+ }
64
+ return rows;
65
+ }
66
+
67
+ export class PersistedCooldownMap<V extends PersistableCooldown> extends Map<string, V> {
68
+ private loadedFor: string | undefined;
69
+ private failedLoadDir: string | undefined;
70
+ private failedLoads = 0;
71
+ private timer: ReturnType<typeof setTimeout> | undefined;
72
+ private delayMs = FLUSH_DELAY_MS;
73
+ private scheduledDir: string | undefined;
74
+ private readonly dirty = new Set<string>();
75
+ private readonly tombstones = new Set<string>();
76
+ private clearAll = false;
77
+ private readonly nextRevision: () => number;
78
+
79
+ constructor(nextRevision: () => number) {
80
+ super();
81
+ this.nextRevision = nextRevision;
82
+ }
83
+
84
+ private ensureLoaded(): void {
85
+ const dir = getConfigDir();
86
+ if (this.loadedFor === dir) return;
87
+ if (this.failedLoadDir === dir && this.failedLoads >= MAX_LOAD_ATTEMPTS) return;
88
+ let rows: Record<string, StoredRow>;
89
+ try {
90
+ rows = readStoredRows(join(dir, FILE));
91
+ } catch {
92
+ // A transient read failure (permissions, a locked file on Windows) retries on a later access.
93
+ if (this.failedLoadDir !== dir) { this.failedLoadDir = dir; this.failedLoads = 0; }
94
+ this.failedLoads += 1;
95
+ return;
96
+ }
97
+ this.loadedFor = dir;
98
+ const now = Date.now();
99
+ for (const [key, row] of Object.entries(rows)) {
100
+ if (row.cooldownUntil <= now || super.has(key)) continue;
101
+ super.set(key, { cooldownUntil: row.cooldownUntil, revision: this.nextRevision(), ...(row.status !== undefined ? { status: row.status } : {}) } as V);
102
+ }
103
+ }
104
+
105
+ private pending(): boolean {
106
+ return this.clearAll || this.dirty.size > 0 || this.tombstones.size > 0;
107
+ }
108
+
109
+ private schedule(): void {
110
+ this.scheduledDir ??= getConfigDir();
111
+ if (this.timer) return;
112
+ this.timer = setTimeout(() => { this.timer = undefined; this.flush(); }, this.delayMs);
113
+ (this.timer as { unref?: () => void }).unref?.();
114
+ }
115
+
116
+ /** Write pending changes now. Returns false, keeping them and rescheduling, if the write could not run. */
117
+ flush(): boolean {
118
+ if (!this.pending()) return true;
119
+ const dir = this.scheduledDir ?? getConfigDir();
120
+ const path = join(dir, FILE);
121
+ try {
122
+ withConfigMutationLockSync(() => {
123
+ const file = readStoredRows(path);
124
+ const now = Date.now();
125
+ const out: Record<string, StoredRow> = {};
126
+ if (!this.clearAll) {
127
+ for (const [key, row] of Object.entries(file)) {
128
+ if (row.cooldownUntil > now && !this.tombstones.has(key)) out[key] = row;
129
+ }
130
+ }
131
+ for (const key of this.dirty) {
132
+ const own = super.get(key);
133
+ if (!own || own.cooldownUntil <= now) continue;
134
+ const other = out[key];
135
+ out[key] = other && other.cooldownUntil > own.cooldownUntil
136
+ ? other
137
+ : { cooldownUntil: own.cooldownUntil, ...(own.status !== undefined ? { status: own.status } : {}) };
138
+ }
139
+ mkdirSync(dir, { recursive: true });
140
+ atomicWriteFile(path, JSON.stringify(out));
141
+ }, dir);
142
+ } catch {
143
+ // Lock held by another process (busy_timeout 0) or an I/O error: keep everything and retry.
144
+ this.delayMs = Math.min(this.delayMs * 2, MAX_FLUSH_DELAY_MS);
145
+ if (!this.timer) this.schedule();
146
+ return false;
147
+ }
148
+ this.dirty.clear();
149
+ this.tombstones.clear();
150
+ this.clearAll = false;
151
+ this.scheduledDir = undefined;
152
+ this.delayMs = FLUSH_DELAY_MS;
153
+ return true;
154
+ }
155
+
156
+ /** Bounded final write for process shutdown; never blocks for more than about a second. */
157
+ flushForShutdown(): void {
158
+ if (this.timer) { clearTimeout(this.timer); this.timer = undefined; }
159
+ for (let attempt = 0; attempt < SHUTDOWN_ATTEMPTS; attempt += 1) {
160
+ if (this.flush()) break;
161
+ if (this.timer) { clearTimeout(this.timer); this.timer = undefined; }
162
+ if (attempt < SHUTDOWN_ATTEMPTS - 1) Bun.sleepSync(SHUTDOWN_RETRY_MS);
163
+ }
164
+ if (this.timer) { clearTimeout(this.timer); this.timer = undefined; }
165
+ }
166
+
167
+ /** Forget a row in memory only (expiry, sweep, probe lift); nothing is written. */
168
+ dropLocal(key: string): boolean { this.ensureLoaded(); return super.delete(key); }
169
+
170
+ /** A user-requested clear of these keys, written to disk as deletes. */
171
+ clearPersisted(keys: Iterable<string>): void {
172
+ this.ensureLoaded();
173
+ for (const key of keys) {
174
+ super.delete(key);
175
+ this.dirty.delete(key);
176
+ this.tombstones.add(key);
177
+ }
178
+ this.schedule();
179
+ }
180
+
181
+ /** A user-requested clear of every row, written to disk as a global reset. */
182
+ clearAllPersisted(): void {
183
+ this.ensureLoaded();
184
+ super.clear();
185
+ this.dirty.clear();
186
+ this.tombstones.clear();
187
+ this.clearAll = true;
188
+ this.schedule();
189
+ }
190
+
191
+ override get(key: string): V | undefined { this.ensureLoaded(); return super.get(key); }
192
+ override has(key: string): boolean { this.ensureLoaded(); return super.has(key); }
193
+ override get size(): number { this.ensureLoaded(); return super.size; }
194
+ override keys(): MapIterator<string> { this.ensureLoaded(); return super.keys(); }
195
+ override values(): MapIterator<V> { this.ensureLoaded(); return super.values(); }
196
+ override entries(): MapIterator<[string, V]> { this.ensureLoaded(); return super.entries(); }
197
+ override [Symbol.iterator](): MapIterator<[string, V]> { this.ensureLoaded(); return super[Symbol.iterator](); }
198
+ override set(key: string, value: V): this {
199
+ this.ensureLoaded();
200
+ super.set(key, value);
201
+ this.tombstones.delete(key);
202
+ this.dirty.add(key);
203
+ this.schedule();
204
+ return this;
205
+ }
206
+ override delete(key: string): boolean { return this.dropLocal(key); }
207
+ override clear(): void { this.ensureLoaded(); super.clear(); }
208
+ }