mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 18:21:27 +00:00
Reply: keep resolved runtime config
This commit is contained in:
@@ -80,4 +80,47 @@ describe("buildEmbeddedRunBaseParams runtime config", () => {
|
||||
|
||||
expect(resolved.config).toBe(runtimeConfig);
|
||||
});
|
||||
|
||||
it("keeps an already-resolved run config instead of reverting to a stale runtime snapshot", () => {
|
||||
const staleSnapshot: OpenClawConfig = {
|
||||
models: {
|
||||
providers: {
|
||||
openai: {
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
apiKey: {
|
||||
source: "env",
|
||||
provider: "default",
|
||||
id: "OPENAI_API_KEY",
|
||||
},
|
||||
models: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const resolvedRunConfig: OpenClawConfig = {
|
||||
models: {
|
||||
providers: {
|
||||
openai: {
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
apiKey: "resolved-runtime-key",
|
||||
models: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
setRuntimeConfigSnapshot(staleSnapshot, staleSnapshot);
|
||||
|
||||
const resolved = buildEmbeddedRunBaseParams({
|
||||
run: makeRun(resolvedRunConfig),
|
||||
provider: "openai",
|
||||
model: "gpt-4.1-mini",
|
||||
runId: "run-1",
|
||||
authProfile: resolveProviderScopedAuthProfile({
|
||||
provider: "openai",
|
||||
primaryProvider: "openai",
|
||||
}),
|
||||
});
|
||||
|
||||
expect(resolved.config).toBe(resolvedRunConfig);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,14 +125,14 @@ export const resolveEnforceFinalTag = (
|
||||
(run.skipProviderRuntimeHints ? false : undefined) ??
|
||||
(run.enforceFinalTag ||
|
||||
isReasoningTagProvider(provider, {
|
||||
config: resolveQueuedReplyRuntimeConfig(run.config),
|
||||
config: run.config,
|
||||
workspaceDir: run.workspaceDir,
|
||||
modelId: model,
|
||||
})),
|
||||
);
|
||||
|
||||
export function resolveModelFallbackOptions(run: FollowupRun["run"]) {
|
||||
const config = resolveQueuedReplyRuntimeConfig(run.config);
|
||||
const config = run.config;
|
||||
return {
|
||||
cfg: config,
|
||||
provider: run.provider,
|
||||
@@ -154,7 +154,7 @@ export function buildEmbeddedRunBaseParams(params: {
|
||||
authProfile: ReturnType<typeof resolveProviderScopedAuthProfile>;
|
||||
allowTransientCooldownProbe?: boolean;
|
||||
}) {
|
||||
const config = resolveQueuedReplyRuntimeConfig(params.run.config);
|
||||
const config = params.run.config;
|
||||
return {
|
||||
sessionFile: params.run.sessionFile,
|
||||
workspaceDir: params.run.workspaceDir,
|
||||
@@ -185,7 +185,7 @@ export function buildEmbeddedContextFromTemplate(params: {
|
||||
sessionCtx: TemplateContext;
|
||||
hasRepliedRef: { value: boolean } | undefined;
|
||||
}) {
|
||||
const config = resolveQueuedReplyRuntimeConfig(params.run.config);
|
||||
const config = params.run.config;
|
||||
return {
|
||||
sessionId: params.run.sessionId,
|
||||
sessionKey: params.run.sessionKey,
|
||||
|
||||
Reference in New Issue
Block a user