mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix: write complete release provider config
This commit is contained in:
@@ -86,6 +86,19 @@ function shouldSeedProviderConfigModels(providerMeta) {
|
||||
);
|
||||
}
|
||||
|
||||
function buildReleaseProviderConfigOverride(providerMeta) {
|
||||
if (!shouldSeedProviderConfigModels(providerMeta)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
...(typeof providerMeta.baseUrl === "string" ? { baseUrl: providerMeta.baseUrl } : {}),
|
||||
models: [],
|
||||
...(typeof providerMeta.timeoutSeconds === "number"
|
||||
? { timeoutSeconds: providerMeta.timeoutSeconds }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
const PACKAGE_DIST_INVENTORY_RELATIVE_PATH = "dist/postinstall-inventory.json";
|
||||
const OMITTED_QA_EXTENSION_PREFIXES = [
|
||||
"dist/extensions/qa-channel/",
|
||||
@@ -1848,14 +1861,15 @@ async function runInstalledModelsSet(params) {
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
if (shouldSeedProviderConfigModels(params.providerConfig)) {
|
||||
const providerConfigOverride = buildReleaseProviderConfigOverride(params.providerConfig);
|
||||
if (providerConfigOverride) {
|
||||
await runInstalledCli({
|
||||
cliPath: params.cliPath,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.models`,
|
||||
"[]",
|
||||
`models.providers.${params.providerConfig.extensionId}`,
|
||||
JSON.stringify(providerConfigOverride),
|
||||
"--strict-json",
|
||||
"--merge",
|
||||
],
|
||||
@@ -1865,52 +1879,6 @@ async function runInstalledModelsSet(params) {
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
if (typeof params.providerConfig.timeoutSeconds === "number") {
|
||||
await runInstalledCli({
|
||||
cliPath: params.cliPath,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.models`,
|
||||
"[]",
|
||||
"--strict-json",
|
||||
],
|
||||
cwd: params.cwd,
|
||||
env: params.env,
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
if (typeof params.providerConfig.baseUrl === "string") {
|
||||
await runInstalledCli({
|
||||
cliPath: params.cliPath,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.baseUrl`,
|
||||
JSON.stringify(params.providerConfig.baseUrl),
|
||||
"--strict-json",
|
||||
],
|
||||
cwd: params.cwd,
|
||||
env: params.env,
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
await runInstalledCli({
|
||||
cliPath: params.cliPath,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.timeoutSeconds`,
|
||||
String(params.providerConfig.timeoutSeconds),
|
||||
"--strict-json",
|
||||
],
|
||||
cwd: params.cwd,
|
||||
env: params.env,
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
await runInstalledCli({
|
||||
cliPath: params.cliPath,
|
||||
args: [
|
||||
@@ -2687,15 +2655,16 @@ async function runModelsSet(params) {
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
if (shouldSeedProviderConfigModels(params.providerConfig)) {
|
||||
const providerConfigOverride = buildReleaseProviderConfigOverride(params.providerConfig);
|
||||
if (providerConfigOverride) {
|
||||
await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.models`,
|
||||
"[]",
|
||||
`models.providers.${params.providerConfig.extensionId}`,
|
||||
JSON.stringify(providerConfigOverride),
|
||||
"--strict-json",
|
||||
"--merge",
|
||||
],
|
||||
@@ -2703,49 +2672,6 @@ async function runModelsSet(params) {
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
if (typeof params.providerConfig.timeoutSeconds === "number") {
|
||||
await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.models`,
|
||||
"[]",
|
||||
"--strict-json",
|
||||
],
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
if (typeof params.providerConfig.baseUrl === "string") {
|
||||
await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.baseUrl`,
|
||||
JSON.stringify(params.providerConfig.baseUrl),
|
||||
"--strict-json",
|
||||
],
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"config",
|
||||
"set",
|
||||
`models.providers.${params.providerConfig.extensionId}.timeoutSeconds`,
|
||||
String(params.providerConfig.timeoutSeconds),
|
||||
"--strict-json",
|
||||
],
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
|
||||
@@ -162,18 +162,15 @@ describe("scripts/openclaw-cross-os-release-checks", () => {
|
||||
|
||||
it("keeps cross-OS live smoke agent turns on GPT-5.5-safe timeouts and minimal thinking", () => {
|
||||
const source = readFileSync("scripts/openclaw-cross-os-release-checks.ts", "utf8");
|
||||
const providerModelsSeed = "models.providers.${params.providerConfig.extensionId}.models";
|
||||
const providerBaseUrl = "models.providers.${params.providerConfig.extensionId}.baseUrl";
|
||||
const providerOverride = "models.providers.${params.providerConfig.extensionId}";
|
||||
|
||||
expect(source).toContain('"--thinking",\n "minimal"');
|
||||
expect(CROSS_OS_AGENT_TURN_TIMEOUT_SECONDS).toBeGreaterThanOrEqual(600);
|
||||
expect(source.indexOf(providerModelsSeed)).toBeGreaterThan(-1);
|
||||
expect(source.indexOf(providerModelsSeed)).toBeLessThan(source.indexOf(providerBaseUrl));
|
||||
expect(source).toContain("buildReleaseProviderConfigOverride");
|
||||
expect(source).toContain("models: []");
|
||||
expect(source).toContain('"--merge"');
|
||||
expect(source).toContain(providerBaseUrl);
|
||||
expect(source).toContain(
|
||||
"models.providers.${params.providerConfig.extensionId}.timeoutSeconds",
|
||||
);
|
||||
expect(source).toContain(providerOverride);
|
||||
expect(source).not.toContain("models.providers.${params.providerConfig.extensionId}.baseUrl");
|
||||
expect(source).toContain('"--timeout",\n String(CROSS_OS_AGENT_TURN_TIMEOUT_SECONDS)');
|
||||
expect(source.match(/buildReleaseAgentTurnArgs\(sessionId\)/g)?.length).toBeGreaterThanOrEqual(
|
||||
2,
|
||||
|
||||
Reference in New Issue
Block a user