feat(routing): add DISABLE_CONTEXT_WINDOW_CHECKS bypass for the direct-request input/context check (#10927)

Rescoped from #10606 — see PR body for the full rationale (combo-routing half made moot by #10162's advisory-only architecture, chatCore.ts hard-reject bypass retains real value).

Validated in an isolated worktree boarded onto origin/release/v3.8.50:
- 65/65 focused unit tests pass (chatcore-model-output-cap-wiring + feature-flags-settings).
- check-file-size, check-changelog-integrity: OK.
- typecheck:core: clean.
- check-complexity / check-cognitive-complexity: OK, both under baseline.

Co-authored-by: JxnLexn <10897478+JxnLexn@users.noreply.github.com>
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-20 22:04:03 -03:00
committed by GitHub
parent 118840131d
commit f71f3da08b
13 changed files with 143 additions and 6 deletions

View File

@@ -236,7 +236,7 @@ export const FEATURE_FLAG_DEFINITIONS: FeatureFlagDefinition[] = [
warningLevel: "info",
},
// ──────────────── Policies (4) ────────────────
// ──────────────── Policies (5) ────────────────
{
key: "TOOL_POLICY_MODE",
label: "Tool Policy Mode",
@@ -271,6 +271,18 @@ export const FEATURE_FLAG_DEFINITIONS: FeatureFlagDefinition[] = [
requiresRestart: true,
warningLevel: "info",
},
{
key: "DISABLE_CONTEXT_WINDOW_CHECKS",
label: "Disable Context Window Checks",
description:
"Skip OmniRoute's local context-window and max-input-token check for direct single-model requests. Upstream providers remain responsible for enforcing their actual limits. Off by default.",
descriptionI18nKey: "featureFlagDisableContextWindowChecksDescription",
category: "policies",
defaultValue: "false",
type: "boolean",
requiresRestart: false,
warningLevel: "danger",
},
{
key: "CAPABILITY_FILTER_ENABLED",
label: "Capability Filter",

View File

@@ -72,6 +72,22 @@ export function isCcCompatibleProviderEnabled(): boolean {
return isFeatureFlagEnabled("ENABLE_CC_COMPATIBLE_PROVIDER");
}
/**
* Context-window checks are fail-safe: an unavailable flag store must never
* silently disable local request bounds.
*/
export function areContextWindowChecksDisabled(): boolean {
try {
return isFeatureFlagEnabled("DISABLE_CONTEXT_WINDOW_CHECKS");
} catch (error) {
console.error(
"[featureFlags] Failed to resolve DISABLE_CONTEXT_WINDOW_CHECKS, keeping checks enabled:",
error instanceof Error ? error.message : error
);
return false;
}
}
export function isApiKeyRevealEnabledFlag(): boolean {
try {
return isFeatureFlagEnabled("ALLOW_API_KEY_REVEAL");