From 1948e54e88136e92dc698068042ae7d2652764e0 Mon Sep 17 00:00:00 2001 From: 0xDevNinja Date: Tue, 16 Jun 2026 12:16:34 +0530 Subject: [PATCH] fix(autoplan): bind commit before split-array index in tasks aggregator The Phase 4 implementation-tasks aggregator filtered per-phase JSONL by branch and recent commit with: select(.branch == $branch and ($commits | split("|") | index(.commit) != null)) Inside the ($commits | split("|") | ...) pipe the input is the split array, so index(.commit) tried to index an array with the string "commit" and jq errored with "Cannot index array with string". The surrounding invocation swallowed it via 2>/dev/null, so every run silently dropped all records and reported no actionable tasks even when valid task records existed for the current branch and commits. Bind the record's commit to $c before entering the split-array pipe so index() receives the commit string and the membership test works. Fixes #2018. --- autoplan/SKILL.md | 5 ++++- scripts/resolvers/tasks-section.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index 49db38ff9..2e4888b3b 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -1637,8 +1637,11 @@ if command -v jq >/dev/null 2>&1; then # Filter to current branch + recent commits, then keep records for the # latest run_id only. (Single phase may have multiple files if the user # re-ran the review; aggregator takes the newest.) + # Bind the record's .commit to $c BEFORE entering the split-array pipe — + # inside ($commits | split("|") | ...) the input is the array, so a bare + # index(.commit) would index the array with the string "commit" and error. jq -c --arg branch "$BRANCH" --arg commits "$COMMITS_RECENT" \ - 'select(.branch == $branch and ($commits | split("|") | index(.commit) != null))' \ + 'select(.branch == $branch and (.commit as $c | ($commits | split("|") | index($c)) != null))' \ "$f" 2>/dev/null >> "$ALL_JSONL" || true done < <(find "$TASKS_DIR" -maxdepth 1 -name "tasks-$phase-*.jsonl" 2>/dev/null | sort) # Reduce to latest run_id per phase diff --git a/scripts/resolvers/tasks-section.ts b/scripts/resolvers/tasks-section.ts index 2f86f588b..13bc72d86 100644 --- a/scripts/resolvers/tasks-section.ts +++ b/scripts/resolvers/tasks-section.ts @@ -118,8 +118,11 @@ if command -v jq >/dev/null 2>&1; then # Filter to current branch + recent commits, then keep records for the # latest run_id only. (Single phase may have multiple files if the user # re-ran the review; aggregator takes the newest.) + # Bind the record's .commit to \$c BEFORE entering the split-array pipe — + # inside (\$commits | split("|") | ...) the input is the array, so a bare + # index(.commit) would index the array with the string "commit" and error. jq -c --arg branch "$BRANCH" --arg commits "$COMMITS_RECENT" \\ - 'select(.branch == $branch and ($commits | split("|") | index(.commit) != null))' \\ + 'select(.branch == $branch and (.commit as $c | ($commits | split("|") | index($c)) != null))' \\ "$f" 2>/dev/null >> "$ALL_JSONL" || true done < <(find "$TASKS_DIR" -maxdepth 1 -name "tasks-$phase-*.jsonl" 2>/dev/null | sort) # Reduce to latest run_id per phase