Skip to content

Commit 029253f

Browse files
committed
fix: type context-engine binding policy config
1 parent fcd78fb commit 029253f

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Docs: https://docs.openclaw.ai
4242
- browser: enforce navigation checks for act interactions [AI]. (#81070) Thanks @pgondhi987.
4343
- Validate node exec event provenance [AI]. (#81071) Thanks @pgondhi987.
4444
- Gateway: keep active reply runs visible to stuck-session diagnostics and clear no-active-work recovery state, preventing stale queued lanes after compaction or tool failures. Fixes #80677. (#81302)
45+
- Codex app-server: rotate incompatible context-engine-managed native threads so Lossless-managed sessions do not resume stale hidden Codex history. (#81223) Thanks @jalehman.
4546
- Gateway/OpenAI HTTP: return OpenAI-compatible 400 errors for invalid sampling params and provider validation failures instead of collapsing them to 500s. (#81275) Thanks @Lellansin.
4647
- Telegram: publish plugin and skill command description localizations to native command menus while filtering unsupported locale codes and preserving Telegram command limits. (#81351) Thanks @jzakirov.
4748
- Limit hook CLI tool authority [AI]. (#81065) Thanks @pgondhi987.

‎extensions/codex/src/app-server/thread-lifecycle.ts‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,28 @@ function isContextEngineBindingCompatible(
347347
);
348348
}
349349

350-
function resolveContextEngineCitationsMode(config: JsonObject | undefined): JsonValue | undefined {
351-
const memoryConfig = isJsonObject(config?.memory) ? config.memory : undefined;
352-
return memoryConfig?.citations;
350+
function resolveContextEngineCitationsMode(config: unknown): JsonValue | undefined {
351+
const rootConfig = isUnknownRecord(config) ? config : undefined;
352+
const memoryConfig = isUnknownRecord(rootConfig?.memory) ? rootConfig.memory : undefined;
353+
const citations = memoryConfig?.citations;
354+
return isJsonConfigValue(citations) ? citations : undefined;
355+
}
356+
357+
function isUnknownRecord(value: unknown): value is Record<string, unknown> {
358+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
359+
}
360+
361+
function isJsonConfigValue(value: unknown): value is JsonValue {
362+
if (value === null || typeof value === "string" || typeof value === "boolean") {
363+
return true;
364+
}
365+
if (typeof value === "number") {
366+
return Number.isFinite(value);
367+
}
368+
if (Array.isArray(value)) {
369+
return value.every(isJsonConfigValue);
370+
}
371+
return isUnknownRecord(value) && Object.values(value).every(isJsonConfigValue);
353372
}
354373

355374
function shouldRecheckRecoverablePluginBinding(params: {

0 commit comments

Comments
 (0)