fix(core): harden env loading, OpenAI compatibility, and runtime recovery
This commit is contained in:
@@ -192,6 +192,23 @@ function valuesMatch(expected, actual) {
|
||||
return expected === actual;
|
||||
}
|
||||
|
||||
function valuesMatchForPath(path, expected, actual) {
|
||||
if (valuesMatch(expected, actual)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Some optional string paths are normalized by config handlers:
|
||||
// writing "" is persisted as "unset" (undefined).
|
||||
if (typeof expected === 'string' && expected.trim().length === 0 && (actual === undefined || actual === null)) {
|
||||
const optionalStringSuffixes = ['scaffold_path'];
|
||||
if (optionalStringSuffixes.some((suffix) => path.endsWith(suffix))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function setAssistantSaveState(message, tone = 'neutral') {
|
||||
_assistantSaveState = {
|
||||
message,
|
||||
@@ -714,7 +731,7 @@ async function applyAssistantPatch(patches, statusEl) {
|
||||
const mismatches = [];
|
||||
for (const [key, value] of Object.entries(patches)) {
|
||||
const actual = getByPath(fresh, key);
|
||||
if (!valuesMatch(value, actual)) {
|
||||
if (!valuesMatchForPath(key, value, actual)) {
|
||||
mismatches.push(`${key} expected=${JSON.stringify(value)} actual=${JSON.stringify(actual)}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user