Skip to content

bug(extract-plan): jq fails on claude-code-action v1 JSONL execution file #81

Description

@YiWang24

Summary

After the cascade fixes (#23, #56, #76, #79, #80) the agent in `issue-ops` Stage 3 actually executes — 17 turns, success, $0.04 cost. The downstream `actions/issue/extract-plan/extract-plan.sh` then fails:

```
jq: parse error: Invalid numeric literal at line 2, column 0
##[error]Process completed with exit code 5.
```

Repro: https://github.com/YiAgent/OpenCI/actions/runs/25333110309/job/74271828771

Root cause

`claude-code-action@v1` writes `/home/runner/_work/_temp/claude-execution-output.json` as a JSONL transcript (one JSON object per line, type=system/init, then type=result/success). The current jq filter:

```bash
plan="$(printf '%s' "$raw" | jq -r '
if type == "object" and .version == "issue-action-plan/v1" then .
else
[.. | strings | select(test(""version"[[:space:]]:[[:space:]]"issue-action-plan/v1""))] | last // empty
end
' 2>/dev/null || true)"
```

The `|| true` swallows the jq error from JSONL on the first call, so `$plan` ends up empty. Then `plan="$(jq -c . <<<"$plan")"` runs jq on an empty heredoc and that's what crashes the script with "Invalid numeric literal at line 2, column 0".

Fix

  1. Use `jq -s` (slurp) or pipe through `jq -c .` to canonicalize JSONL into an array first
  2. Then walk the array looking for the agent's final assistant message, extract the JSON code block from its content
  3. Guard the second `jq -c . <<<"$plan"` so it never receives empty input — check `[ -n "$plan" ]` before piping

Severity

Blocks issue-ops Stage 3 → Stage 4 plan execution today, even though the agent itself runs successfully. Sister issue: `actions/pr/extract-plan` likely has the same bug for the PR pipeline.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions