-
Notifications
You must be signed in to change notification settings - Fork 0
fix(providers): migrate stale Alibaba context windows #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
f700c56
bd5a0e8
f9ef2af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,13 @@ | |
| * | ||
| * This rewrites one thing: a window whose saved value is still byte-for-byte the | ||
| * wrong number this file names, on a provider that still carries the registry's | ||
| * adapter. A value the user changed does not match `from` and is left alone, and | ||
| * nothing else in the row is touched. Same shape and the same restraint as | ||
| * `model-rename-migration`, for the case where the id was right and the number | ||
| * was not. | ||
| * adapter and still points at the registry's own endpoint. A value the user | ||
| * changed does not match `from` and is left alone, and nothing else in the row | ||
| * is touched. Same shape and the same restraint as `model-rename-migration`, | ||
| * for the case where the id was right and the number was not. | ||
| */ | ||
| import { PROVIDER_REGISTRY } from "./registry"; | ||
| import type { OcxConfig } from "../types"; | ||
| import type { OcxConfig, OcxProviderConfig } from "../types"; | ||
|
|
||
| export interface StaleContextWindow { | ||
| /** Registry provider id whose saved rows may carry the wrong window. */ | ||
|
|
@@ -34,15 +34,18 @@ export interface StaleContextWindowProjection { | |
| } | ||
|
|
||
| /** | ||
| * Cognition windows corrected against a live `GetCascadeModelConfigs` response. | ||
| * Known-bad registry context windows corrected against provider evidence. | ||
| * | ||
| * The shipped table had been assembled from each model's ORIGINAL vendor window | ||
| * The Alibaba Token Plan correction comes from gateway boundary probes. The | ||
| * shipped Cognition table had been assembled from each model's ORIGINAL vendor window | ||
| * rather than from what Cognition serves, so the Claude rows claimed 200k against | ||
| * an actual 1M and Grok claimed 256k against 500k. Cognition documents no window | ||
| * anywhere, so the per-account catalog is the only first-party source; these are | ||
| * the degraded-mode figures, and live discovery supersedes them when it runs. | ||
| */ | ||
| export const STALE_CONTEXT_WINDOWS: readonly StaleContextWindow[] = [ | ||
| { provider: "alibaba-token-plan", model: "qwen3.8-max", from: 983_616, to: 1_000_000 }, | ||
| { provider: "alibaba-token-plan-intl", model: "qwen3.8-max", from: 983_616, to: 1_000_000 }, | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| { provider: "devin", model: "swe-1-7", from: 256_000, to: 262_000 }, | ||
| { provider: "devin", model: "swe-1-7-lightning", from: 256_000, to: 202_752 }, | ||
| { provider: "devin", model: "gpt-5-6-sol", from: 1_050_000, to: 1_000_000 }, | ||
|
|
@@ -55,9 +58,22 @@ export const STALE_CONTEXT_WINDOWS: readonly StaleContextWindow[] = [ | |
| { provider: "devin", model: "grok-4-5", from: 256_000, to: 500_000 }, | ||
| ]; | ||
|
|
||
| function providerStillMatchesRegistry(id: string, adapter: unknown): boolean { | ||
| const entry = PROVIDER_REGISTRY.find(row => row.id === id); | ||
| return entry !== undefined && entry.adapter === adapter; | ||
| /** | ||
| * Only repair a row that still points at the registry's own endpoint. The | ||
| * adapter alone cannot tell the registry provider from another destination — | ||
| * a repointed `alibaba-token-plan-intl` row keeps the generic `openai-chat` | ||
| * adapter, but the windows on its custom gateway are the user's own figures. | ||
| * Same ownership rule as `model-rename-migration`. | ||
| */ | ||
| function providerStillMatchesRegistry(name: string, prov: OcxProviderConfig): boolean { | ||
| const entry = PROVIDER_REGISTRY.find(row => row.id === name); | ||
| if (!entry || entry.adapter !== prov.adapter) return false; | ||
| if (!prov.baseUrl || !entry.baseUrl) return true; | ||
| const choices = entry.baseUrlChoices?.map(choice => choice.baseUrl) ?? []; | ||
| const known = [entry.baseUrl, ...choices] | ||
| .filter((url): url is string => typeof url === "string") | ||
| .map(url => url.replace(/\/+$/, "")); | ||
| return known.includes(prov.baseUrl.replace(/\/+$/, "")); | ||
|
Comment on lines
+73
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Equivalent registry URLs can prevent the context-window repair An official endpoint with whitespace or URL-equivalent casing fails this string comparison because normalization removes only trailing slashes. Valid saved rows then retain stale context windows. Learn moreProvider Example: A saved Alibaba row using Recommended fix: Reuse or extract the URL-aware normalization used by Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
|
|
||
| /** Pure projection. The caller decides whether to persist. */ | ||
|
|
@@ -71,7 +87,7 @@ export function projectStaleContextWindows( | |
| for (const entry of entries) { | ||
| const prov = config.providers?.[entry.provider]; | ||
| if (!prov) continue; | ||
| if (!providerStillMatchesRegistry(entry.provider, prov.adapter)) continue; | ||
| if (!providerStillMatchesRegistry(entry.provider, prov)) continue; | ||
| const windows = prov.modelContextWindows; | ||
| if (!windows || windows[entry.model] !== entry.from) continue; | ||
| windows[entry.model] = entry.to; | ||
|
|
@@ -89,4 +105,3 @@ export function projectStaleContextWindows( | |
|
|
||
| return { config, changed: repaired.size > 0, warnings }; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.