-
Notifications
You must be signed in to change notification settings - Fork 0
fix(reasoning): bootstrap metadata during catalog sync #526
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
06ec553
116c2ac
07b48da
bcdf559
b0900e5
3970601
bba6322
3d53e5f
eda8754
f9e3515
6f71931
9a60256
9e9b1d3
947bae9
f7f890f
544ebee
d24ff57
9a27e86
62849df
2f3f736
3a3de88
2d4d7a2
cf456e8
c155cc7
95c4875
4d37c35
641b05a
aa05b3e
8e532c5
9f7397e
1090b85
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 |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ import { | |
| import { admitCodexWrite, type CodexAdmission } from "./admission"; | ||
| import type { CodexCatalogSyncOptions } from "./catalog/sync"; | ||
| import { resetCodexAppServerCatalogStateCache } from "./app-server-processes"; | ||
| import { providerUsesReasoningMetadata, refreshReasoningMetadata } from "../providers/reasoning-metadata"; | ||
|
|
||
| export interface CodexSyncResult { | ||
| /** | ||
|
|
@@ -67,13 +68,21 @@ interface CodexSyncDeps { | |
| admitCodexWrite?: () => CodexSyncAdmission; | ||
| currentExternalCodexModelProvider?: typeof currentExternalCodexModelProvider; | ||
| collectCodexHomeDiagnostic?: typeof collectOrcaCodexHomeDiagnostic; | ||
| refreshReasoningMetadata?: typeof refreshReasoningMetadata; | ||
| } | ||
|
|
||
| const defaultDeps: CodexSyncDeps = { | ||
| refreshCodexModelCatalog, | ||
| injectCodexConfig, | ||
| refreshReasoningMetadata, | ||
| }; | ||
|
|
||
| async function refreshReasoningMetadataForSync(config: OcxConfig, deps: CodexSyncDeps): Promise<void> { | ||
| if (Object.values(config.providers).some(providerUsesReasoningMetadata)) { | ||
| await deps.refreshReasoningMetadata?.(); | ||
| } | ||
| } | ||
|
|
||
| function reportCodexHomeTarget( | ||
| log: Pick<Console, "log" | "error"> | null, | ||
| collectDiagnostic: typeof collectOrcaCodexHomeDiagnostic, | ||
|
|
@@ -234,6 +243,9 @@ export async function syncModelsToCodex( | |
| } | ||
|
|
||
| applyProxyEnv(config); // `ocx ensure`/`ocx sync` fetch provider models outside the server process | ||
| // Bootstrap the optional ladder snapshot before gathering the catalog. Keeping this in the | ||
| // sync plane prevents an unrelated models.dev fetch from interleaving with a routed turn. | ||
| await refreshReasoningMetadataForSync(config, deps); | ||
|
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.
On ordinary Useful? React with 👍 / 👎. |
||
| let added = 0; | ||
| let catalogPath: string | null = null; | ||
| let catalogPathForInjection: string | null | undefined; | ||
|
|
@@ -339,6 +351,7 @@ async function refreshCatalogForSync( | |
| let refreshOutcome: "committed" | "refused" | undefined; | ||
| let comboOmissions: ComboCatalogOmission[] = []; | ||
| try { | ||
| await refreshReasoningMetadataForSync(config, deps); | ||
| const cat = await deps.refreshCodexModelCatalog(config, undefined, catalogOptions); | ||
| refreshOutcome = cat.refreshOutcome; | ||
| added = cat.added; | ||
|
|
||
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.
When a configuration retains a disabled OpenCode Zen/Go provider but routes only through unrelated providers, this predicate still initiates the models.dev fetch even though catalog gathering explicitly excludes disabled providers. With a missing or stale snapshot and an unavailable models.dev endpoint, an otherwise unrelated startup or explicit sync can therefore wait for the 15-second refresh timeout before proceeding. Filter out
provider.disabled === truebefore testing whether metadata is needed.Useful? React with 👍 / 👎.