fix: isolate codex stdio turn routing
This commit is contained in:
@@ -214,6 +214,7 @@ export async function handleCodeAgentChat(params = {}, options = {}) {
|
||||
toolName: error.toolName
|
||||
})
|
||||
};
|
||||
if (payload.error?.diagnosis) payload.diagnosis = payload.error.diagnosis;
|
||||
if (payload.error?.blocker) payload.blocker = payload.error.blocker;
|
||||
if (payload.error?.blockers) payload.blockers = payload.error.blockers;
|
||||
if (error.provider) payload.provider = error.provider;
|
||||
@@ -924,6 +925,7 @@ async function callCodexStdioRunner({ message, conversationId, sessionId, thread
|
||||
idleMs: error.idleMs,
|
||||
lastActivityAt: error.lastActivityAt,
|
||||
waitingFor: error.waitingFor,
|
||||
diagnosis: error.diagnosis,
|
||||
providerTrace: error.providerTrace,
|
||||
stage: error.stage,
|
||||
missingTools: error.missingTools,
|
||||
@@ -1185,6 +1187,7 @@ function normalizeChatError(error, context = {}) {
|
||||
const idleMs = numberErrorField(error.idleMs ?? context.idleMs);
|
||||
const lastActivityAt = safeIsoLike(error.lastActivityAt ?? context.lastActivityAt);
|
||||
const waitingFor = redactText(error.waitingFor ?? context.waitingFor ?? "");
|
||||
const diagnosis = normalizeDiagnosis(error.diagnosis ?? context.diagnosis ?? error.blocker?.diagnosis ?? null);
|
||||
const blocker = structuredBlocker({
|
||||
code,
|
||||
layer: taxonomy.layer,
|
||||
@@ -1209,7 +1212,8 @@ function normalizeChatError(error, context = {}) {
|
||||
hardTimeoutMs,
|
||||
idleMs,
|
||||
lastActivityAt,
|
||||
waitingFor
|
||||
waitingFor,
|
||||
diagnosis
|
||||
});
|
||||
const normalized = {
|
||||
code,
|
||||
@@ -1233,6 +1237,7 @@ function normalizeChatError(error, context = {}) {
|
||||
idleMs,
|
||||
lastActivityAt,
|
||||
waitingFor,
|
||||
diagnosis,
|
||||
missingConfig: safeMissingConfig(error),
|
||||
blockers
|
||||
};
|
||||
@@ -1429,7 +1434,7 @@ function errorTaxonomy(code, error = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function structuredBlocker({ code, layer, message, userMessage, retryable, traceId, provider, backend, runner, capabilityLevel, route, toolName, category, blockers, sessionId = null, conversationId = null, stage = null, lastEvent = null, elapsedMs = null, timeoutMs = null, hardTimeoutMs = null, idleMs = null, lastActivityAt = null, waitingFor = null }) {
|
||||
function structuredBlocker({ code, layer, message, userMessage, retryable, traceId, provider, backend, runner, capabilityLevel, route, toolName, category, blockers, sessionId = null, conversationId = null, stage = null, lastEvent = null, elapsedMs = null, timeoutMs = null, hardTimeoutMs = null, idleMs = null, lastActivityAt = null, waitingFor = null, diagnosis = null }) {
|
||||
return {
|
||||
code,
|
||||
layer,
|
||||
@@ -1454,6 +1459,7 @@ function structuredBlocker({ code, layer, message, userMessage, retryable, trace
|
||||
idleMs,
|
||||
lastActivityAt,
|
||||
waitingFor,
|
||||
diagnosis,
|
||||
blockerCodes: Array.isArray(blockers) ? blockers.map((blocker) => blocker.code).filter(Boolean) : []
|
||||
};
|
||||
}
|
||||
@@ -1485,7 +1491,8 @@ function normalizeBlockers(blockers, fallback) {
|
||||
hardTimeoutMs: numberErrorField(blocker.hardTimeoutMs),
|
||||
idleMs: numberErrorField(blocker.idleMs),
|
||||
lastActivityAt: safeIsoLike(blocker.lastActivityAt),
|
||||
waitingFor: blocker.waitingFor ? redactText(blocker.waitingFor) : null
|
||||
waitingFor: blocker.waitingFor ? redactText(blocker.waitingFor) : null,
|
||||
diagnosis: normalizeDiagnosis(blocker.diagnosis ?? null)
|
||||
}));
|
||||
if (normalized.length > 0) return normalized;
|
||||
return [{
|
||||
@@ -1498,6 +1505,32 @@ function normalizeBlockers(blockers, fallback) {
|
||||
}];
|
||||
}
|
||||
|
||||
function normalizeDiagnosis(value) {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
||||
return {
|
||||
code: value.code ? redactText(value.code) : null,
|
||||
layer: value.layer ? redactText(value.layer) : null,
|
||||
kind: value.kind ? redactText(value.kind) : null,
|
||||
summary: value.summary ? redactText(value.summary) : null,
|
||||
waitingFor: value.waitingFor ? redactText(value.waitingFor) : null,
|
||||
lastActivityAt: safeIsoLike(value.lastActivityAt),
|
||||
idleMs: numberErrorField(value.idleMs),
|
||||
threadId: value.threadId ? redactText(value.threadId) : null,
|
||||
turnId: value.turnId ? redactText(value.turnId) : null,
|
||||
lastRoutedEvent: value.lastRoutedEvent && typeof value.lastRoutedEvent === "object" ? {
|
||||
type: value.lastRoutedEvent.type ?? null,
|
||||
status: value.lastRoutedEvent.status ?? null,
|
||||
label: value.lastRoutedEvent.label ?? null,
|
||||
stage: value.lastRoutedEvent.stage ?? null,
|
||||
toolName: value.lastRoutedEvent.toolName ?? null,
|
||||
itemId: value.lastRoutedEvent.itemId ?? null,
|
||||
waitingFor: value.lastRoutedEvent.waitingFor ?? null,
|
||||
exitCode: numberErrorField(value.lastRoutedEvent.exitCode),
|
||||
durationMs: numberErrorField(value.lastRoutedEvent.durationMs)
|
||||
} : null
|
||||
};
|
||||
}
|
||||
|
||||
function safeMissingConfig(error) {
|
||||
return [
|
||||
...(Array.isArray(error.missingEnv) ? error.missingEnv : []),
|
||||
|
||||
Reference in New Issue
Block a user