Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Claude Code CLI was configured with --output-format json, which produces a single JSON object. The log parser expects either JSON array format [{...}, {...}] or JSONL format {...}\n{...}\n (newline-delimited). Additionally, the JSON output wasn't being captured to the log file for parsing.

Changes

Engine configuration (pkg/workflow/claude_engine.go):

// Before
claudeArgs = append(claudeArgs, "--output-format", "json")

// After
claudeArgs = append(claudeArgs, "--output-format", "stream-json")

Output capture (pkg/workflow/claude_engine.go):

# Before (no stdout capture)
claude --output-format json ...

# After (capture to both console and log file)
claude --output-format stream-json ... 2>&1 | tee -a /tmp/gh-aw/agent-stdio.log

Test update (pkg/workflow/claude_engine_test.go):

  • Updated test expectation to check for stream-json flag

Workflow recompilation:

  • All 147 .lock.yml files regenerated with new CLI flags and output redirection

Technical details

The stream-json format emits newline-delimited JSON objects (JSONL), which the parser's parseLogEntries() function already handles via its line-by-line JSON parsing logic. The tee command captures stdout/stderr to the log file while also displaying output on the GitHub Actions console for real-time monitoring.

Previously, only debug logs were written to the file via --debug-file, but the JSON output from --output-format stream-json went to stdout and wasn't captured. Now both debug logs and JSON output are written to /tmp/gh-aw/agent-stdio.log for parsing, while remaining visible on the console.

Original prompt

This section details on the original issue you should resolve

<issue_title>"Log format not recognized as Claude JSON array or JSONL."</issue_title>
<issue_description>Got this error in quick start path for Claude

https://github.com/githubnext/gh-aw-trial-hono/actions/runs/21479574343</issue_description>

Comments on the Issue (you are @copilot in this section)

@pelikhan Make sure Claude is writing JSON messages in the log file. Review flags used to launch Claude.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Changeset

  • Type: patch
  • Description: Claude execution steps now emit stream-json output so the log parser can consume newline-delimited JSON.

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator

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

@copilot make sure the Claude output is also streamed to the action stdout

The log parser expects either JSON array format or JSONL format (newline-delimited JSON objects), but the code was using `--output-format json` which outputs a single JSON object. Changed to `--output-format stream-json` which outputs JSONL format compatible with the parser.

- Changed `--output-format json` to `--output-format stream-json` in claude_engine.go
- Updated test to expect stream-json instead of json
- Recompiled all workflow files to apply the change

Fixes the "Log format not recognized as Claude JSON array or JSONL" error.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix log format not recognized as Claude JSON Fix Claude log parser: use stream-json for JSONL output Jan 31, 2026
Copilot AI requested a review from pelikhan January 31, 2026 15:19
@pelikhan pelikhan added the smoke label Jan 31, 2026
@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions
Copy link
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 24.13.0
python3 3.13.11
go 1.24.12
java command not found
dotnet command not found

Result: 10/12 tools available ⚠️

Missing Tools:

  • java - command not found
  • dotnet - command not found

Core development tools (shell, git, HTTP, JSON/YAML processing, GitHub CLI, Node.js, Python, Go) are all available. Java and .NET runtimes are not installed in this container.

AI generated by Agent Container Smoke Test

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Serena MCP
  • ✅ Playwright
  • ✅ File Writing
  • ✅ Bash Tool
  • ✅ Discussion Interaction
  • ✅ Build gh-aw

Status: PASS

@pelikhan @Copilot

AI generated by Smoke Copilot

Add `2>&1 | tee -a` redirection to capture Claude's stream-json output to the log file while also displaying it on the GitHub Actions console for monitoring.

Previously, only debug logs were written to the file via --debug-file, but the JSON output from --output-format stream-json went to stdout and wasn't captured in the log file. This meant the log parser couldn't read the JSON output.

Now both debug logs and JSON output are written to /tmp/gh-aw/agent-stdio.log AND displayed on the console.

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

Copilot AI commented Jan 31, 2026

@copilot make sure the Claude output is also streamed to the action stdout

Added 2>&1 | tee -a redirection to stream Claude's output to both the console and the log file. The stream-json output now appears on stdout (visible in GitHub Actions) while also being captured in /tmp/gh-aw/agent-stdio.log for parsing. Fixed in commit 74153ee.

@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

Copilot AI changed the title Fix Claude log parser: use stream-json for JSONL output Fix Claude log parser: use stream-json and tee for JSONL output Jan 31, 2026
@github-actions
Copy link
Contributor

PRs: Fix Claude log parser: use stream-json for JSONL output; [fp-enhancer] Apply functional programming and immutability improvements
GitHub MCP merged PRs ✅
safeinputs-gh PR list ✅
Serena activate ✅
Playwright GitHub title ✅
Tavily search ✅
File write + cat ✅
Discussion query + comment ✅
Build gh-aw ✅
Overall: PASS

AI generated by Smoke Codex

@pelikhan pelikhan marked this pull request as ready for review January 31, 2026 15:33
@pelikhan pelikhan merged commit 5bc946c into main Jan 31, 2026
114 of 115 checks passed
@pelikhan pelikhan deleted the copilot/fix-claude-json-log-format branch January 31, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Log format not recognized as Claude JSON array or JSONL."

2 participants