Skip to content

[rendering-scripts] Fix Codex JSONL parser dropping error/warning log items in step summaries - #58195

Merged
pelikhan merged 3 commits into
mainfrom
fix/codex-jsonl-error-events-33729471900-e251d81e53d809c3
Sep 3, 2026
Merged

[rendering-scripts] Fix Codex JSONL parser dropping error/warning log items in step summaries#58195
pelikhan merged 3 commits into
mainfrom
fix/codex-jsonl-error-events-33729471900-e251d81e53d809c3

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The Codex CLI JSONL log parser (parse_codex_log.cjs) silently dropped item.completed events whose item.type was "error", so error/warning messages emitted by Codex (e.g. model-fallback warnings) never appeared anywhere in the rendered step summary or structured log entries. This means genuine Codex errors could be invisible to anyone reviewing a workflow run's output.

Trigger

  • Run ID: 33729471900 ("Issue Monster" workflow)
  • Engine: codex
  • Date: 2026-09-03

This was found during the daily rendering-scripts verification pass: the run's raw agent-stdio.log was fed through the current parser and the resulting markdown/logEntries were checked for correctness. The run's underlying agent execution itself completed successfully (0 errors/warnings reported by the workflow audit), but the log contained an unsurfaced item:

{"type":"item.completed","item":{"id":"item_0","type":"error","message":"Model metadata for `mai-code-1-flash-picker` not found. Defaulting to fallback metadata; this can degrade performance and cause issues."}}

This message was completely absent from the rendered step summary before this fix.

Changes

  • actions/setup/js/parse_codex_log.cjs: parseCodexJsonl() now handles item.type === "error" events, collecting their messages.
  • The generated markdown now prepends an <details><summary>Errors</summary> section listing any such messages, ahead of the existing Reasoning/Commands sections.
  • The result log entry now includes an errors array (propagated through the existing generateInformationSection/convertLegacyLogEntriesToCopilotEvents conventions already used by other engines) and is emitted even when no usage data is present, as long as there are errors to report.
Diff detail
+      case "error": {
+        const message = typeof item.message === "string" ? item.message : JSON.stringify(item);
+        if (message.trim()) {
+          parsedData.push({ type: "error", content: message });
+        }
+        break;
+      }

Test Results

Existing regression suite: parse_codex_log.test.cjs
Test Files  1 passed (1)
     Tests  71 passed (71)

No regressions.

Verification against real production log (run 33729471900)

Used a temporary vitest-based harness to run parseCodexLog() directly against the real agent-stdio.log content from this run (not a synthetic fixture).

  • Before fix: error message absent from both markdown and logEntries.
  • After fix: error message present in the new "Errors" details block of the markdown, and present in logEntries[].data.errors (session.result.data.errors).
{
  "errorMessagePresentInMarkdown": true,
  "errorLogEntryPresent": true
}
render_template.cjs conditional rendering check

