fix: align assistant executor payload with engine

This commit is contained in:
Codex 2026-06-09 11:48:57 +03:00
parent 65da785a9d
commit e208b9f659
1 changed files with 9 additions and 2 deletions

View File

@ -200,7 +200,7 @@ async function createExecutor(owner, command) {
)
returning *`,
[
randomUUID(),
command.id || randomUUID(),
owner.key,
owner.userId,
owner.email,
@ -580,6 +580,9 @@ function sanitizeExecutorCommand(payload, { partial }) {
const source = isPlainObject(payload) ? payload : {};
const command = {};
if (Object.hasOwn(source, "id")) {
command.id = sanitizeUuid(source.id, "id");
}
if (!partial || Object.hasOwn(source, "name")) {
command.name = requireNonEmptyString(source.name, "name");
}
@ -596,7 +599,7 @@ function sanitizeExecutorCommand(payload, { partial }) {
copyOptionalString(command, "model", source.model);
copyOptionalString(command, "accountLabel", source.accountLabel || source.account_label);
if (!partial || Object.hasOwn(source, "capabilities")) {
command.capabilities = isPlainObject(source.capabilities) ? source.capabilities : {};
command.capabilities = isJsonContainer(source.capabilities) ? source.capabilities : {};
}
if (!partial || Object.hasOwn(source, "status")) {
command.status = sanitizeEnum(source.status || "unknown", SUPPORTED_EXECUTOR_STATUSES, "unsupported_executor_status");
@ -859,6 +862,10 @@ function isPlainObject(value) {
return Boolean(value && typeof value === "object" && !Array.isArray(value));
}
function isJsonContainer(value) {
return Boolean(value && typeof value === "object");
}
function toIso(value) {
if (!value) return null;
return value instanceof Date ? value.toISOString() : new Date(value).toISOString();