@bitkyc08/opencodex 2.91.0 → 2.93.0-preview.20261027
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/bin/ocx.mjs +47 -8
- package/gui/dist/assets/App-CJZoq-uF.js +58 -0
- package/gui/dist/assets/{Tray-BuLy7hL1.js → Tray-BWQPcgZn.js} +1 -1
- package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
- package/gui/dist/assets/index-Xfct8owH.js +94 -0
- package/gui/dist/assets/quota-summary-DxToX1rV.js +1 -0
- package/gui/dist/index.html +2 -2
- package/gui/dist/provider-icons/workbuddy-color.svg +29 -0
- package/package.json +8 -7
- package/src/adapters/anthropic.ts +28 -5
- package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
- package/src/adapters/coding-agent/profile.ts +54 -16
- package/src/adapters/coding-agent/turn.ts +30 -2
- package/src/adapters/command-code.ts +114 -7
- package/src/adapters/cursor/native-exec-fs.ts +11 -9
- package/src/adapters/devin/live-models.ts +4 -0
- package/src/adapters/google-vertex-endpoint.ts +9 -1
- package/src/adapters/google-vertex-key-project.ts +223 -0
- package/src/adapters/google-wire-compiler.ts +1 -2
- package/src/adapters/google.ts +13 -3
- package/src/adapters/kiro/reasoning.ts +2 -0
- package/src/adapters/kiro-refusal.ts +6 -1
- package/src/adapters/kiro-wire.ts +1 -1
- package/src/adapters/openai-chat/messages.ts +8 -2
- package/src/adapters/openai-chat/passthrough.ts +35 -14
- package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
- package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
- package/src/adapters/openai-chat/required-tool-result.ts +64 -0
- package/src/adapters/openai-chat/tool-name-registry.ts +3 -1
- package/src/adapters/openai-chat.ts +9 -10
- package/src/adapters/openai-responses/passthrough.ts +7 -4
- package/src/adapters/openai-responses/reasoning.ts +13 -0
- package/src/adapters/openai-responses/request-strips.ts +60 -0
- package/src/adapters/qoder/adapter.ts +129 -8
- package/src/adapters/qoder/scaffold-guard.ts +5 -0
- package/src/adapters/reasoning-controls.ts +16 -0
- package/src/adapters/registry.ts +5 -0
- package/src/adapters/tool-call-id.ts +1 -3
- package/src/adapters/workbuddy-schema.ts +61 -0
- package/src/adapters/workbuddy.ts +68 -0
- package/src/bridge/errors.ts +27 -0
- package/src/bridge/response-json.ts +1 -1
- package/src/bridge/sse.ts +1 -1
- package/src/bridge.ts +1 -1
- package/src/chat/inbound.ts +4 -1
- package/src/chat/outbound.ts +20 -6
- package/src/chat/reasoning-details.ts +28 -5
- package/src/claude/desktop-first-party.ts +54 -4
- package/src/claude/desktop-picker.ts +11 -8
- package/src/claude/first-party-settings.ts +3 -1
- package/src/claude/inbound.ts +2 -1
- package/src/claude/intercept/local-ca.ts +2 -1
- package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
- package/src/claude/intercept/picker-ca-startup.ts +3 -1
- package/src/claude/intercept/picker-models.ts +6 -3
- package/src/claude/intercept/picker-runtime.ts +3 -2
- package/src/claude/intercept/runtime.ts +6 -3
- package/src/claude/model-info.ts +31 -8
- package/src/cli/account-api.ts +11 -0
- package/src/cli/capabilities-agents-routing.ts +3 -3
- package/src/cli/capabilities-base.ts +7 -1
- package/src/cli/capabilities-observe-system.ts +10 -0
- package/src/cli/claude-desktop.ts +9 -8
- package/src/cli/claude.ts +3 -2
- package/src/cli/codex-cli-update.ts +8 -0
- package/src/cli/codex-shim-autorestore.ts +9 -0
- package/src/cli/combo-result.ts +13 -0
- package/src/cli/combo-stats.ts +3 -0
- package/src/cli/combo.ts +83 -41
- package/src/cli/cross-home-owner.ts +13 -1
- package/src/cli/dispatch.ts +25 -6
- package/src/cli/ensure-desired-integrations.ts +8 -6
- package/src/cli/export-command.ts +4 -1
- package/src/cli/help.ts +2 -1
- package/src/cli/index.ts +45 -45
- package/src/cli/integration-plan-dto.ts +4 -0
- package/src/cli/launcher-context.ts +49 -2
- package/src/cli/link.ts +45 -32
- package/src/cli/opencode.ts +20 -9
- package/src/cli/provider.ts +2 -1
- package/src/cli/registry.ts +6 -4
- package/src/cli/root.ts +9 -0
- package/src/cli/status.ts +59 -1
- package/src/cli/stop-restore.ts +113 -0
- package/src/cli/sync-expectation.ts +60 -0
- package/src/cli/uninstall-integrations.ts +41 -7
- package/src/cli/usage-compare.ts +68 -12
- package/src/client/connect.ts +40 -3
- package/src/client/link-home.ts +10 -1
- package/src/client/link-ingress.ts +1 -1
- package/src/client/link-readiness.ts +97 -0
- package/src/client/link-relay-transport.ts +79 -11
- package/src/client/link-relay.ts +74 -15
- package/src/client/link-tunnel.ts +45 -18
- package/src/client/machine-api.ts +3 -1
- package/src/client/machine-listener.ts +20 -2
- package/src/client/runtime.ts +20 -2
- package/src/client/sync-expectation.ts +118 -0
- package/src/clients/config-export/agent-clients.ts +96 -0
- package/src/clients/config-export/contracts.ts +25 -7
- package/src/clients/config-export/qoder.ts +38 -23
- package/src/clients/config-export/reasoning-metadata.ts +55 -8
- package/src/clients/config-export.ts +12 -0
- package/src/clients/lazycodex.ts +7 -2
- package/src/clients/reasoning-controls.ts +49 -0
- package/src/codex/account-store.ts +17 -3
- package/src/codex/app-server-restart-service.ts +6 -5
- package/src/codex/auth-api/account-identity.ts +14 -0
- package/src/codex/auth-api/account-list.ts +29 -2
- package/src/codex/auth-api/http.ts +13 -0
- package/src/codex/auth-api/main-account-probe.ts +2 -2
- package/src/codex/auth-api/pool-mode-gate.ts +16 -3
- package/src/codex/auth-api/pool-quota-probe.ts +15 -0
- package/src/codex/auth-context.ts +15 -12
- package/src/codex/catalog/build-entries.ts +22 -0
- package/src/codex/catalog/configured-tiers.ts +70 -0
- package/src/codex/catalog/effort.ts +52 -11
- package/src/codex/catalog/gather-capture.ts +5 -2
- package/src/codex/catalog/heal-observation.ts +155 -13
- package/src/codex/catalog/metadata.ts +6 -0
- package/src/codex/catalog/model-hints.ts +60 -11
- package/src/codex/catalog/model-visibility.ts +3 -2
- package/src/codex/catalog/native-models.ts +18 -3
- package/src/codex/catalog/parsing.ts +10 -8
- package/src/codex/catalog/pinned-models.ts +2 -1
- package/src/codex/catalog/provider-models.ts +18 -13
- package/src/codex/catalog/retained-sync.ts +2 -1
- package/src/codex/catalog/routed-gather.ts +19 -20
- package/src/codex/catalog/write-audit.ts +3 -2
- package/src/codex/catalog-self-heal.ts +43 -23
- package/src/codex/chatgpt-refresh-failure.ts +6 -2
- package/src/codex/cli-install-provenance.ts +418 -0
- package/src/codex/cli-installation-targets.ts +5 -1
- package/src/codex/cli-update-plan.ts +43 -16
- package/src/codex/collision-identity.ts +30 -5
- package/src/codex/convergence.ts +4 -3
- package/src/codex/data/roster-pinned-models.json +177 -1
- package/src/codex/desired-state.ts +6 -1
- package/src/codex/desktop-app/picker-freshness.ts +10 -8
- package/src/codex/desktop-compatibility/installed-build.ts +88 -12
- package/src/codex/desktop-compatibility/runtime.ts +29 -5
- package/src/codex/desktop-compatibility/usage-activation.ts +2 -1
- package/src/codex/desktop-compatibility/usage-controller.ts +9 -1
- package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
- package/src/codex/inject/config-toml.ts +0 -18
- package/src/codex/inject/plan.ts +18 -3
- package/src/codex/inject/remove.ts +6 -2
- package/src/codex/inject.ts +1 -1
- package/src/codex/journal.ts +61 -1
- package/src/codex/model-entitlements.ts +1 -1
- package/src/codex/native-main-owner.ts +27 -1
- package/src/codex/native-profile-store.ts +2 -1
- package/src/codex/pool-credit-policy.ts +35 -1
- package/src/codex/pool-refresh-backoff.ts +3 -1
- package/src/codex/quota-types.ts +3 -0
- package/src/codex/quota.ts +24 -4
- package/src/codex/role-auto-assign.ts +6 -2
- package/src/codex/subagent-defaults.ts +49 -4
- package/src/codex/user-identity.ts +35 -6
- package/src/codex/windows-current-sid.ts +162 -0
- package/src/combos/failover.ts +17 -2
- package/src/combos/jev-decision-contract.ts +22 -1
- package/src/combos/jev-quota-activation.ts +5 -1
- package/src/combos/jev-quota-route.ts +1 -1
- package/src/combos/jev-quota.ts +9 -1
- package/src/combos/jev-service-exchange.ts +3 -1
- package/src/combos/jev-session-pin-config.ts +51 -0
- package/src/combos/jev.ts +101 -9
- package/src/combos/resolve.ts +45 -1
- package/src/combos/types.ts +43 -0
- package/src/config/load-degrade.ts +5 -0
- package/src/config/paths.ts +19 -3
- package/src/config/pending-teardown.ts +22 -1
- package/src/config/provider-validation.ts +22 -4
- package/src/config/removed-opencode-free.ts +11 -0
- package/src/config/schema/leaf-validators.ts +6 -0
- package/src/generated/compatibility-version.json +467 -311
- package/src/generated/model-metadata.ts +5 -5
- package/src/images/loop.ts +16 -2
- package/src/integrations/catalog-refresh.ts +1 -1
- package/src/integrations/hermes-profiles.ts +251 -0
- package/src/integrations/merge.ts +8 -0
- package/src/integrations/mutation-plan.ts +19 -4
- package/src/integrations/registry.ts +5 -0
- package/src/integrations/state.ts +36 -1
- package/src/integrations/writer.ts +18 -4
- package/src/lib/bun-path-runtime.mjs +2 -1
- package/src/lib/decision-quota-sink.ts +10 -0
- package/src/lib/errors.ts +62 -0
- package/src/lib/eventstream-decoder.ts +81 -37
- package/src/lib/opaque-proxy-tunnel.ts +32 -8
- package/src/lib/pinned-http.ts +35 -2
- package/src/lib/process-control.ts +13 -1
- package/src/lib/socks5-fetch.ts +59 -64
- package/src/lib/socks5-upload-waiter.ts +50 -0
- package/src/lib/sse-decoder.ts +7 -2
- package/src/lib/state-store-sweeper.ts +40 -14
- package/src/lib/translator-budget.ts +4 -4
- package/src/lib/upstream-retry.ts +4 -1
- package/src/lib/windows-native-principal-worker.ts +14 -0
- package/src/lib/windows-native-principal.ts +188 -0
- package/src/lib/windows-secret-acl.ts +39 -3
- package/src/lib/windows-user-principal.ts +62 -18
- package/src/link/diagnostics.ts +193 -0
- package/src/link/relay-auth.ts +6 -0
- package/src/link/ssh-config.ts +35 -3
- package/src/link/status-projection.ts +39 -0
- package/src/link/supervisor.ts +45 -12
- package/src/link/tunnel-history.ts +109 -0
- package/src/link/tunnel-state.ts +80 -17
- package/src/messaging/remote-files.ts +24 -1
- package/src/oauth/generic-account-failover.ts +91 -7
- package/src/oauth/index.ts +15 -0
- package/src/oauth/model-discovery-auth.ts +5 -0
- package/src/oauth/store.ts +4 -1
- package/src/oauth/token-guardian.ts +7 -0
- package/src/oauth/types.ts +9 -0
- package/src/oauth/workbuddy.ts +139 -0
- package/src/providers/account-quota-disk.ts +12 -4
- package/src/providers/antigravity-quota-identity.ts +37 -0
- package/src/providers/base-url-choices.ts +8 -5
- package/src/providers/codebuddy-models.ts +6 -0
- package/src/providers/codex-capacity.ts +3 -1
- package/src/providers/derive.ts +51 -3
- package/src/providers/kiro-models.ts +3 -0
- package/src/providers/mimo-thinking.ts +12 -0
- package/src/providers/model-discovery.ts +2 -0
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/model-rename-migration.ts +10 -0
- package/src/providers/openai-sidecar-credit.ts +2 -2
- package/src/providers/quota/account-cache.ts +3 -2
- package/src/providers/quota/antigravity.ts +25 -14
- package/src/providers/quota/report-cache.ts +13 -4
- package/src/providers/quota/vendor-probes-key.ts +60 -0
- package/src/providers/quota/workbuddy.ts +83 -0
- package/src/providers/quota-decision-antigravity.ts +64 -0
- package/src/providers/quota-decision-publication.ts +11 -0
- package/src/providers/quota-decision-snapshot.ts +21 -4
- package/src/providers/quota-types.ts +2 -0
- package/src/providers/quota.ts +3 -1
- package/src/providers/reasoning-capabilities.ts +76 -0
- package/src/providers/registry/entries-core.ts +23 -12
- package/src/providers/registry/entries-extended.ts +83 -27
- package/src/providers/registry/model-ids.ts +5 -0
- package/src/providers/registry/model-seeds.ts +120 -56
- package/src/providers/registry/types.ts +29 -2
- package/src/providers/resolved-model-policy.ts +30 -10
- package/src/providers/routed-config.ts +24 -1
- package/src/providers/stale-model-roster-migration.ts +123 -18
- package/src/providers/workbuddy-credit-balance.ts +81 -0
- package/src/providers/workbuddy-models.ts +37 -0
- package/src/providers/workbuddy.ts +60 -0
- package/src/remote-control/workspace-pi-runtime.ts +11 -6
- package/src/responses/compaction-summary.ts +45 -0
- package/src/responses/muse-tool-name-alias.ts +1 -2
- package/src/responses/parser.ts +3 -2
- package/src/responses/reasoning-replay-cache.ts +18 -14
- package/src/responses/schema.ts +1 -0
- package/src/responses/thought-signature-replay.ts +10 -2
- package/src/router.ts +2 -0
- package/src/routing/analytics.ts +2 -3
- package/src/routing/capability.ts +8 -2
- package/src/routing/fallback-policy.ts +3 -3
- package/src/routing/history/ingest.ts +28 -3
- package/src/server/auth-cors.ts +4 -2
- package/src/server/chat-completions.ts +21 -1
- package/src/server/chat-native-eligibility.ts +7 -0
- package/src/server/chat-native-reasoning.ts +24 -7
- package/src/server/chat-native.ts +13 -2
- package/src/server/claude-messages.ts +3 -0
- package/src/server/direct-local-http.ts +5 -2
- package/src/server/effort-policy.ts +5 -1
- package/src/server/index/link-relay-sessions.ts +9 -5
- package/src/server/index/live-sideband.ts +18 -15
- package/src/server/index/optional-listeners.ts +4 -0
- package/src/server/index/serve-options.ts +5 -4
- package/src/server/local-management-read-client.ts +3 -1
- package/src/server/management/agent-settings-routes.ts +27 -15
- package/src/server/management/combo-routes.ts +14 -4
- package/src/server/management/config-routes.ts +2 -2
- package/src/server/management/decision-discovery.ts +12 -2
- package/src/server/management/hermes-profile-routes.ts +156 -0
- package/src/server/management/integration-routes.ts +85 -24
- package/src/server/management/link-routes.ts +5 -2
- package/src/server/management/model-routes.ts +2 -2
- package/src/server/management/model-row-export-metadata.ts +25 -6
- package/src/server/management/model-rows.ts +15 -20
- package/src/server/management/native-integration-routes.ts +11 -8
- package/src/server/management/provider-routes.ts +1 -1
- package/src/server/management/route-registry.ts +4 -0
- package/src/server/management-api.ts +5 -0
- package/src/server/models-capabilities.ts +21 -3
- package/src/server/port-reclaim.ts +51 -9
- package/src/server/request-log-conversation.ts +49 -0
- package/src/server/request-log.ts +2 -0
- package/src/server/responses/adapter-delivery.ts +11 -1
- package/src/server/responses/adapter-dispatch.ts +2 -2
- package/src/server/responses/anthropic-thinking-recovery.ts +1 -0
- package/src/server/responses/codex-ws-exchange.ts +39 -9
- package/src/server/responses/codex-ws-session.ts +38 -4
- package/src/server/responses/codex-ws-wire.ts +6 -1
- package/src/server/responses/combo-required-tool-contract.ts +103 -0
- package/src/server/responses/combo-stream-preflight.ts +8 -1
- package/src/server/responses/compact.ts +14 -5
- package/src/server/responses/context-overflow.ts +8 -1
- package/src/server/responses/core-combo-failure.ts +10 -0
- package/src/server/responses/core-combo.ts +74 -44
- package/src/server/responses/core-lifetime.ts +5 -2
- package/src/server/responses/core-normalize.ts +17 -4
- package/src/server/responses/core-opaque-recovery.ts +1 -0
- package/src/server/responses/core-options.ts +7 -0
- package/src/server/responses/core-replay.ts +2 -1
- package/src/server/responses/jev-combo-choice.ts +39 -0
- package/src/server/responses/jev-session-pin.ts +203 -0
- package/src/server/responses/main-hard-lock-routing.ts +60 -44
- package/src/server/responses/passthrough-delivery.ts +44 -2
- package/src/server/responses/policy-fallback.ts +6 -1
- package/src/server/responses/request-compression.ts +12 -7
- package/src/server/responses/request-prepare.ts +32 -7
- package/src/server/responses/request-sidecar-auth.ts +2 -0
- package/src/server/responses/request-transport.ts +25 -6
- package/src/server/responses/response-effects.ts +22 -10
- package/src/server/responses/run-turn-execution.ts +2 -4
- package/src/server/responses/sidecar-execution.ts +13 -7
- package/src/server/responses-phase-inference.ts +267 -0
- package/src/server/sse-payload-rewrite.ts +14 -1
- package/src/server/stop-teardown.ts +36 -1
- package/src/server/ws-bridge.ts +1 -1
- package/src/service/definition.ts +20 -8
- package/src/service/desktop-supervision.d.mts +7 -4
- package/src/service/desktop-supervision.mjs +90 -13
- package/src/service/ownership-mutation-lease.mjs +21 -7
- package/src/types/config.ts +14 -2
- package/src/types/provider.ts +29 -7
- package/src/types/request.ts +11 -0
- package/src/types/wire.ts +1 -0
- package/src/types.ts +1 -0
- package/src/update/bind-probe.ts +29 -0
- package/src/update/codex-cli-update-launch-policy.d.mts +9 -0
- package/src/update/codex-cli-update-launch-policy.mjs +30 -0
- package/src/update/job.ts +10 -29
- package/src/update/npm-install-job.ps1 +173 -0
- package/src/update/npm-install.mjs +70 -0
- package/src/update/stop-contract.d.mts +1 -0
- package/src/update/stop-contract.mjs +14 -0
- package/src/update/stop-decision.d.mts +1 -1
- package/src/update/stop-decision.mjs +13 -3
- package/src/update/teardown-handover.ts +166 -0
- package/src/update/transactional-install.d.mts +14 -3
- package/src/update/transactional-install.mjs +33 -7
- package/src/usage/expected-prices.ts +64 -31
- package/src/usage/jev-stats.ts +54 -14
- package/src/usage/timeline.ts +19 -9
- package/src/vision/eligibility.ts +15 -5
- package/src/vision/plan.ts +2 -2
- package/src/web-search/loop.ts +16 -2
- package/gui/dist/assets/App-nZ34cR5G.js +0 -58
- package/gui/dist/assets/index-DGXS51sp.js +0 -94
- package/gui/dist/assets/index-DPeB9HpV.css +0 -1
- package/gui/dist/assets/quota-summary-DO1Sx5TM.js +0 -1
|
@@ -104,6 +104,10 @@ export interface CatalogModel {
|
|
|
104
104
|
description?: string;
|
|
105
105
|
owned_by?: string;
|
|
106
106
|
reasoningEfforts?: string[];
|
|
107
|
+
supportsReasoning?: boolean;
|
|
108
|
+
supportsThinkingToggle?: boolean;
|
|
109
|
+
supportsReasoningEffort?: boolean;
|
|
110
|
+
defaultThinkingEnabled?: boolean;
|
|
107
111
|
/** Exact CCA family evidence, retained through the in-memory discovery cache. */
|
|
108
112
|
antigravityEffortWireModelIds?: Partial<Record<"low" | "medium" | "high", string>>;
|
|
109
113
|
/** Suppress only catalog synthesis of a missing max rung; provider-declared max survives. */
|
|
@@ -133,6 +137,8 @@ export interface CatalogModel {
|
|
|
133
137
|
supportsServiceTier?: boolean;
|
|
134
138
|
/** Captured eligible service-tier wire explicitly maps ultrafast to ultrafast. */
|
|
135
139
|
supportsUltraFastTier?: boolean;
|
|
140
|
+
/** Explicitly verified exact Flex wire and foreign caller-tier forwarding on this route. */
|
|
141
|
+
supportsFlexTier?: boolean;
|
|
136
142
|
/** Optional provider-specific copy for the advertised Fast tier. */
|
|
137
143
|
fastTierDescription?: string;
|
|
138
144
|
supportsReasoningSummaries?: boolean;
|
|
@@ -184,15 +190,11 @@ export const ROUTED_MODEL_COMPATIBILITY_EXCLUSIONS = new Set([
|
|
|
184
190
|
"opencode-go/mimo-v2-omni",
|
|
185
191
|
"opencode-go/mimo-v2-pro",
|
|
186
192
|
/*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* context window, the effort ladder and the text-only hint, so the retired model would
|
|
192
|
-
* keep appearing with its capabilities broken. Excluding the slug is what actually takes
|
|
193
|
-
* it out of the routed catalog.
|
|
193
|
+
* These third-party exclusions originated in the superseded V4 Pro retirement plan.
|
|
194
|
+
* First-party service continues (api-docs.deepseek.com/updates/); these gateway routes
|
|
195
|
+
* remain excluded pending provider-specific verification. Live discovery can reintroduce
|
|
196
|
+
* a model removed from a static registry, so these exclusions act on the routed catalog.
|
|
194
197
|
*/
|
|
195
|
-
"deepseek/deepseek-v4-pro",
|
|
196
198
|
"opencode-go/deepseek-v4-pro",
|
|
197
199
|
"command-code/deepseek-deepseek-v4-pro",
|
|
198
200
|
"commandcode/deepseek-deepseek-v4-pro",
|
|
@@ -12,7 +12,8 @@ import rosterPinnedModels from "../data/roster-pinned-models.json";
|
|
|
12
12
|
* `chatgpt.com/backend-api/codex/models?client_version=0.155.0` on 2026-09-23, the day after
|
|
13
13
|
* https://openai.com/index/introducing-gpt-6-sol-and-luna/, and `gpt-6.1-sol`, copied on
|
|
14
14
|
* 2026-09-30 from openai/codex `codex-rs/models-manager/models.json` after #49318 (bundled
|
|
15
|
-
* upstream, but newer than this build's `upstream-models.json` pin).
|
|
15
|
+
* upstream, but newer than this build's `upstream-models.json` pin), and `gpt-6.1-terra`,
|
|
16
|
+
* copied verbatim from the same upstream file on 2026-10-27 after its 2026-10-26 release.
|
|
16
17
|
*
|
|
17
18
|
* The snapshot always wins: a roster row is appended only when its slug is absent from the
|
|
18
19
|
* snapshot. Once a codex-rs refresh bundles Sol or Luna, that row takes over automatically and
|
|
@@ -117,6 +117,7 @@ import type {
|
|
|
117
117
|
CatalogTrustedOpenAiApiPolicySnapshot,
|
|
118
118
|
} from "../convergence-types";
|
|
119
119
|
import type { CapturedProviderGather, CatalogGatherProviderAuthOutcome, CatalogGatherProviderModelOutcome, ModelsAuthResolution, ModelsAuthResolver } from "./gather-capture";
|
|
120
|
+
import { workBuddyCatalogIdentity } from "../../providers/workbuddy";
|
|
120
121
|
import { QUIET_AUTHORITATIVE_CATALOG_PROVIDERS, applyConfigHintsToCachedModels, applyProviderConfigHints, boundedOwnedBy, catalogHintsFromModelsApiItem, catalogHintsFromProviderConfig, withVisionSidecarInput } from "./model-hints";
|
|
121
122
|
import { mergeConfiguredModelsIntoLiveCatalog, shouldExposeProviderModel, warnDroppedConfiguredIdsOnce } from "./model-visibility";
|
|
122
123
|
import { captureModelsRequest, captureProviderGather, materializeCapturedHeaders } from "./gather-capture";
|
|
@@ -161,6 +162,7 @@ export function observedModelsAuthResolver(
|
|
|
161
162
|
observed: true,
|
|
162
163
|
oauthAccountId: observation.snapshot.accountId,
|
|
163
164
|
oauthGeneration: observation.snapshot.generation,
|
|
165
|
+
...(observation.snapshot.workbuddy ? { workbuddy: observation.snapshot.workbuddy } : {}),
|
|
164
166
|
...(observation.snapshot.providerUserId ? { oauthProviderUserId: observation.snapshot.providerUserId } : {}),
|
|
165
167
|
...(observation.snapshot.apiBaseUrl ? { oauthApiBaseUrl: observation.snapshot.apiBaseUrl } : {}),
|
|
166
168
|
...(observation.snapshot.projectId ? { oauthProjectId: observation.snapshot.projectId } : {}),
|
|
@@ -208,11 +210,10 @@ export async function fetchProviderModelsWithAuth(
|
|
|
208
210
|
...(prov.models ?? []),
|
|
209
211
|
...(prov.retainModels ?? []),
|
|
210
212
|
])];
|
|
211
|
-
const configured: CatalogModel[] = configuredIds.map(id => (
|
|
212
|
-
id,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}));
|
|
213
|
+
const configured: CatalogModel[] = configuredIds.map(id => applyProviderConfigHints(
|
|
214
|
+
name, prov, { id, provider: name }, contextCap, metadataModelIdCaseFold,
|
|
215
|
+
captured.effectiveAlias, metadataConfigDir, false,
|
|
216
|
+
));
|
|
216
217
|
const withConfiguredRetention = (
|
|
217
218
|
models: CatalogModel[],
|
|
218
219
|
options?: { retainComboTargets?: boolean; warnDrops?: boolean },
|
|
@@ -280,6 +281,7 @@ export async function fetchProviderModelsWithAuth(
|
|
|
280
281
|
observed: false,
|
|
281
282
|
oauthAccountId: snapshot.accountId,
|
|
282
283
|
oauthGeneration: snapshot.generation,
|
|
284
|
+
...(snapshot.workbuddy ? { workbuddy: snapshot.workbuddy } : {}),
|
|
283
285
|
...(snapshot.providerUserId ? { oauthProviderUserId: snapshot.providerUserId } : {}),
|
|
284
286
|
...(snapshot.apiBaseUrl ? { oauthApiBaseUrl: snapshot.apiBaseUrl } : {}),
|
|
285
287
|
...(snapshot.projectId ? { oauthProjectId: snapshot.projectId } : {}),
|
|
@@ -646,7 +648,10 @@ export async function fetchProviderModelsWithAuth(
|
|
|
646
648
|
const cloudCodeAssist = effectiveGoogleMode(name, prov) === "cloud-code-assist";
|
|
647
649
|
const project = prov.project ?? auth.oauthProjectId;
|
|
648
650
|
if (cloudCodeAssist && !project) return observed(configured, "degraded");
|
|
649
|
-
|
|
651
|
+
// WorkBuddy model entitlements belong to the captured account and tenant.
|
|
652
|
+
const catalogAuthority = name === "workbuddy-ai"
|
|
653
|
+
? workBuddyCatalogIdentity(apiKey!, auth.workbuddy) : undefined;
|
|
654
|
+
const fresh = getFreshCached(name, ttlMs, Date.now(), catalogAuthority);
|
|
650
655
|
if (fresh) {
|
|
651
656
|
return observed(
|
|
652
657
|
withConfiguredRetention(
|
|
@@ -655,10 +660,10 @@ export async function fetchProviderModelsWithAuth(
|
|
|
655
660
|
"authoritative",
|
|
656
661
|
); // dedups Codex's frequent /v1/models polling within the TTL
|
|
657
662
|
}
|
|
658
|
-
if (isModelsFetchCoolingDown(name)) {
|
|
663
|
+
if (isModelsFetchCoolingDown(name, undefined, undefined, catalogAuthority)) {
|
|
659
664
|
// A recently-failed provider (unreachable API, missing proxy, bad key) must not re-pay the
|
|
660
665
|
// fetch timeout on every catalog poll — the dashboard polls this path per page load.
|
|
661
|
-
const stale = getStaleCached(name);
|
|
666
|
+
const stale = getStaleCached(name, catalogAuthority);
|
|
662
667
|
return observed(
|
|
663
668
|
withConfiguredRetention(
|
|
664
669
|
stale
|
|
@@ -671,7 +676,7 @@ export async function fetchProviderModelsWithAuth(
|
|
|
671
676
|
// The captured request predates any refresh, so a refreshing gather rebuilds it
|
|
672
677
|
// from the auth it resolved: the token and its origin, together.
|
|
673
678
|
const request = resolveAuth.kind === "refreshing" && name !== "anthropic2"
|
|
674
|
-
? captureModelsRequest(name, prov, auth.oauthApiBaseUrl)
|
|
679
|
+
? captureModelsRequest(name, prov, auth.oauthApiBaseUrl, auth.workbuddy)
|
|
675
680
|
: captured.request;
|
|
676
681
|
const url = request.url;
|
|
677
682
|
let headers = materializeCapturedHeaders(request, apiKey);
|
|
@@ -701,9 +706,9 @@ export async function fetchProviderModelsWithAuth(
|
|
|
701
706
|
// suppress an identical repeated failure (#395 log flood). The failure stays observable via the
|
|
702
707
|
// discovery-status API regardless.
|
|
703
708
|
const shouldLog = shouldLogDiscoveryFailure(name, failure);
|
|
704
|
-
markModelsFetchFailure(name);
|
|
709
|
+
markModelsFetchFailure(name, undefined, catalogAuthority);
|
|
705
710
|
markProviderDiscoveryFailed(name, failure);
|
|
706
|
-
const stale = getStaleCached(name);
|
|
711
|
+
const stale = getStaleCached(name, catalogAuthority);
|
|
707
712
|
return {
|
|
708
713
|
models: withConfiguredRetention(
|
|
709
714
|
stale
|
|
@@ -812,7 +817,7 @@ export async function fetchProviderModelsWithAuth(
|
|
|
812
817
|
// Entitlement is per account (Claude 4.6 vs 5.5, Argon): remember what THIS account
|
|
813
818
|
// lists so account selection can prefer one that serves the requested model.
|
|
814
819
|
if (auth.oauthAccountId) recordAntigravityAccountRoster(name, auth.oauthAccountId, antigravity);
|
|
815
|
-
if (!setCached(name, forCache, Date.now(), cacheGeneration)) {
|
|
820
|
+
if (!setCached(name, forCache, Date.now(), cacheGeneration, catalogAuthority)) {
|
|
816
821
|
return observed(withConfiguredRetention(configured), "degraded");
|
|
817
822
|
}
|
|
818
823
|
markProviderDiscoveryOk(name, live.length);
|
|
@@ -898,7 +903,7 @@ export async function fetchProviderModelsWithAuth(
|
|
|
898
903
|
`[opencodex] Provider model discovery for "${name}" returned an authoritative empty catalog; ${droppedConfiguredIds.length > 0 ? `dropping configured model ids: ${droppedConfiguredIds.join(", ")}` : "no models will be exposed"}.`,
|
|
899
904
|
);
|
|
900
905
|
}
|
|
901
|
-
if (!maySendAnthropicDiscovery() || !setCached(name, forCache, Date.now(), cacheGeneration)) {
|
|
906
|
+
if (!maySendAnthropicDiscovery() || !setCached(name, forCache, Date.now(), cacheGeneration, catalogAuthority)) {
|
|
902
907
|
return observed(withConfiguredRetention(configured), "degraded");
|
|
903
908
|
}
|
|
904
909
|
markProviderDiscoveryOk(name, liveModelCount);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { projectAntigravitySelectedModels } from "../../providers/antigravity-effort-families";
|
|
2
|
-
import { configuredUltraFastSlugs } from "./configured-tiers";
|
|
2
|
+
import { configuredUltraFastSlugs, retainedFlexPolicyBySlug } from "./configured-tiers";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { initializeConfigOwnership } from "../../lib/config-ownership";
|
|
@@ -511,6 +511,7 @@ function writeRetainedCatalogSync({
|
|
|
511
511
|
catalog.models = mergeCatalogEntriesFromObservedState({
|
|
512
512
|
ultraFastTier: ultraFastTierEnabled(config),
|
|
513
513
|
configuredUltraFastSlugs: configuredUltraFastSlugs(orderedGoModels),
|
|
514
|
+
retainedFlexPolicyBySlug: retainedFlexPolicyBySlug(config.providers ?? {}, catalogModelsForMerge, orderedGoModels),
|
|
514
515
|
modelPickerOrder,
|
|
515
516
|
accountSelectors,
|
|
516
517
|
catalogModels: catalogModelsForMerge,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canInferVendorContext } from "./vendor-context";
|
|
2
2
|
import { effectiveProviderAlias, effectiveProviderAliasDecision } from "../../providers/default-aliases";
|
|
3
3
|
import { initialModelSelectionPending } from "../../providers/initial-model-selection";
|
|
4
|
-
import { supportsConfiguredUltraFast } from "./configured-tiers";
|
|
4
|
+
import { supportsConfiguredFlex, supportsConfiguredUltraFast } from "./configured-tiers";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
6
|
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
7
7
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
|
|
@@ -102,7 +102,7 @@ import type {
|
|
|
102
102
|
CatalogTrustedOpenAiApiPolicySnapshot,
|
|
103
103
|
} from "../convergence-types";
|
|
104
104
|
import type { CatalogGatherProviderAuthOutcome, CatalogGatherProviderModelOutcome, GatherFlightCapture, ModelsAuthResolverFactory } from "./gather-capture";
|
|
105
|
-
import { applyProviderConfigHints, configuredAutoCompactTokenLimit, configuredMaxInputTokens, configuredModelDisplayName, configuredReasoningSummarySupport, modelInputModalities, routedMaxOutputTokens, withVisionSidecarInput } from "./model-hints";
|
|
105
|
+
import { applyProviderConfigHints, configuredAutoCompactTokenLimit, configuredMaxInputTokens, configuredModelDisplayName, configuredReasoningSummarySupport, copyReasoningHintSource, modelInputModalities, routedMaxOutputTokens, withVisionSidecarInput } from "./model-hints";
|
|
106
106
|
import { resolveComboCatalogMember } from "./combo-member";
|
|
107
107
|
import { captureGatherFlight, captureTrustedOpenAiApiPolicy, gatherFlightKey, keyedGatherBytesIdentity, withCanonicalOpenAiForwardAuthDefault } from "./gather-capture";
|
|
108
108
|
import { fetchProviderModelsWithAuth, observedModelsAuthResolver, refreshingModelsAuthResolver } from "./provider-models";
|
|
@@ -364,6 +364,7 @@ async function gatherRoutedModelsUncached(
|
|
|
364
364
|
const supported = serviceTierSupportFromPolicy(policy);
|
|
365
365
|
if (supported !== undefined) model.supportsServiceTier = supported;
|
|
366
366
|
model.supportsUltraFastTier = supportsConfiguredUltraFast(policy);
|
|
367
|
+
model.supportsFlexTier = supportsConfiguredFlex(policy);
|
|
367
368
|
if (supported === true && policy.fastTierDescription !== undefined) model.fastTierDescription = policy.fastTierDescription;
|
|
368
369
|
}
|
|
369
370
|
}
|
|
@@ -661,6 +662,7 @@ async function gatherRoutedModelsUncached(
|
|
|
661
662
|
...(cm.defaultReasoningEffort ? { defaultReasoningEffort: cm.defaultReasoningEffort } : {}),
|
|
662
663
|
...(typeof supportsServiceTier === "boolean" ? { supportsServiceTier } : {}),
|
|
663
664
|
supportsUltraFastTier: supportsConfiguredUltraFast(fastPolicy),
|
|
665
|
+
supportsFlexTier: supportsConfiguredFlex(fastPolicy),
|
|
664
666
|
...(supportsServiceTier === true && fastPolicy?.fastTierDescription !== undefined
|
|
665
667
|
? { fastTierDescription: fastPolicy.fastTierDescription }
|
|
666
668
|
: {}),
|
|
@@ -818,8 +820,8 @@ async function gatherRoutedModelsUncached(
|
|
|
818
820
|
? config.combos?.[model.id]?.targets ?? []
|
|
819
821
|
: [{ provider: model.provider }];
|
|
820
822
|
const inactive = quotaInactiveReason(config, targets);
|
|
821
|
-
const named = displayName && !model.displayName ? { ...model, displayName } : model;
|
|
822
|
-
return inactive ? { ...named, quotaInactiveReason: inactive } : named;
|
|
823
|
+
const named = displayName && !model.displayName ? copyReasoningHintSource(model, { ...model, displayName }) : model;
|
|
824
|
+
return inactive ? copyReasoningHintSource(named, { ...named, quotaInactiveReason: inactive }) : named;
|
|
823
825
|
}),
|
|
824
826
|
comboOmissions: localOmissions,
|
|
825
827
|
providerAuthOutcomes: localProviderAuthOutcomes,
|
|
@@ -966,7 +968,7 @@ export function augmentRoutedModelsWithMetadata(
|
|
|
966
968
|
: undefined;
|
|
967
969
|
const liveWindow = typeof existing.contextWindow === "number" && existing.contextWindow > 0;
|
|
968
970
|
if (liveWindow || publishedWindow === undefined) continue;
|
|
969
|
-
const seeded
|
|
971
|
+
const seeded = copyReasoningHintSource(existing, { ...existing, contextWindow: publishedWindow });
|
|
970
972
|
out[existingIndex] = providers?.[provider]
|
|
971
973
|
? applyProviderConfigHints(
|
|
972
974
|
provider,
|
|
@@ -990,21 +992,18 @@ export function augmentRoutedModelsWithMetadata(
|
|
|
990
992
|
...(typeof meta.maxTokens === "number" && meta.maxTokens > 0 ? { maxOutputTokens: meta.maxTokens } : {}),
|
|
991
993
|
...(Array.isArray(meta.input) && meta.input.length > 0 ? { inputModalities: [...meta.input] } : {}),
|
|
992
994
|
};
|
|
993
|
-
out.push(
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
)
|
|
1006
|
-
: {}),
|
|
1007
|
-
});
|
|
995
|
+
out.push(providers?.[provider]
|
|
996
|
+
? applyProviderConfigHints(
|
|
997
|
+
provider,
|
|
998
|
+
providers[provider],
|
|
999
|
+
model,
|
|
1000
|
+
contextCap,
|
|
1001
|
+
metadataModelIdCaseFoldByProvider?.get(provider),
|
|
1002
|
+
undefined,
|
|
1003
|
+
metadataConfigDirByProvider?.get(provider),
|
|
1004
|
+
includeVisionSidecar,
|
|
1005
|
+
)
|
|
1006
|
+
: model);
|
|
1008
1007
|
}
|
|
1009
1008
|
}
|
|
1010
1009
|
return out;
|
|
@@ -68,6 +68,8 @@ function readTail(fd: number, size: number): Buffer {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function completeRecords(bytes: Buffer): { records: Buffer[]; count: number; clean: boolean } {
|
|
71
|
+
// Keep a BOM in the decoded text so JSON.parse still rejects BOM-prefixed rows.
|
|
72
|
+
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
71
73
|
const records: Buffer[] = [];
|
|
72
74
|
let start = 0;
|
|
73
75
|
let clean = true;
|
|
@@ -75,8 +77,7 @@ function completeRecords(bytes: Buffer): { records: Buffer[]; count: number; cle
|
|
|
75
77
|
for (let end = bytes.indexOf(10); end !== -1; end = bytes.indexOf(10, start)) {
|
|
76
78
|
const line = bytes.subarray(start, end);
|
|
77
79
|
try {
|
|
78
|
-
const text =
|
|
79
|
-
if (!line.equals(Buffer.from(text))) throw new Error("invalid UTF-8");
|
|
80
|
+
const text = decoder.decode(line);
|
|
80
81
|
JSON.parse(text);
|
|
81
82
|
records[count % CATALOG_AUDIT_KEEP_RECORDS] = bytes.subarray(start, end + 1);
|
|
82
83
|
count++;
|
|
@@ -3,7 +3,7 @@ import { readRuntimePort } from "../config/process-state";
|
|
|
3
3
|
import { readClientConnectionState } from "../client/state";
|
|
4
4
|
import { getActiveTurnCount, isDraining, isRecyclingForExit, isShutdownDraining } from "../server/lifecycle";
|
|
5
5
|
import type { OcxConfig } from "../types";
|
|
6
|
-
import { observeCatalogHealFile,
|
|
6
|
+
import { compareCatalogHealPaths, observeCatalogHealFile, retainCatalogHealPath, selectCatalogHealPath, type CatalogObservation } from "./catalog/heal-observation";
|
|
7
7
|
import { subscribeCatalogPublication } from "./catalog/publication-observer";
|
|
8
8
|
import { configEnablesRoutedNamespace, ocxRoutedNamespaceCounts } from "./catalog/routed-removal";
|
|
9
9
|
import { inspectCodexHomeOwner } from "./codex-home-owner";
|
|
@@ -51,6 +51,7 @@ export interface CatalogSelfHealDeps {
|
|
|
51
51
|
now?: () => number;
|
|
52
52
|
catalogPath?: () => string | null;
|
|
53
53
|
observe?: (path: string, readContent: boolean) => CatalogObservation | null;
|
|
54
|
+
retainPath?: typeof retainCatalogHealPath;
|
|
54
55
|
converge?: (config: OcxConfig, lifecycle: CatalogHealLifecycle) => Promise<CatalogHealOutcome>;
|
|
55
56
|
subscribe?: typeof subscribeCatalogPublication;
|
|
56
57
|
gates?: Partial<CatalogSelfHealGates>;
|
|
@@ -135,14 +136,19 @@ export function startCodexCatalogSelfHeal(options: { port?: number; deps?: Catal
|
|
|
135
136
|
const attempts: number[] = [];
|
|
136
137
|
const heals: number[] = [];
|
|
137
138
|
|
|
138
|
-
const read = (path: string): NamespaceObservation | null => {
|
|
139
|
+
const read = (path: string, fresh = false): NamespaceObservation | null => {
|
|
139
140
|
const quick = observe(path, false);
|
|
140
141
|
if (quick === null) return null;
|
|
141
|
-
if (
|
|
142
|
+
if (!fresh && observed !== null) {
|
|
143
|
+
const relation = compareCatalogHealPaths(observed.path, path);
|
|
144
|
+
if (relation === "unknown") return null;
|
|
145
|
+
if (relation === "same" && observed.signature === quick.signature) return observed;
|
|
146
|
+
}
|
|
142
147
|
const seen = observe(path, true);
|
|
143
148
|
if (seen === null) return null;
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
const result = { path, signature: seen.signature, namespaces: seen.catalog ? new Set(ocxRoutedNamespaceCounts(seen.catalog).keys()) : null };
|
|
150
|
+
if (!fresh) observed = result;
|
|
151
|
+
return result;
|
|
146
152
|
};
|
|
147
153
|
const accept = (path: string): void => {
|
|
148
154
|
const seen = read(path);
|
|
@@ -154,18 +160,23 @@ export function startCodexCatalogSelfHeal(options: { port?: number; deps?: Catal
|
|
|
154
160
|
pendingRetry = null;
|
|
155
161
|
recheckAt = 0;
|
|
156
162
|
};
|
|
157
|
-
const updateTarget = (path: string | null):
|
|
163
|
+
const updateTarget = (path: string | null): boolean => {
|
|
158
164
|
// Unavailable selection is not evidence of a different target or lost authority.
|
|
159
|
-
if (path === null) return;
|
|
160
|
-
if (target !== null
|
|
165
|
+
if (path === null) return false;
|
|
166
|
+
if (target !== null) {
|
|
167
|
+
const relation = compareCatalogHealPaths(target, path);
|
|
168
|
+
if (relation === "unknown") return false;
|
|
169
|
+
if (relation === "same") return true;
|
|
170
|
+
}
|
|
161
171
|
clear();
|
|
162
172
|
target = path;
|
|
173
|
+
return true;
|
|
163
174
|
};
|
|
164
175
|
const beforeCommit = (path: string, entryGeneration: number): boolean => {
|
|
165
176
|
try {
|
|
166
177
|
const selected = catalogPath();
|
|
167
178
|
return !stopped && !released && generation === entryGeneration
|
|
168
|
-
&& selected !== null &&
|
|
179
|
+
&& selected !== null && compareCatalogHealPaths(selected, path) === "same" && evaluateCatalogSelfHealGates(gates).open;
|
|
169
180
|
} catch { return false; }
|
|
170
181
|
};
|
|
171
182
|
const capRetryAt = (now: number): number => {
|
|
@@ -182,8 +193,7 @@ export function startCodexCatalogSelfHeal(options: { port?: number; deps?: Catal
|
|
|
182
193
|
running = true;
|
|
183
194
|
try {
|
|
184
195
|
const path = catalogPath();
|
|
185
|
-
updateTarget(path);
|
|
186
|
-
if (path === null) return;
|
|
196
|
+
if (!updateTarget(path) || path === null) return;
|
|
187
197
|
// Pending cache/funnel failure is independent of catalog stat or apparent repaired rows.
|
|
188
198
|
if (pendingRetry) {
|
|
189
199
|
const config = gates.loadConfig();
|
|
@@ -226,7 +236,7 @@ export function startCodexCatalogSelfHeal(options: { port?: number; deps?: Catal
|
|
|
226
236
|
})).committed; }
|
|
227
237
|
catch { /* Failed attempts retain pending retry and consume the attempt budget. */ }
|
|
228
238
|
const selected = catalogPath();
|
|
229
|
-
if (stopped || released || generation !== entryGeneration || selected === null ||
|
|
239
|
+
if (stopped || released || generation !== entryGeneration || selected === null || compareCatalogHealPaths(selected, path) !== "same") return;
|
|
230
240
|
last = { at: new Date().toISOString(), lostNamespaces: lostEnabled.length, committed };
|
|
231
241
|
if (committed) {
|
|
232
242
|
heals.push(clock());
|
|
@@ -241,33 +251,43 @@ export function startCodexCatalogSelfHeal(options: { port?: number; deps?: Catal
|
|
|
241
251
|
|
|
242
252
|
const unsubscribe = (deps.subscribe ?? subscribeCatalogPublication)(event => {
|
|
243
253
|
if (stopped) return;
|
|
254
|
+
const release = event.kind === "native-released" || event.intent === "restore";
|
|
255
|
+
// Bind publication evidence before comparisons can observe a retargeted alias.
|
|
256
|
+
const stillPublished = !release && event.path !== null ? (deps.retainPath ?? retainCatalogHealPath)(event.path) : null;
|
|
244
257
|
// Native restoration can remove the journal before notification. Fence the known
|
|
245
258
|
// target (and target-less releases) without resolving possibly unavailable evidence.
|
|
246
|
-
const
|
|
247
|
-
if (release && (event.path === null ||
|
|
259
|
+
const known = event.path !== null && target !== null ? compareCatalogHealPaths(event.path, target) : "different";
|
|
260
|
+
if (release && (event.path === null || known !== "different")) {
|
|
248
261
|
clear();
|
|
249
262
|
released = true;
|
|
250
263
|
return;
|
|
251
264
|
}
|
|
252
265
|
const path = catalogPath();
|
|
253
|
-
|
|
254
|
-
|
|
266
|
+
const selected = event.path !== null && path !== null ? compareCatalogHealPaths(event.path, path) : "different";
|
|
267
|
+
if (event.path !== null && known === "different" && selected === "different") return;
|
|
255
268
|
if (release) {
|
|
256
269
|
clear();
|
|
257
270
|
released = true; // Only a later accepted owner publication can re-arm this lifecycle.
|
|
258
271
|
return;
|
|
259
272
|
}
|
|
260
|
-
if (running)
|
|
273
|
+
if (running) {
|
|
274
|
+
if (known === "unknown" || selected === "unknown") clear();
|
|
275
|
+
return; // Catalog-success/cache-failure must not accept a baseline.
|
|
276
|
+
}
|
|
261
277
|
// A committed owner publication supplies a read-only baseline even while heal writes are gated.
|
|
262
|
-
if (event.path === null || path === null ||
|
|
263
|
-
|
|
278
|
+
if (event.path === null || path === null || selected !== "same" || stillPublished === null) return;
|
|
279
|
+
// Read independently of obsolete evidence, but retire it only after current selection proof.
|
|
280
|
+
const seen = read(event.path, true);
|
|
281
|
+
const current = catalogPath();
|
|
282
|
+
if (seen?.namespaces == null || current === null
|
|
283
|
+
|| compareCatalogHealPaths(event.path, current) !== "same" || !stillPublished(seen.signature)) return;
|
|
284
|
+
clear();
|
|
285
|
+
target = current;
|
|
286
|
+
baseline = observed = seen;
|
|
264
287
|
released = false;
|
|
265
|
-
pendingRetry = null;
|
|
266
|
-
recheckAt = 0;
|
|
267
|
-
accept(event.path);
|
|
268
288
|
});
|
|
269
289
|
// Capture immediately after startup sync, before a foreign write can become the first tick.
|
|
270
|
-
try {
|
|
290
|
+
try { const path = catalogPath(); if (updateTarget(path) && target !== null) accept(target); }
|
|
271
291
|
catch { /* Unavailable observation can be retried by the scheduled tick. */ }
|
|
272
292
|
const schedule = (): void => {
|
|
273
293
|
if (stopped) return;
|
|
@@ -45,12 +45,16 @@ export function classifyChatgptRefreshFailure(status: number, body: string): Cha
|
|
|
45
45
|
return { reason, ...(code ? { code } : {}) };
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Endpoint verdict plus, for pool accounts, the redacted `p<hex6>` log label so a multi-account
|
|
50
|
+
* pool can be triaged from the log. Never a token, email, body, or arbitrary upstream string.
|
|
51
|
+
*/
|
|
49
52
|
export function noteChatgptRefreshFailure(
|
|
50
53
|
kind: "pool" | "native main",
|
|
51
54
|
status: number,
|
|
52
55
|
failure: ChatgptRefreshFailure,
|
|
56
|
+
accountLabel?: string,
|
|
53
57
|
): void {
|
|
54
|
-
console.warn(`[codex] ${kind} refresh: ${failure.reason === "unknown" ? "transient" : "reauth"}`
|
|
58
|
+
console.warn(`[codex] ${kind} refresh${accountLabel ? ` ${accountLabel}` : ""}: ${failure.reason === "unknown" ? "transient" : "reauth"}`
|
|
55
59
|
+ ` status=${status} code=${failure.code ?? "none"}`);
|
|
56
60
|
}
|