Also ran the existing render_template.test.cjs suite (handlebars-style {{#if}} conditional rendering) as part of this verification pass — no issues found, no changes needed:

Test Files  1 passed (1)
     Tests  36 passed (36)

Warning

Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • api.anthropic.com
  • codeload.github.com
  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"
    - "codeload.github.com"
    - "github.com"

See Network Configuration for more information.

Generated by ✅ Daily Rendering Scripts Verifier · claude · agent · 461.8 AIC · ⌖ 11.9 AIC · ⊞ 10.6K ·

  • expires on Sep 6, 2026, 12:02 AM UTC-08:00

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.
@github-actions github-actions Bot added automated-fix javascript Pull requests that update javascript code rendering labels Sep 3, 2026
@pelikhan
pelikhan marked this pull request as ready for review September 3, 2026 11:43
Copilot AI balanced review requested due to automatic review settings September 3, 2026 11:43
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

PR Code Quality Reviewer completed the code quality review.

Completed PR review for #58195; submitted overall review with no inline comments because no actionable blocking issues were found in changed lines.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped. This PR (fix/codex-jsonl-error-events) only modified the production file actions/setup/js/parse_codex_log.cjs to surface error/warning events from Codex JSONL logs in step summaries.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Ponytail Reviewer completed successfully!

Lean already. Ship.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #58195

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Add the requested regression test and address the downstream formatter dropping the error message.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates Codex JSONL parsing to capture completed error items and propagate them into summaries and structured results.

Changes:

  • Parses item.type === "error" messages.
  • Adds error details to markdown and result metadata.
  • Emits results containing errors even without usage data.
File summaries
File Description
actions/setup/js/parse_codex_log.cjs Adds Codex error handling; regression coverage is needed for no-usage results and final summary rendering.
Review details

Suppressed comments (1)

actions/setup/js/parse_codex_log.cjs:490

  • This field is not rendered by the actual step-summary path. runLogParser replaces the parser's markdown whenever logEntries exist and calls generateCopilotCliStyleSummary; after normalization, that formatter never reads result.errors. As a result, an item.completed error is present in session.result.data.errors but remains absent from the rendered step summary and core.info. Extend the shared summary formatter to emit result errors instead of relying only on this field.
      errors: errorMessages.length > 0 ? errorMessages : undefined,
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +412 to +415
case "error": {
const message = typeof item.message === "string" ? item.message : JSON.stringify(item);
if (message.trim()) {
parsedData.push({ type: "error", content: message });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a no-usage item.completed error regression test asserting session.result.data.errors and the Copilot CLI-style rendered summary. The downstream formatter now includes result errors in Statistics.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

reviewed_at: 2026-09-03T11:47:30Z
review_event: COMMENT
top_themes:
  - no actionable blocking issues in changed lines
  - parser now surfaces codex error items in summary and result metadata
files_reviewed:
  - actions/setup/js/parse_codex_log.cjs
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 28.8 AIC · ⌖ 7.32 AIC · ⊞ 21.8K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

No blocking issue in the changed lines.

The only plausible risk here is minor and non-blocking

The new JSON.stringify(item) fallback for non-string error payloads could still misbehave on exotic circular objects, but this parser is consuming Codex JSONL where item.message is expected to be a plain string and the fallback is only a last resort. That is not strong enough to block this PR.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 28.8 AIC · ⌖ 7.32 AIC · ⊞ 21.8K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix correctly adds handling for item.type === "error" events in parseCodexJsonl, prepends an Errors section to the markdown, and propagates error messages into the result log entry's errors array (consumed properly by generateInformationSection/convertLegacyLogEntriesToCopilotEvents in log_parser_shared.cjs). The usage || errorMessages.length > 0 guard correctly avoids emitting an empty result entry while still surfacing errors without usage data.

No blocking issues found. One non-blocking suggestion left inline: add a JSONL-format regression test for the new error-item case, since the existing JSONL test suite only covers agent_message/mcp_tool_call/command_execution/reasoning items.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 42.4 AIC · ⌖ 13.4 AIC · ⊞ 8.3K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs — this is a well-scoped, narrow bug fix with an existing 71-test regression suite that keeps passing. Two suggestions, neither blocking.

📋 Key Themes & Highlights

Key Themes

  • Missing permanent regression test: the PR body describes a manual harness run against the real production log (run 33729471900) proving the fix works, but that exact scenario (an item.completed event with item.type: "error") isn't captured as a test in parse_codex_log.test.cjs. The file already has a dedicated describe("Codex experimental JSONL event format", ...) block that would be the natural home for it.
  • Minor whitespace inconsistency: message.trim() is used only as a guard condition, but the untrimmed value is stored/rendered, so incidental leading/trailing whitespace from the JSON payload could leak into markdown and the errors array.

Positive Highlights

  • ✅ Correctly reuses the existing errors convention already wired through generateInformationSection / convertLegacyLogEntriesToCopilotEvents, keeping this consistent with other engines rather than inventing new plumbing.
  • ✅ Good defensive fallback (JSON.stringify(item)) when item.message isn't a string.
  • ✅ Correctly changes the result entry condition to usage || errorMessages.length > 0 so errors surface even without usage data — this was the root cause of the original silent-drop bug and is properly addressed, not just patched around.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 48.1 AIC · ⌖ 14.8 AIC · ⊞ 10.3K
Comment /matt to run again

Comment thread actions/setup/js/parse_codex_log.cjs Outdated
break;
}
case "error": {
const message = typeof item.message === "string" ? item.message : JSON.stringify(item);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] This fix for item.type === "error" events has no regression test in parse_codex_log.test.cjs — the PR description mentions verifying against a real production log with a temporary harness, but that verification wasn't captured as a permanent test.

💡 Suggested regression test

Add a case alongside the existing describe("Codex experimental JSONL event format", ...) block using the exact reported payload:

it("surfaces item.completed error events in markdown and logEntries", () => {
  const logContent = [
    '{"type":"item.completed","item":{"id":"item_0","type":"error","message":"Model metadata for `mai-code-1-flash-picker` not found. Defaulting to fallback metadata; this can degrade performance and cause issues."}}',
  ].join("\n");

  const result = parseCodexLog(logContent);

  expect(result.markdown).toContain("<summary>Errors</summary>");
  expect(result.markdown).toContain("Model metadata for");

  const resultEntry = result.logEntries.find(e => e.type === "session.result");
  expect(resultEntry).toBeDefined();
  expect(resultEntry.data?.errors).toContain(expect.stringContaining("Model metadata for"));
});

Without this, a future refactor of parseCodexJsonl could silently reintroduce the exact bug this PR fixes.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added permanent regression coverage for item.completed error events, including markdown and structured session.result.data.errors assertions.

Comment thread actions/setup/js/parse_codex_log.cjs Outdated
}
case "error": {
const message = typeof item.message === "string" ? item.message : JSON.stringify(item);
if (message.trim()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] Minor inconsistency: the guard checks message.trim() but the untrimmed message is what gets pushed into parsedData/errorMessages, so leading/trailing whitespace from the raw JSON can leak into the rendered > message blockquote and the errors array.

💡 Suggested fix
case "error": {
  const rawMessage = typeof item.message === "string" ? item.message : JSON.stringify(item);
  const message = rawMessage.trim();
  if (message) {
    parsedData.push({ type: "error", content: message });
  }
  break;
}

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalized Codex error messages with trim() before storing and rendering them, so whitespace cannot leak into the errors array or summary.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@copilot run pr-finisher skill

Completed the PR-finisher pass. Added regression coverage for Codex JSONL errors without usage and fixed the downstream step-summary formatter to render them. Local formatting, lint, JavaScript, Go unit, integration, and recompilation checks pass in commit 15e4b58.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please take another pass on this PR. Please review the current status, refresh the branch if needed, address any outstanding review feedback or failing checks, and then use the pr-finisher skill to move it toward merge readiness.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 8.18 AIC · ⌖ 8.66 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@copilot Please take another pass on this PR. Please review the current status, refresh the branch if needed, address any outstanding review feedback or failing checks, and then use the pr-finisher ...

Rechecked the PR and recent workflow runs. The Codex parser fix, formatter change, regression coverage, trimming fix, and local validation are complete on 5f24e9d; no additional code changes are needed. Outstanding review threads already have substantive replies but remain unresolved, so maintainer resolution is still required.

Copilot AI requested a review from gh-aw-bot September 3, 2026 15:40
@pelikhan
pelikhan merged commit 4a9b8e8 into main Sep 3, 2026
11 checks passed
@pelikhan
pelikhan deleted the fix/codex-jsonl-error-events-33729471900-e251d81e53d809c3 branch September 3, 2026 20:01
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.88.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix javascript Pull requests that update javascript code rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants