From 4f891303f299aaa4b0ea88cb464e91ffa5d6efea Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 14 Aug 2026 18:59:45 -0700 Subject: [PATCH] =?UTF-8?q?fix(autoplan):=20task=20aggregator=20returned?= =?UTF-8?q?=20zero=20tasks=20on=20every=20run=20=E2=80=94=20jq=20scope=20b?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inside ($commits | split("|") | ...) the "." context is the split ARRAY, so the filter's bare .commit raised "Cannot index array with string" on every record — and the 2>/dev/null swallowed it, so aggregation silently produced zero tasks no matter how many the reviews emitted. Bind .commit to $c before the pipe. Reproduced live before the fix; regenerated autoplan/SKILL.md. Fixes #2018. Contributed by @kkroo (PR #2416; regenerated against the current template). Co-Authored-By: Claude Fable 5 --- autoplan/SKILL.md | 6 +++++- scripts/resolvers/tasks-section.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index 29c588290..480654db7 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -1668,8 +1668,12 @@ 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.) + # NOTE: bind .commit BEFORE the split pipe. Inside ($commits | split(...)) + # the "." context is the resulting ARRAY, so a bare .commit there raises + # "Cannot index array with string" on every record — and the 2>/dev/null + # below swallows it, so the whole aggregation silently yields zero tasks. 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..3c907b190 100644 --- a/scripts/resolvers/tasks-section.ts +++ b/scripts/resolvers/tasks-section.ts @@ -118,8 +118,12 @@ 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.) + # NOTE: bind .commit BEFORE the split pipe. Inside ($commits | split(...)) + # the "." context is the resulting ARRAY, so a bare .commit there raises + # "Cannot index array with string" on every record — and the 2>/dev/null + # below swallows it, so the whole aggregation silently yields zero tasks. 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