branch_prefix and tech_debt_branch_prefix are interpolated unescaped into jq programs in the gather scripts
Id: TD-PPagop-26082708 · Status: resolved · Filed: 2026-08-27 · Resolved: 2026-09-24 · Ref: https://github.com/Pullwright/agent-ops/pull/1838
What: scripts/gather-review-feedback.sh, gather-merge-conflicts.sh, gather-dequeued.sh and gather-abandoned-drafts.sh build their head-branch filters by string-interpolating $branch_prefix (pre-existing) and now $tech_debt_branch_prefix (PR #835) directly into a jq program: select((.headRefName | startswith(\"$branch_prefix\")) …). config.schema.json constrains both keys only to type: string (branch_prefix additionally minLength: 1) — no pattern.
Why it matters: a prefix containing a double quote or backslash breaks the jq program at runtime; each site’s 2>/dev/null || true / || echo '[]' guard then turns that into an empty candidate list, so the source silently never fires — exactly the []-on-error trap these scripts’ own headers document as having cost a debugging round before. A misconfigured prefix is indistinguishable from “no work to do”.
Where: the four gather scripts’ td_clause/select(startswith(...)) constructions (e.g. scripts/gather-dequeued.sh around line 370; the analogous filter in each sibling), plus the unpatterned schema entries for branch_prefix and tech_debt_branch_prefix in config.schema.json.
Suggested fix: pass the prefixes into jq as data (--arg bp "$branch_prefix" --arg tp "$tech_debt_branch_prefix" and test $tp != "" inside the program) instead of interpolating them into the program text — lib/candidate-select.sh:114 already models this --arg style — and/or add a schema pattern restricting both keys to ref-safe characters so scripts/doctor.sh rejects a hazardous value at config time. Pre-existing for branch_prefix; #835 extends the pattern to a second key but did not introduce it.
Noticed while the Approver was judging https://github.com/Poetic-Poems/agent-ops/pull/835.
Migrated to https://github.com/Poetic-Poems/agent-ops/issues/1006.