Skip to content

fix(work-driver): four grouping rules are dead on real issues — --json single-line bodies, wrong R3 literal, R4 vs title prefixes, R2 path shape #376

Description

@randomm

Context

Four of the grouping rules in work-driver-grouping.ts are documented, tested against synthetic fixtures, and do not work on real issues. Verified by running the production regexes over the live bodies of #279, #287, #288, #289, #290, #366 and #368.

What is broken

1. R3 and R4 can never fire on the multi-issue path.

commands.ts:250 fetches bodies with gh issue view <n> --json title,body,labels and stores the raw stdout verbatim (:262), which is handed to groupIssues (:265). That stdout is one line of compact JSON — newlines are two-character \n escapes, not real newlines.

Both rules are ^-anchored under /m:

  • R3 work-driver-grouping.ts:126/^(?:Split\s*:\s*(?:true|yes|separate)|This work must ship separately)/im
  • R4 work-driver-grouping.ts:205/^(?:title:\s*)?\[([a-z0-9_-]+)\]\s/i against firstLine

Under a single-line JSON blob the only line-start is index 0, which is {"body":". Measured: R3split=false on all 7 sampled bodies. The failure is silent — notes simply never mentions R3 or R4.

Note the explore step does this correctly: work-driver-explore.ts:72 uses plain gh issue view <n> and gets real newlines.

2. The R3 literal does not match what is actually written.

Four of four sampled operator issues contain, at line start: This work must ship as its own separate PR, independent of any other open issue. The regex literal is This work must ship separately. Even with #1 fixed, R3 stays dead for every issue in this backlog.

3. R4 is structurally impossible for /plan-authored issues.

R4 requires [tag] as the first characters of the title. /plan mandates feat: / Bug: / EPIC: / chore: / research: prefixes (pi-prompts/plan.md:36-40). The two conventions are mutually exclusive. The subsystem is in fact already encoded — as the conventional-commit scope, e.g. fix(work-driver): ….

4. R2 extracts zero paths from most real issues.

work-driver-grouping.ts:170-171 requires a directory component before the extension. Issues reference bare module names with line anchors — work-driver.ts:1274, commands.ts:262, worktree.ts:19-27.

Measured path extraction: #287 → 0, #288 → 0, #289 → 0, #290 → 0, #366 → 0, #368 → 1, #279 → 5. So groups[id].paths comes back empty for 5 of 7, and that empty scope propagates downstream.

5. docs/troubleshooting.md:680 is stale and would mislead anyone writing an issue by hand: it documents split, separate PRs, independent — the pre-#312 behaviour. grouping.ts:120-124 records that bare "independent" was removed as a false-positive magnet.

Acceptance criteria

Technical context

  • extension/src/commands.ts:245-265 — the --json fetch and bodiesByIssue assembly
  • extension/src/work-driver-grouping.ts — R1 :154, R2 :170, R3 :126, R4 :205
  • extension/src/work-driver-explore.ts:72 — the correct plain-gh fetch, for reference

Out of scope

  • Intent resolution / normalised spec — separate issue; this one only repairs the fast path
  • Any change to /plan or to how issues are written
  • GitHub's native issue-dependency API as an R1 replacement — worth doing, but a separate concern

This work must ship as its own separate PR, independent of any other open issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions