Repository navigation
feat(codex): expose declared Ultra Fast in the desktop speed picker #6927
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
Changes from all commits
be19fe7
f7cbbd7
3bc47b6
f6fc95f
de1ee9a
9d66fe1
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 |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ import { NATIVE_RESERVE_MODEL } from "./native-models"; | |
| import { isReserveCatalogProjection, type ReserveCatalogProjection } from "./reserve"; | ||
| import { deriveEntry, finishUpstreamNativeEntry, isExactComboCatalogEntry } from "./derive-entry"; | ||
| import { PICKER_ORDER_PRIORITY_BASE, SPAWN_PRIORITY_FIELD } from "./subagent-roster"; | ||
| import { preserveOperatorUltraFastTiers } from "./operator-tiers"; | ||
| import { applyConfiguredUltraFast } from "./configured-tiers"; | ||
| import { applyNativeUltraFastTier } from "./native-ultrafast"; | ||
|
|
||
| export interface ObservedCatalogEntryBuildInput { | ||
|
|
@@ -474,6 +474,8 @@ export function applyFullModelPickerOrder(entries: RawEntry[], order: readonly s | |
| export interface ObservedCatalogMergeInput { | ||
| /** Preserve operator-supplied Ultra Fast only from the exact persisted routed row. */ | ||
| readonly ultraFastTier?: boolean; | ||
| /** Current captured wire declarations; disk rows and templates never populate this set. */ | ||
| readonly configuredUltraFastSlugs?: ReadonlySet<string>; | ||
| readonly catalogModels: readonly RawEntry[]; | ||
| readonly baselineCatalogModels: readonly RawEntry[]; | ||
| readonly routedEntries: readonly RawEntry[]; | ||
|
|
@@ -515,6 +517,7 @@ export interface ObservedCatalogMergeInput { | |
| */ | ||
| export function mergeCatalogEntriesFromObservedState({ | ||
| ultraFastTier = false, | ||
| configuredUltraFastSlugs = new Set(), | ||
| catalogModels, | ||
| baselineCatalogModels, | ||
| routedEntries, | ||
|
|
@@ -866,7 +869,7 @@ export function mergeCatalogEntriesFromObservedState({ | |
| if (typeof entry.slug !== "string" || !entry.slug.includes("/") | ||
| || isNativeAliasCatalogEntry(entry) || isExactComboCatalogEntry(entry, exactComboSlugs) | ||
| || trustedAccountBoundNativeCatalogSlug(entry) !== undefined) continue; | ||
| preserveOperatorUltraFastTiers(entry, operatorRows.get(entry.slug), ultraFastTier); | ||
| applyConfiguredUltraFast(entry, operatorRows.get(entry.slug), configuredUltraFastSlugs.has(entry.slug), ultraFastTier); | ||
|
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.
When a Codex client obtains its catalog from AGENTS.md reference: src/AGENTS.md:L18-L18 Useful? React with 👍 / 👎. |
||
| } | ||
| const finalRoutedEntrySet = new Set(finalRoutedEntries); | ||
| const degradedPreservedCount = preservedRoutedEntries.filter(entry => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { COMBO_NAMESPACE } from "../../combos"; | ||
| import type { ResolvedFastPolicy } from "../../providers/fastwire"; | ||
| import { catalogModelSlug, type CatalogModel, type RawEntry } from "./parsing"; | ||
| import { preserveOperatorUltraFastTiers } from "./operator-tiers"; | ||
|
|
||
| const MANAGED_ULTRAFAST = "opencodex_managed_ultrafast"; | ||
|
|
||
| /** Advertise Ultra Fast only when the eligible final wire explicitly maps that exact tier. */ | ||
| export function supportsConfiguredUltraFast(policy: ResolvedFastPolicy | undefined): boolean { | ||
| return policy?.eligibility === "eligible" | ||
| && policy.fastWire?.kind === "service-tier" | ||
| && policy.fastWire.canonicalToWire.ultrafast === "ultrafast"; | ||
| } | ||
|
|
||
| /** Carry captured capability to the pure merge without treating persisted metadata as authority. */ | ||
| export function configuredUltraFastSlugs(models: readonly CatalogModel[]): ReadonlySet<string> { | ||
| const declarations = new Map<string, boolean>(); | ||
| for (const model of models) { | ||
| const slug = catalogModelSlug(model); | ||
| const supported = model.provider !== COMBO_NAMESPACE && model.nativeAlias !== true | ||
| && model.supportsServiceTier === true && model.supportsUltraFastTier === true; | ||
| // A conflicting duplicate cannot lend its capability to the surviving row. | ||
| declarations.set(slug, supported && declarations.get(slug) !== false); | ||
| } | ||
| return new Set([...declarations].filter(([, supported]) => supported).map(([slug]) => slug)); | ||
| } | ||
|
|
||
| /** Apply current configuration, or retain an independently supplied exact-row operator tier. */ | ||
| export function applyConfiguredUltraFast( | ||
| entry: RawEntry, | ||
| previous: RawEntry | undefined, | ||
| configured: boolean, | ||
| retainOperatorTier: boolean, | ||
| ): void { | ||
| // This marker only rejects stale generated metadata; it never authorizes a new tier. | ||
| const wasManaged = previous?.[MANAGED_ULTRAFAST] === entry.slug; | ||
| preserveOperatorUltraFastTiers(entry, wasManaged || configured ? undefined : previous, retainOperatorTier); | ||
| delete entry[MANAGED_ULTRAFAST]; | ||
| if (!configured) return; | ||
| entry.service_tiers = [...(Array.isArray(entry.service_tiers) ? entry.service_tiers : []), { | ||
| id: "ultrafast", | ||
| name: "Ultra Fast", | ||
| description: "Higher speed and usage; provider access required", | ||
| }]; | ||
| entry.additional_speed_tiers = [ | ||
| ...(Array.isArray(entry.additional_speed_tiers) ? entry.additional_speed_tiers : []), "ultrafast", | ||
| ]; | ||
| // Advertising a selectable capability does not opt the user into its increased usage. | ||
| entry[MANAGED_ULTRAFAST] = entry.slug; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
ultraFastTiersetting does not only retain hand-supplied tiers: for bare and account-boundgpt-6-astraandgpt-6.1-sol,mergeCatalogEntriesFromObservedStatecallsapplyNativeUltraFastTier(e, ultraFastTier), which actively adds generated Ultrafast descriptors. This sentence can mislead users about what enabling the setting changes (and the Korean translation repeats the same claim), so qualify it as the routed-row behavior and document the native-row generation here as well.AGENTS.md reference: docs-site/AGENTS.md:L7-L10
Useful? React with 👍 / 👎.