Skip to content

Commit 1150917

Browse files
Surface Codex JSONL error events in step-summary rendering
Codex CLI's JSONL log format emits item.completed events with item.type "error" (e.g. model-fallback warnings), but parseCodexJsonl() silently dropped any item type it didn't recognize, so these messages never reached the rendered step summary or logEntries. Found while verifying the rendering pipeline against real output from workflow run 33729471900 (Issue Monster, codex engine): the log contained a "Model metadata ... not found" error item that was completely absent from the generated markdown.
1 parent 8e30bcd commit 1150917

1 file changed

Lines changed: 30 additions & 9 deletions

File tree

actions/setup/js/parse_codex_log.cjs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,31 @@ function parseCodexJsonl(logContent) {
409409
});
410410
break;
411411
}
412+
case "error": {
413+
const message = typeof item.message === "string" ? item.message : JSON.stringify(item);
414+
if (message.trim()) {
415+
parsedData.push({ type: "error", content: message });
416+
}
417+
break;
418+
}
412419
default:
413420
break;
414421
}
415422
}
416423

424+
const errorMessages = parsedData.filter(item => item.type === "error").map(item => item.content);
425+
417426
// Build markdown so the parser returns a truthy result and core.info has a
418427
// readable fallback. The step summary itself is rendered from logEntries.
419-
let markdown = "<details>\n<summary>Reasoning</summary>\n\n";
428+
let markdown = "";
429+
if (errorMessages.length > 0) {
430+
markdown += "<details>\n<summary>Errors</summary>\n\n";
431+
for (const message of errorMessages) {
432+
markdown += `> ${message}\n\n`;
433+
}
434+
markdown += "</details>\n\n";
435+
}
436+
markdown += "<details>\n<summary>Reasoning</summary>\n\n";
420437
for (const item of parsedData) {
421438
if (item.type === "text") {
422439
markdown += `${item.content}\n\n`;
@@ -456,17 +473,21 @@ function parseCodexJsonl(logContent) {
456473
model: model || undefined,
457474
});
458475

459-
// Surface token usage and turn count via a result entry so Statistics and the
460-
// OTEL telemetry enrichment (agent-stdio.log result line) are populated.
461-
if (usage) {
476+
// Surface token usage, turn count, and error messages via a result entry so
477+
// Statistics, the Information section's Errors list, and the OTEL telemetry
478+
// enrichment (agent-stdio.log result line) are populated.
479+
if (usage || errorMessages.length > 0) {
462480
logEntries.push({
463481
type: "result",
464482
num_turns: turnCount > 0 ? turnCount : undefined,
465-
usage: {
466-
input_tokens: typeof usage.input_tokens === "number" ? usage.input_tokens : undefined,
467-
output_tokens: typeof usage.output_tokens === "number" ? usage.output_tokens : undefined,
468-
cache_read_input_tokens: typeof usage.cached_input_tokens === "number" ? usage.cached_input_tokens : undefined,
469-
},
483+
usage: usage
484+
? {
485+
input_tokens: typeof usage.input_tokens === "number" ? usage.input_tokens : undefined,
486+
output_tokens: typeof usage.output_tokens === "number" ? usage.output_tokens : undefined,
487+
cache_read_input_tokens: typeof usage.cached_input_tokens === "number" ? usage.cached_input_tokens : undefined,
488+
}
489+
: undefined,
490+
errors: errorMessages.length > 0 ? errorMessages : undefined,
470491
});
471492
}
472493

0 commit comments

Comments
 (0)