Skip to content

Commit a1548bd

Browse files
authored
Fix CJS typecheck regression in loadModelsJson cache path (#42491)
1 parent 572c735 commit a1548bd

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

actions/setup/js/apply_safe_outputs_replay.cjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ function buildHandlerConfigFromOutput(agentOutputFile) {
108108
}
109109

110110
// Normalize type: convert dashes to underscores (mirrors safe_outputs_append.cjs)
111-
const config = Object.fromEntries(
112-
validatedOutput.items
113-
.filter(item => item.type && typeof item.type === "string")
114-
.map(item => [item.type.replace(/-/g, "_"), {}])
115-
);
111+
const config = Object.fromEntries(validatedOutput.items.filter(item => item.type && typeof item.type === "string").map(item => [item.type.replace(/-/g, "_"), {}]));
116112

117113
core.info(`Handler config built from ${validatedOutput.items.length} item(s): ${Object.keys(config).join(", ")}`);
118114
return config;

actions/setup/js/model_costs.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ let _modelsJson = undefined;
263263
*/
264264
function loadModelsJson() {
265265
if (_modelsJson !== undefined) {
266-
return _modelsJson;
266+
return _modelsJson ?? null;
267267
}
268268
try {
269269
const raw = fs.readFileSync(getModelsPath(), "utf8");
@@ -273,7 +273,7 @@ function loadModelsJson() {
273273
} catch {
274274
_modelsJson = null;
275275
}
276-
return _modelsJson;
276+
return _modelsJson ?? null;
277277
}
278278

279279
function _resetModelCostsCache() {

0 commit comments

Comments
 (0)