@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
|
@@ -2,7 +2,7 @@ import { bridgeToResponsesSSE, formatErrorResponse } from "../../bridge";
|
|
|
2
2
|
import { OLLAMA_LATE_ATTRIBUTION_LIMIT_MESSAGE } from "../../adapters/ollama-native";
|
|
3
3
|
import { isThroughputLimitText } from "../../claude/outbound";
|
|
4
4
|
import { isDefiniteContextOverflow } from "../../combos/failover";
|
|
5
|
-
import { classifyError } from "../../lib/errors";
|
|
5
|
+
import { classifyError, MODEL_NOT_IN_PLAN_STREAM_CODE } from "../../lib/errors";
|
|
6
6
|
import type { TranslatorBudget } from "../../lib/translator-budget";
|
|
7
7
|
import type { AdapterEvent } from "../../types";
|
|
8
8
|
|
|
@@ -99,6 +99,8 @@ export interface SidecarLoopFailure {
|
|
|
99
99
|
upstreamCode?: string;
|
|
100
100
|
/** The failed response was marked non-replayable: the provider may already have run the turn. */
|
|
101
101
|
nonReplayable?: boolean;
|
|
102
|
+
/** The failed response was a verified plan refusal; the loop's own envelope must carry the mark. */
|
|
103
|
+
verifiedPlanRefusal?: boolean;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/**
|
|
@@ -127,6 +129,11 @@ export function sidecarLoopOverflowEvent(
|
|
|
127
129
|
export function sidecarLoopTerminalEvent(
|
|
128
130
|
failure: SidecarLoopFailure,
|
|
129
131
|
): Extract<AdapterEvent, { type: "error" }> | undefined {
|
|
132
|
+
// A verified plan refusal in a later iteration lands inside an already committed 200 stream,
|
|
133
|
+
// where only a terminal refusal code ends the turn; `model_not_in_plan` would be reconnected.
|
|
134
|
+
if (failure.verifiedPlanRefusal && failure.event) {
|
|
135
|
+
return { ...failure.event, code: MODEL_NOT_IN_PLAN_STREAM_CODE, retryable: false };
|
|
136
|
+
}
|
|
130
137
|
const overflow = sidecarLoopOverflowEvent(failure);
|
|
131
138
|
if (overflow || failure.event) return overflow;
|
|
132
139
|
if (classifyError(failure.status, "upstream_error", failure.message).code !== "context_length_exceeded") return undefined;
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
isCyberPolicyMessage,
|
|
12
12
|
CYBER_POLICY_ERROR_CODE,
|
|
13
13
|
CYBER_POLICY_FALLBACK_MESSAGE,
|
|
14
|
+
isModelNotInPlanRefusal,
|
|
15
|
+
markVerifiedModelNotInPlanResponse,
|
|
16
|
+
namesModelNotInPlanCode,
|
|
14
17
|
} from "../../lib/errors";
|
|
15
18
|
import { normalizeUpstreamErrorText } from "./core-errors";
|
|
16
19
|
import { resolveClientRetryAfter } from "../../lib/retry-after";
|
|
@@ -54,6 +57,7 @@ export async function consumeComboFailure(
|
|
|
54
57
|
// A local key-scope refusal is already the client's answer: rebuilding it as an upstream_error
|
|
55
58
|
// would hide the stable model_not_allowed_for_key type clients branch on.
|
|
56
59
|
let scopeRefusalBody: string | undefined;
|
|
60
|
+
let verifiedPlanRefusal = false;
|
|
57
61
|
try {
|
|
58
62
|
const body = await readBoundedResponseBody(response, { signal, reportUtf8Validity: serverError });
|
|
59
63
|
// A 5xx body counts as quota or classification evidence only when it decoded as valid
|
|
@@ -73,6 +77,10 @@ export async function consumeComboFailure(
|
|
|
73
77
|
if (utf8Trusted || isCyberPolicyCode(normalized.code) || isCyberPolicyMessage(normalized.safeText)) {
|
|
74
78
|
classificationText = normalized.safeText;
|
|
75
79
|
upstreamCode = codexAccountModelRefusalHardStopCode(response.status, body.text) ?? normalized.code;
|
|
80
|
+
// Only the adapter's own normalized refusal may claim the plan-refusal hop; another
|
|
81
|
+
// upstream echoing the code in any spelling keeps the meaning it had before, which was none.
|
|
82
|
+
if (namesModelNotInPlanCode(upstreamCode) && !isModelNotInPlanRefusal(response, upstreamCode)) upstreamCode = undefined;
|
|
83
|
+
verifiedPlanRefusal = isModelNotInPlanRefusal(response, upstreamCode);
|
|
76
84
|
upstreamMessage = normalized.message;
|
|
77
85
|
upstreamType = normalized.type;
|
|
78
86
|
}
|
|
@@ -126,10 +134,12 @@ export async function consumeComboFailure(
|
|
|
126
134
|
},
|
|
127
135
|
);
|
|
128
136
|
if (nonReplayable) markResponseNonReplayable(failureResponse);
|
|
137
|
+
if (verifiedPlanRefusal) markVerifiedModelNotInPlanResponse(failureResponse);
|
|
129
138
|
carryAnthropicRefusalCredential(response, failureResponse);
|
|
130
139
|
return {
|
|
131
140
|
response: failureResponse,
|
|
132
141
|
...(nonReplayable ? { nonReplayable: true } : {}),
|
|
142
|
+
...(verifiedPlanRefusal ? { verifiedPlanRefusal: true } : {}),
|
|
133
143
|
classificationText,
|
|
134
144
|
...(codexModelRefusal !== undefined ? { codexModelRefusal } : {}),
|
|
135
145
|
...(normalizedUpstreamCode !== undefined ? { upstreamCode: normalizedUpstreamCode } : {}),
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
import { codexAccountLogLabel, oauthAccountLogLabel } from "../../codex/account-label";
|
|
69
69
|
import { isGenericFailoverProvider, rotateGenericOAuthAccountOn429 } from "../../oauth/generic-account-failover";
|
|
70
70
|
import { codexQuotaScopeForModel, getCodexQuotaHealthSnapshot } from "../../codex/routing";
|
|
71
|
-
import { isCanonicalOpenAiForwardProvider } from "../../providers/openai-tiers";
|
|
71
|
+
import { isCanonicalOpenAiForwardProvider, OPENAI_CODEX_PROVIDER_ID } from "../../providers/openai-tiers";
|
|
72
72
|
import type { AgentTaskRecoveryFailureReason } from "./agent-task-recovery";
|
|
73
73
|
import {
|
|
74
74
|
agentTaskRecoveryConfig,
|
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
recoverEncryptedAgentTaskWithResult,
|
|
77
77
|
} from "./agent-task-recovery";
|
|
78
78
|
import { isThreadSpawnRequest, supportedLadderFor } from "../effort-policy";
|
|
79
|
+
import { jevChoiceEfforts } from "./jev-combo-choice";
|
|
79
80
|
import { applyDroidResponsesReasoningDefault } from "../droid-reasoning-default";
|
|
80
81
|
import { isPlainObject } from "../../lib/plain-data";
|
|
81
82
|
import {
|
|
@@ -102,6 +103,7 @@ import type { ResponsesTerminalStatus } from "../../bridge";
|
|
|
102
103
|
import { beginRequestAttempt, sealRequestAttemptIdentity, finishRequestAttempt } from "../request-log";
|
|
103
104
|
import { rememberComboForLane } from "./combo-session-recall";
|
|
104
105
|
import { COMBO_TOOL_LOOP_PIN_REASON, toolLoopPinnedPick } from "./combo-tool-loop-pin";
|
|
106
|
+
import { JEV_SESSION_PIN_ROUTE_REASON, jevSessionPinScope } from "./jev-session-pin";
|
|
105
107
|
import { runTurnAdapterSseResponses } from "./core-lifetime";
|
|
106
108
|
import { normalizePersistedJevDecision } from "../../usage/jev-stats";
|
|
107
109
|
import {
|
|
@@ -118,6 +120,7 @@ import { createComboProtocolLanes, dispatchNativeComboChild } from "./core-combo
|
|
|
118
120
|
import { createJevModelInvoker } from "./jev-model-invoke";
|
|
119
121
|
import { comboRequestedEffortLabel } from "./combo-requested-effort";
|
|
120
122
|
import { clientWireOf } from "../inference/client-wire";
|
|
123
|
+
import { resolveContextPrincipal } from "../auth-cors";
|
|
121
124
|
|
|
122
125
|
/**
|
|
123
126
|
* Sends one combo target may run on its own before the ladder moves on. A target is a whole
|
|
@@ -316,30 +319,6 @@ interface JevComboChoice {
|
|
|
316
319
|
candidate: JevCandidate;
|
|
317
320
|
}
|
|
318
321
|
|
|
319
|
-
/** A target's JEV effort choices, or undefined when an explicit allowlist has none still supported. */
|
|
320
|
-
function jevChoiceEfforts(
|
|
321
|
-
config: OcxConfig,
|
|
322
|
-
target: NonNullable<ReturnType<typeof getCombo>>["targets"][number],
|
|
323
|
-
): OcxComboDefaultEffort[] | undefined {
|
|
324
|
-
let ladder: string[] | undefined;
|
|
325
|
-
try {
|
|
326
|
-
const route = routeConcreteModel(config, targetKey(target));
|
|
327
|
-
ladder = supportedLadderFor({ provider: route.provider, modelId: route.modelId });
|
|
328
|
-
} catch {
|
|
329
|
-
// Preserve the existing routing-failure surface. Unknown capability becomes the explicit
|
|
330
|
-
// no-effort choice rather than broadening JEV's effort allowlist.
|
|
331
|
-
ladder = undefined;
|
|
332
|
-
}
|
|
333
|
-
const supportedEfforts = (ladder ?? []).filter(isCodexReasoningEffort) as OcxComboDefaultEffort[];
|
|
334
|
-
const configuredEfforts = target.reasoningEfforts;
|
|
335
|
-
const reasoningEfforts = configuredEfforts === undefined
|
|
336
|
-
? supportedEfforts
|
|
337
|
-
: configuredEfforts.filter(effort => supportedEfforts.includes(effort));
|
|
338
|
-
// An explicit allowlist is restrictive. If catalog capabilities drift until no configured
|
|
339
|
-
// effort remains supported, omit the target instead of silently broadening JEV's choices.
|
|
340
|
-
return configuredEfforts !== undefined && reasoningEfforts.length === 0 ? undefined : reasoningEfforts;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
322
|
/** Enumerate the current ordinary Combo eligibility set without retaining attempted picks. */
|
|
344
323
|
function eligibleJevComboChoices(
|
|
345
324
|
config: OcxConfig,
|
|
@@ -358,15 +337,15 @@ function eligibleJevComboChoices(
|
|
|
358
337
|
excluded.add(key);
|
|
359
338
|
// The TypeSafe row owns a decision credential, not an inference transport.
|
|
360
339
|
if (pick.target.provider === JEV_PROVIDER_ID) continue;
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
340
|
+
const identity = jevChoiceEfforts(config, pick.target, combo.decisionQuotaSignals === true);
|
|
341
|
+
if (!identity) continue;
|
|
363
342
|
choices.push({
|
|
364
343
|
pick: { ...pick, attempted: [key] },
|
|
365
344
|
candidate: {
|
|
366
345
|
key,
|
|
367
346
|
provider: pick.target.provider,
|
|
368
347
|
model: pick.target.model,
|
|
369
|
-
|
|
348
|
+
...identity,
|
|
370
349
|
modelProfile: pick.target.modelProfile,
|
|
371
350
|
},
|
|
372
351
|
});
|
|
@@ -405,6 +384,10 @@ export async function executeComboResponses(
|
|
|
405
384
|
if (!combo) {
|
|
406
385
|
return formatErrorResponse(404, "invalid_request_error", `Unknown combo: ${comboId}`);
|
|
407
386
|
}
|
|
387
|
+
// Resolve against the original request once; every bridge candidate receives the same trusted
|
|
388
|
+
// result after its provisional Authorization is removed, including an explicitly keyless result.
|
|
389
|
+
const replayPrincipal = options.replayPrincipal
|
|
390
|
+
?? { clientPrincipalId: resolveContextPrincipal(req, config, options.admission) };
|
|
408
391
|
// PF-07: present only for a Chat combo with `nativeChatCombos` on; otherwise every child
|
|
409
392
|
// takes the bridge below exactly as before.
|
|
410
393
|
const protocolLanes = createComboProtocolLanes({
|
|
@@ -481,6 +464,7 @@ export async function executeComboResponses(
|
|
|
481
464
|
const unavailable = mandatoryResponsesReasoningReplayUnavailable({
|
|
482
465
|
body,
|
|
483
466
|
clientThreadId: reasoningReplayConversationId,
|
|
467
|
+
clientPrincipalId: replayPrincipal.clientPrincipalId,
|
|
484
468
|
providerName: route.providerName,
|
|
485
469
|
provider: route.provider,
|
|
486
470
|
adapterName: route.provider.adapter,
|
|
@@ -525,12 +509,14 @@ export async function executeComboResponses(
|
|
|
525
509
|
const payloadEligible = (target: (typeof combo.targets)[number]): boolean =>
|
|
526
510
|
comboPayloadReadable || !unreadableEncryptedAgentTask || canDecryptUnreadableAgentTask(target);
|
|
527
511
|
const meteredAllowed = admissionMayUseMeteredComboTargets(config, options.admission, combo);
|
|
528
|
-
|
|
512
|
+
// Recovery can replace unreadable encrypted input, but cannot relax other admission checks.
|
|
513
|
+
const recoveryEligible = (target: (typeof combo.targets)[number]): boolean =>
|
|
529
514
|
(meteredAllowed || !target.metered)
|
|
530
515
|
&& (combo.strategy !== "jev" || target.provider !== JEV_PROVIDER_ID)
|
|
531
|
-
&& payloadEligible(target)
|
|
532
516
|
&& reasoningReplayEligible(target)
|
|
533
517
|
&& (protocolLanes?.pickable(target) ?? true);
|
|
518
|
+
const targetEligible = (target: (typeof combo.targets)[number]): boolean =>
|
|
519
|
+
payloadEligible(target) && recoveryEligible(target);
|
|
534
520
|
const onlyReplayIncompatibleTargetsRemain = (excluded: Iterable<string> = []): boolean => {
|
|
535
521
|
const excludedKeys = new Set(excluded);
|
|
536
522
|
const remaining = combo.targets.filter(target => {
|
|
@@ -544,16 +530,13 @@ export async function executeComboResponses(
|
|
|
544
530
|
let encryptedTaskRecoveryAttempted = false;
|
|
545
531
|
let recoveryFailureReason: AgentTaskRecoveryFailureReason | undefined;
|
|
546
532
|
let storedPool401ReplayDispatched = false;
|
|
533
|
+
const recovery = agentTaskRecoveryConfig(config);
|
|
534
|
+
const encryptedTaskRecoveryAdmitted = (options.inboundWire ?? "responses") === "responses"
|
|
535
|
+
&& isThreadSpawnRequest(req.headers) && !!recovery && !options.comboAttempt;
|
|
547
536
|
const recoverUnreadableEncryptedTask = async (): Promise<boolean> => {
|
|
548
537
|
if (encryptedTaskRecoveryAttempted) return false;
|
|
549
538
|
encryptedTaskRecoveryAttempted = true;
|
|
550
|
-
|
|
551
|
-
if (
|
|
552
|
-
(options.inboundWire ?? "responses") !== "responses"
|
|
553
|
-
|| !isThreadSpawnRequest(req.headers)
|
|
554
|
-
|| !recovery
|
|
555
|
-
|| options.comboAttempt
|
|
556
|
-
) {
|
|
539
|
+
if (!encryptedTaskRecoveryAdmitted || !recovery) {
|
|
557
540
|
discardEncryptedAgentTaskRecovery(
|
|
558
541
|
req,
|
|
559
542
|
(body as { input?: unknown } | undefined)?.input,
|
|
@@ -598,6 +581,7 @@ export async function executeComboResponses(
|
|
|
598
581
|
const pickWithWait = (pickOptions: {
|
|
599
582
|
exclude?: Iterable<string>;
|
|
600
583
|
eligible?: (target: NonNullable<typeof combo>["targets"][number]) => boolean;
|
|
584
|
+
allowCooldownReprobe?: boolean;
|
|
601
585
|
now?: number;
|
|
602
586
|
}) => pickComboTargetWithWait(config, comboId, {
|
|
603
587
|
...pickOptions,
|
|
@@ -623,9 +607,17 @@ export async function executeComboResponses(
|
|
|
623
607
|
eligible: targetEligible,
|
|
624
608
|
now: initialNow,
|
|
625
609
|
});
|
|
610
|
+
// Opt-in JEV session pin (#7525); override routes neither read nor write it, like the lane recall.
|
|
611
|
+
const jevPin = options.compactionRoutingOverride || options.mainHardLockFallbackOverride
|
|
612
|
+
? undefined
|
|
613
|
+
: jevSessionPinScope({ combo, comboId, admission: options.admission, lane: sessionLaneIdFromRequest(req.headers) });
|
|
626
614
|
|
|
627
615
|
if (unreadableEncryptedAgentTask && !pick) {
|
|
628
|
-
pick = await pickWithWait({
|
|
616
|
+
pick = await pickWithWait({
|
|
617
|
+
eligible: recoveryEligible,
|
|
618
|
+
allowCooldownReprobe: encryptedTaskRecoveryAdmitted,
|
|
619
|
+
now: initialNow,
|
|
620
|
+
});
|
|
629
621
|
if (!pick) {
|
|
630
622
|
discardEncryptedAgentTaskRecovery(
|
|
631
623
|
req,
|
|
@@ -636,7 +628,7 @@ export async function executeComboResponses(
|
|
|
636
628
|
return options.abortSignal?.aborted
|
|
637
629
|
? clientCancelledResponse()
|
|
638
630
|
: comboUnavailable(comboId, undefined,
|
|
639
|
-
comboExclusionReasons(config, comboId,
|
|
631
|
+
comboExclusionReasons(config, comboId, recoveryEligible));
|
|
640
632
|
}
|
|
641
633
|
if (!(await recoverUnreadableEncryptedTask())) {
|
|
642
634
|
return options.abortSignal?.aborted
|
|
@@ -684,7 +676,7 @@ export async function executeComboResponses(
|
|
|
684
676
|
const first = choices[0];
|
|
685
677
|
if (!first) {
|
|
686
678
|
return comboUnavailable(comboId, undefined, comboExclusionReasons(config, comboId, target =>
|
|
687
|
-
targetEligible(target) && target.provider !== JEV_PROVIDER_ID && jevChoiceEfforts(config, target) !== undefined));
|
|
679
|
+
targetEligible(target) && target.provider !== JEV_PROVIDER_ID && jevChoiceEfforts(config, target, false) !== undefined));
|
|
688
680
|
}
|
|
689
681
|
const resolvedFailOpenEffort = resolveEffortAtOrBelow(
|
|
690
682
|
"medium",
|
|
@@ -697,8 +689,13 @@ export async function executeComboResponses(
|
|
|
697
689
|
: null,
|
|
698
690
|
};
|
|
699
691
|
const decisionStartedAt = Date.now();
|
|
692
|
+
const pinReuse = jevPin?.reuse(
|
|
693
|
+
choices.map(choice => choice.candidate),
|
|
694
|
+
combo.decisionQuotaSignals === true ? { config, tiers: combo.decisionQuotaTiers } : undefined,
|
|
695
|
+
);
|
|
700
696
|
let decision: JevDecision;
|
|
701
|
-
|
|
697
|
+
if (pinReuse?.decision) decision = pinReuse.decision;
|
|
698
|
+
else try {
|
|
702
699
|
decision = await resolveJevComboDecision({
|
|
703
700
|
body,
|
|
704
701
|
candidates: choices.map(choice => choice.candidate),
|
|
@@ -732,6 +729,7 @@ export async function executeComboResponses(
|
|
|
732
729
|
latencyMs: Math.max(0, Date.now() - decisionStartedAt),
|
|
733
730
|
};
|
|
734
731
|
}
|
|
732
|
+
if (pinReuse?.released) decision = { ...decision, pinReason: pinReuse.released };
|
|
735
733
|
jevDecision = decision;
|
|
736
734
|
const selected = choices.find(choice => choice.candidate.key === decision.targetKey) ?? first;
|
|
737
735
|
pick = { ...selected.pick, attempted: [targetKey(selected.pick.target)] };
|
|
@@ -752,6 +750,8 @@ export async function executeComboResponses(
|
|
|
752
750
|
: {}),
|
|
753
751
|
...(decision.usage ? { usage: decision.usage } : {}),
|
|
754
752
|
...(decision.quota ? { quota: decision.quota } : {}),
|
|
753
|
+
...(decision.pinned ? { pinned: true } : {}),
|
|
754
|
+
...(decision.pinReason ? { pinReason: decision.pinReason } : {}),
|
|
755
755
|
});
|
|
756
756
|
console.debug("[combo] JEV decision", {
|
|
757
757
|
backend: decision.backend,
|
|
@@ -759,6 +759,7 @@ export async function executeComboResponses(
|
|
|
759
759
|
effort: decision.effort,
|
|
760
760
|
gate: decision.gate,
|
|
761
761
|
latencyMs: decision.latencyMs,
|
|
762
|
+
...(decision.pinReason ? { pinReason: decision.pinReason } : {}),
|
|
762
763
|
...(decision.confidence !== undefined ? { confidence: decision.confidence } : {}),
|
|
763
764
|
...(decision.chosenProbability !== undefined
|
|
764
765
|
? { chosenProbability: decision.chosenProbability }
|
|
@@ -771,7 +772,7 @@ export async function executeComboResponses(
|
|
|
771
772
|
const decision = comboRouteDecisionTrace(config, comboId, pick, requestedModel);
|
|
772
773
|
const selectedReason = options.memoryModelPhase
|
|
773
774
|
? memoryModelRouteReason(options.memoryModelPhase)
|
|
774
|
-
: toolLoopPin ? COMBO_TOOL_LOOP_PIN_REASON : undefined;
|
|
775
|
+
: toolLoopPin ? COMBO_TOOL_LOOP_PIN_REASON : jevDecision?.pinned ? JEV_SESSION_PIN_ROUTE_REASON : undefined;
|
|
775
776
|
logCtx.routeDecision = selectedReason
|
|
776
777
|
? { ...decision, selected: { ...decision.selected, reason: selectedReason } }
|
|
777
778
|
: decision;
|
|
@@ -858,6 +859,22 @@ export async function executeComboResponses(
|
|
|
858
859
|
// The physical destination after provider aliases and blockedModelRedirects: hops are
|
|
859
860
|
// classified by where the request really goes, not by the selector the combo names.
|
|
860
861
|
const targetRoute = routeConcreteModel(config, `${pick.target.provider}/${pick.target.model}`);
|
|
862
|
+
// Selection-free hard-lock preflight grants no hop. Enforce this actual first destination
|
|
863
|
+
// against the locked source, after aliases and redirects resolve.
|
|
864
|
+
if (firstComboTarget && options.mainHardLockFallbackOverride) {
|
|
865
|
+
const hop = guardFallbackHop(config, {
|
|
866
|
+
site: "combo",
|
|
867
|
+
route: `combo/${comboId}`,
|
|
868
|
+
aliases: [requestedModel],
|
|
869
|
+
from: { provider: OPENAI_CODEX_PROVIDER_ID, model: options.mainHardLockFallbackOverride.sourceModel },
|
|
870
|
+
to: { provider: targetRoute.providerName, model: targetRoute.modelId },
|
|
871
|
+
trigger: "hard_lock",
|
|
872
|
+
admission: options.admission,
|
|
873
|
+
});
|
|
874
|
+
if (!hop.ok) return hop.response;
|
|
875
|
+
const declaredCommit = pendingHopCommit;
|
|
876
|
+
pendingHopCommit = declaredCommit ? () => { declaredCommit(); hop.commit(); } : hop.commit;
|
|
877
|
+
}
|
|
861
878
|
// OCX-11: every later dispatch after a failure is a hop when the target changed. One check
|
|
862
879
|
// here covers the ordinary failover pick and the recovery picks alike.
|
|
863
880
|
if (!firstComboTarget && lastFailure && lastFailedTarget) {
|
|
@@ -1014,6 +1031,7 @@ export async function executeComboResponses(
|
|
|
1014
1031
|
&& provider && provider.disabled !== true
|
|
1015
1032
|
&& currentCombo?.targets.some(target => targetKey(target) === targetKey(completedTarget))) {
|
|
1016
1033
|
rememberComboForLane(sessionLaneIdFromRequest(req.headers), comboId, completedTarget, model, writerGeneration);
|
|
1034
|
+
jevPin?.complete(targetKey(completedTarget), initialJevDecision, writerGeneration);
|
|
1017
1035
|
}
|
|
1018
1036
|
options.onResponseComplete?.(model);
|
|
1019
1037
|
},
|
|
@@ -1026,6 +1044,8 @@ export async function executeComboResponses(
|
|
|
1026
1044
|
if (childLog.terminalIncompleteReason !== undefined) logCtx.terminalIncompleteReason = childLog.terminalIncompleteReason;
|
|
1027
1045
|
if (childLog.terminalErrorCode !== undefined) logCtx.terminalErrorCode = childLog.terminalErrorCode;
|
|
1028
1046
|
if (childLog.upstreamError !== undefined) logCtx.upstreamError = childLog.upstreamError;
|
|
1047
|
+
// A committed stream that ends failed is a target failure too; incomplete is an answer.
|
|
1048
|
+
if (status === "failed") jevPin?.forget();
|
|
1029
1049
|
options.onNativePassthroughTerminal?.(status);
|
|
1030
1050
|
},
|
|
1031
1051
|
});
|
|
@@ -1065,6 +1085,7 @@ export async function executeComboResponses(
|
|
|
1065
1085
|
},
|
|
1066
1086
|
}) : await requestDispatchers.handleResponses(childRequest, config, childLog, {
|
|
1067
1087
|
...options,
|
|
1088
|
+
replayPrincipal,
|
|
1068
1089
|
// A bridge child is a concrete route; the native source belongs to this loop only.
|
|
1069
1090
|
...(options.protocolSource ? { protocolSource: undefined } : {}),
|
|
1070
1091
|
// After the spread: the child must run on THIS target's ladder, not on the holder the
|
|
@@ -1099,6 +1120,7 @@ export async function executeComboResponses(
|
|
|
1099
1120
|
retainCancelledAttempt();
|
|
1100
1121
|
return clientCancelledResponse();
|
|
1101
1122
|
}
|
|
1123
|
+
jevPin?.forget();
|
|
1102
1124
|
finishRequestAttempt(attempt, 502, Date.now() - started, childLog.usage);
|
|
1103
1125
|
throw error;
|
|
1104
1126
|
}
|
|
@@ -1123,6 +1145,7 @@ export async function executeComboResponses(
|
|
|
1123
1145
|
retainCancelledAttempt();
|
|
1124
1146
|
return clientCancelledResponse();
|
|
1125
1147
|
}
|
|
1148
|
+
jevPin?.forget();
|
|
1126
1149
|
finishRequestAttempt(attempt, 502, Date.now() - started, childLog.usage);
|
|
1127
1150
|
throw error;
|
|
1128
1151
|
}
|
|
@@ -1179,6 +1202,7 @@ export async function executeComboResponses(
|
|
|
1179
1202
|
retainCancelledAttempt();
|
|
1180
1203
|
return clientCancelledResponse();
|
|
1181
1204
|
}
|
|
1205
|
+
jevPin?.forget();
|
|
1182
1206
|
finishRequestAttempt(attempt, 502, Date.now() - started, childLog.usage);
|
|
1183
1207
|
throw error;
|
|
1184
1208
|
}
|
|
@@ -1210,6 +1234,8 @@ export async function executeComboResponses(
|
|
|
1210
1234
|
}
|
|
1211
1235
|
attemptRetained = true;
|
|
1212
1236
|
lastFailure = failure.response;
|
|
1237
|
+
// A real target failure ends the session pin; the next turn is decided afresh (#7525).
|
|
1238
|
+
jevPin?.forget();
|
|
1213
1239
|
if (!quotaFailure && (lastFailure.status === 429 || lastFailure.status === 402)) {
|
|
1214
1240
|
quotaFailure = lastFailure;
|
|
1215
1241
|
quotaFailedChildLog = childLog;
|
|
@@ -1236,6 +1262,7 @@ export async function executeComboResponses(
|
|
|
1236
1262
|
: comboFailureDecision(failure.response.status, failure.classificationText, {
|
|
1237
1263
|
code: failure.upstreamCode,
|
|
1238
1264
|
codexModelRefusal: failure.codexModelRefusal,
|
|
1265
|
+
verifiedPlanRefusal: failure.verifiedPlanRefusal,
|
|
1239
1266
|
// The adapter the failed leg actually resolved: a configured `kiro` provider can route a
|
|
1240
1267
|
// model through another wire via `modelAdapters`, and an unresolved leg grants no hop.
|
|
1241
1268
|
failedAdapter: childLog.providerAdapter,
|
|
@@ -1251,6 +1278,7 @@ export async function executeComboResponses(
|
|
|
1251
1278
|
const recoveredTarget = await pickWithWait({
|
|
1252
1279
|
exclude: pick.attempted,
|
|
1253
1280
|
eligible: target => {
|
|
1281
|
+
if (!recoveryEligible(target)) return false;
|
|
1254
1282
|
try {
|
|
1255
1283
|
const route = routeConcreteModel(config, `${target.provider}/${target.model}`);
|
|
1256
1284
|
return route.codexAccountMode === undefined
|
|
@@ -1339,10 +1367,11 @@ export async function executeComboResponses(
|
|
|
1339
1367
|
const failedTargetCooled = failureCooldownScope !== "none"
|
|
1340
1368
|
&& failedTargetCooldownRecorded
|
|
1341
1369
|
&& isComboTargetInCooldown(comboId, pick.target, failureNow);
|
|
1342
|
-
//
|
|
1343
|
-
//
|
|
1370
|
+
// Drop exclusions for the single-target retry, but wait for normal cooldown
|
|
1371
|
+
// expiry: an in-flight request cannot reserve a fresh recovery pass.
|
|
1344
1372
|
const retryAfterCooldown = () =>
|
|
1345
1373
|
pickWithWait({
|
|
1374
|
+
allowCooldownReprobe: false,
|
|
1346
1375
|
eligible: targetEligible,
|
|
1347
1376
|
now: failureNow,
|
|
1348
1377
|
});
|
|
@@ -1384,6 +1413,7 @@ export async function executeComboResponses(
|
|
|
1384
1413
|
if (unreadableEncryptedAgentTask && !comboPayloadReadable) {
|
|
1385
1414
|
const recoveredTarget = await pickWithWait({
|
|
1386
1415
|
exclude: attemptedTargets,
|
|
1416
|
+
eligible: recoveryEligible,
|
|
1387
1417
|
now: failureNow,
|
|
1388
1418
|
});
|
|
1389
1419
|
if (recoveredTarget && await recoverUnreadableEncryptedTask()) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TranslatorBudget } from "../../lib/translator-budget";
|
|
2
2
|
import { carryResponseToolOwnership } from "./response-tool-ownership";
|
|
3
3
|
import { finalizeTranslatorBudgetResponse } from "../../lib/translator-budget";
|
|
4
|
-
import { isNonReplayableResponse, markResponseNonReplayable } from "../../lib/upstream-retry";
|
|
4
|
+
import { carryReplayRefusal, isNonReplayableResponse, markResponseNonReplayable } from "../../lib/upstream-retry";
|
|
5
|
+
import { isVerifiedModelNotInPlanResponse, markVerifiedModelNotInPlanResponse } from "../../lib/errors";
|
|
5
6
|
import {
|
|
6
7
|
isNativePassthroughSseResponse,
|
|
7
8
|
markNativePassthroughSseResponse,
|
|
@@ -50,6 +51,7 @@ export function finalizeOwnedTranslatorBudget(response: Response, budget: Transl
|
|
|
50
51
|
}
|
|
51
52
|
if (isPreinspectedJsonResponse(response)) markPreinspectedJsonResponse(finalizedResponse);
|
|
52
53
|
if (isNonReplayableResponse(response)) markResponseNonReplayable(finalizedResponse);
|
|
54
|
+
if (isVerifiedModelNotInPlanResponse(response)) markVerifiedModelNotInPlanResponse(finalizedResponse);
|
|
53
55
|
if (runTurnAdapterSseResponses.has(response)) runTurnAdapterSseResponses.add(finalizedResponse);
|
|
54
56
|
return carryResponseToolOwnership(response, finalizedResponse);
|
|
55
57
|
}
|
|
@@ -72,11 +74,12 @@ export function finalizeAccountLease(response: Response, release: () => void, on
|
|
|
72
74
|
});
|
|
73
75
|
const wrapped = new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers });
|
|
74
76
|
if (isNonReplayableResponse(response)) markResponseNonReplayable(wrapped);
|
|
77
|
+
if (isVerifiedModelNotInPlanResponse(response)) markVerifiedModelNotInPlanResponse(wrapped);
|
|
75
78
|
if (isNativePassthroughSseResponse(response)) markNativePassthroughSseResponse(wrapped);
|
|
76
79
|
if (isEagerRelaySseResponse(response)) markEagerRelaySseResponse(wrapped);
|
|
77
80
|
if (isPreinspectedJsonResponse(response)) markPreinspectedJsonResponse(wrapped);
|
|
78
81
|
if (runTurnAdapterSseResponses.has(response)) runTurnAdapterSseResponses.add(wrapped);
|
|
79
|
-
return carryResponseToolOwnership(response, wrapped);
|
|
82
|
+
return carryResponseToolOwnership(response, carryReplayRefusal(response, wrapped));
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { effectiveAzureOutputBudget } from "../../adapters/azure";
|
|
2
|
+
import { normalizeThinkingOptions } from "../../clients/reasoning-controls";
|
|
3
|
+
import { nativeEffortClamp, shouldApplyNativeEffortClamp } from "../../codex/catalog";
|
|
2
4
|
import { sanitizeLogMetadataString } from "../../lib/redact";
|
|
3
5
|
import type { RouteResult } from "../../router";
|
|
4
6
|
import type { InboundWire } from "../../providers/registry";
|
|
@@ -341,6 +343,15 @@ export async function applyFinalRouteRequestNormalization(args: {
|
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
{
|
|
346
|
+
// Native passthrough keeps its snapshot-owned effort contract, including saved exclusions.
|
|
347
|
+
if (!shouldApplyNativeEffortClamp(route.providerName, route.provider, finalSelectedModelId)) {
|
|
348
|
+
const previousEffort = parsed.options.reasoning;
|
|
349
|
+
normalizeThinkingOptions(route.provider, route.modelId, parsed.options);
|
|
350
|
+
if (previousEffort !== undefined && parsed.options.reasoning === undefined) {
|
|
351
|
+
const raw = parsed._rawBody as { reasoning?: unknown } | undefined;
|
|
352
|
+
if (raw) raw.reasoning = stripEmptyLadderEffort(raw.reasoning, []);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
344
355
|
const { applyEffortCap, effortCapAppliesTo, supportedLadderFor } = await import("../effort-policy");
|
|
345
356
|
const surface = collabSurface(parsed);
|
|
346
357
|
if (effortCapAppliesTo(surface, req.headers, config, parsed._compactionRequest === true)) {
|
|
@@ -357,15 +368,17 @@ export async function applyFinalRouteRequestNormalization(args: {
|
|
|
357
368
|
}
|
|
358
369
|
|
|
359
370
|
{
|
|
360
|
-
const {
|
|
371
|
+
const raw = parsed._rawBody as { reasoning?: { effort?: string } } | undefined;
|
|
372
|
+
// The parser folds `ultra` to `max` only in options.reasoning; the passthrough adapter
|
|
373
|
+
// serializes the raw body, so a raw `ultra` must reach the clamp itself (#7590).
|
|
374
|
+
const rawUltra = raw?.reasoning && typeof raw.reasoning === "object" && raw.reasoning.effort === "ultra";
|
|
361
375
|
const clamped = shouldApplyNativeEffortClamp(route.providerName, route.provider, finalSelectedModelId)
|
|
362
|
-
? nativeEffortClamp(route.modelId, parsed.options.reasoning)
|
|
376
|
+
? nativeEffortClamp(route.modelId, rawUltra ? "ultra" : parsed.options.reasoning)
|
|
363
377
|
: null;
|
|
364
378
|
if (clamped) {
|
|
365
379
|
parsed.options.reasoning = clamped;
|
|
366
|
-
const raw = parsed._rawBody as { reasoning?: { effort?: string } } | undefined;
|
|
367
380
|
if (raw?.reasoning && typeof raw.reasoning === "object") raw.reasoning.effort = clamped;
|
|
368
|
-
logCtx.requestedEffort = `${logCtx.requestedEffort ?? "max"}->${clamped}`;
|
|
381
|
+
logCtx.requestedEffort = `${logCtx.requestedEffort ?? (rawUltra ? "ultra" : "max")}->${clamped}`;
|
|
369
382
|
}
|
|
370
383
|
}
|
|
371
384
|
// Chat ingress cannot strip effort against a provisional policy pick. Apply the
|
|
@@ -547,6 +547,7 @@ export async function attemptOpaqueBlobRecovery<Failure = Response>(
|
|
|
547
547
|
const rejectedScope = args.parsed._reasoningReplayScope
|
|
548
548
|
? {
|
|
549
549
|
clientThreadId: args.parsed._reasoningReplayScope.clientThreadId,
|
|
550
|
+
clientPrincipalId: args.parsed._reasoningReplayScope.clientPrincipalId,
|
|
550
551
|
...(args.parsed._reasoningReplayScope.current
|
|
551
552
|
? { current: { ...args.parsed._reasoningReplayScope.current } }
|
|
552
553
|
: {}),
|
|
@@ -49,6 +49,8 @@ export interface ConsumedComboFailure {
|
|
|
49
49
|
* marker, so the combo loop reads it here and stops instead of sending the turn to a later target.
|
|
50
50
|
*/
|
|
51
51
|
nonReplayable?: boolean;
|
|
52
|
+
/** The failed attempt was an adapter-normalized plan refusal; only this grants its combo hop. */
|
|
53
|
+
verifiedPlanRefusal?: boolean;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
|
|
@@ -128,6 +130,11 @@ export interface HandleResponsesOptions {
|
|
|
128
130
|
* which is why it refused the whole env_key flow instead of serving it.
|
|
129
131
|
*/
|
|
130
132
|
admission?: DataPlaneAdmission;
|
|
133
|
+
/**
|
|
134
|
+
* Internal caller identity captured before Combo strips provisional credentials. An existing
|
|
135
|
+
* holder with no principal preserves keyless replay; never populate it from client data.
|
|
136
|
+
*/
|
|
137
|
+
replayPrincipal?: Readonly<{ clientPrincipalId: string | undefined }>;
|
|
131
138
|
/** Called at most once after the complete client body is read and accepted for dispatch. */
|
|
132
139
|
onRequestBodyRead?: () => void;
|
|
133
140
|
/** Internal handoff for retry wrappers that must reuse the already-accounted request body. */
|
|
@@ -344,6 +344,7 @@ function routeReasoningReplayIdentity(args: {
|
|
|
344
344
|
export function mandatoryResponsesReasoningReplayUnavailable(args: {
|
|
345
345
|
body: unknown;
|
|
346
346
|
clientThreadId: string | undefined;
|
|
347
|
+
clientPrincipalId?: string;
|
|
347
348
|
providerName: string;
|
|
348
349
|
provider: OcxProviderConfig;
|
|
349
350
|
adapterName: string;
|
|
@@ -359,7 +360,7 @@ export function mandatoryResponsesReasoningReplayUnavailable(args: {
|
|
|
359
360
|
) return false;
|
|
360
361
|
|
|
361
362
|
const current = routeReasoningReplayIdentity(args);
|
|
362
|
-
return reasoningReplayServingIdentityChanged({ clientThreadId, current });
|
|
363
|
+
return reasoningReplayServingIdentityChanged({ clientThreadId, clientPrincipalId: args.clientPrincipalId, current });
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getCombo, targetKey, type JevCandidate } from "../../combos";
|
|
2
|
+
import { isCodexReasoningEffort } from "../../reasoning-effort";
|
|
3
|
+
import { routeConcreteModel } from "../../router";
|
|
4
|
+
import { supportedLadderFor } from "../effort-policy";
|
|
5
|
+
import type { OcxComboDefaultEffort, OcxConfig } from "../../types";
|
|
6
|
+
|
|
7
|
+
/** A JEV target's effort choices plus, when quota signals are on, its resolved native identity. */
|
|
8
|
+
export interface JevChoiceIdentity {
|
|
9
|
+
reasoningEfforts: OcxComboDefaultEffort[];
|
|
10
|
+
quotaIdentity?: JevCandidate["quotaIdentity"];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** A target's JEV effort choices, or undefined when an explicit allowlist has none still supported. */
|
|
14
|
+
export function jevChoiceEfforts(
|
|
15
|
+
config: OcxConfig,
|
|
16
|
+
target: NonNullable<ReturnType<typeof getCombo>>["targets"][number],
|
|
17
|
+
quotaSignals: boolean,
|
|
18
|
+
): JevChoiceIdentity | undefined {
|
|
19
|
+
let ladder: string[] | undefined;
|
|
20
|
+
// null tells the quota reader the route did not resolve, so it reads unknown rather than the configured alias.
|
|
21
|
+
let quotaIdentity: JevCandidate["quotaIdentity"] = quotaSignals ? null : undefined;
|
|
22
|
+
try {
|
|
23
|
+
const route = routeConcreteModel(config, targetKey(target));
|
|
24
|
+
ladder = supportedLadderFor({ provider: route.provider, modelId: route.modelId });
|
|
25
|
+
if (quotaSignals) quotaIdentity = { provider: route.providerName, model: route.modelId };
|
|
26
|
+
} catch {
|
|
27
|
+
// Preserve the existing routing-failure surface. Unknown capability becomes the explicit
|
|
28
|
+
// no-effort choice rather than broadening JEV's effort allowlist.
|
|
29
|
+
ladder = undefined;
|
|
30
|
+
}
|
|
31
|
+
const supportedEfforts = (ladder ?? []).filter(isCodexReasoningEffort) as OcxComboDefaultEffort[];
|
|
32
|
+
const configuredEfforts = target.reasoningEfforts;
|
|
33
|
+
const reasoningEfforts = configuredEfforts === undefined
|
|
34
|
+
? supportedEfforts
|
|
35
|
+
: configuredEfforts.filter(effort => supportedEfforts.includes(effort));
|
|
36
|
+
// An explicit allowlist is restrictive. If catalog capabilities drift until no configured
|
|
37
|
+
// effort remains supported, omit the target instead of silently broadening JEV's choices.
|
|
38
|
+
return configuredEfforts !== undefined && reasoningEfforts.length === 0 ? undefined : { reasoningEfforts, quotaIdentity };
|
|
39
|
+
}
|