Repository navigation
Closed
Description
What happens
DefaultCIPlanner decides whether a task is triggered by matching changed paths against the task's inputPatterns, using regexFrom in src/planner/planner.ts. That converter has three bugs:
**not next to a/matches only one path segment.**.jsis the example GitHub uses in its path-filter docs. It becomes[^/]*[^/]*\.js, so it matchesindex.jsbut notsrc/lib/index.js. A bare**matches top-level files only.- Regex-only characters are not escaped. Only
.and\are escaped, so(,),$,^and|keep their regex meaning. A Next.js route-group pattern,app/(marketing)/**, never matchesapp/(marketing)/about/page.tsx; it matchesapp/marketing/...instead. A Remix route,app/routes/$slug.tsx, never matches itself. - An invalid pattern throws out of
plan().c++/**compiles to/^c++(?:/.*)?$/, which throwsSyntaxError: Invalid regular expression ... Nothing to repeat. The whole plan fails instead of the one task.
Patterns reach this code from workflow-parsed pathGlobs via buildGenericTaskRegistry → analyzeCheckout, and from library callers through the exported createTaskRegistry / DefaultCIPlanner.
Impact
For bugs 1 and 2, a task whose inputs did change is reported as SKIP_CANDIDATE ("No matching changed files and task is not always-run") instead of RUN. For a planner that advises what can be skipped, that is the unsafe direction. Bug 3 turns one odd pattern into a crash of the whole plan.
Repro
const registry = createTaskRegistry([{ id: "task", command: "npm run lint", category: "lint", inputPatterns: ["**.js"] }]);
new DefaultCIPlanner(registry).plan({
delta: { files: [{ path: "src/lib/deep/index.js", status: "modified" }] },
impact: { fallbackRequired: false, fallbackReasons: [], affectedTests: [], evidence: [], riskSignals: [] },
profile: { testFilePaths: [] },
} as any).tasks[0].status;
// main (40aa308): "SKIP_CANDIDATE", expected "RUN"Failing test
tests/planner/input-patterns.test.ts in the linked PR. Output on main:
✖ `**` not next to a slash matches at any depth, as in GitHub's `**.js` path filter
actual: 'SKIP_CANDIDATE', expected: 'RUN'
✖ regex-only characters in a pattern match themselves
actual: 'SKIP_CANDIDATE', expected: 'RUN'
✖ a pattern that is not a valid filter triggers the task instead of throwing
SyntaxError [Error]: Invalid regular expression: /^c++(?:/.*)?$/: Nothing to repeat
✔ existing globstar forms are unchanged
Also affected, not changed by the linked PR
src/research/baseline/matcher.tshas a verbatim copy of the sameregexFrom, used by the research PATH baseline.wildcardToRegexinsrc/planner/task-registry.tshas the same escaping gap (problem 2). Its only caller,InMemoryTaskRegistry.matchesInputPattern, is not on theTaskRegistryinterface, so it is not reachable through the public API today.
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(planner): read task input globs the way the research matcher does
FredApps commentedon Nov 17, 2026
Cross-reference: #178 is the same bug in the research matcher (
src/research/baseline/matcher.ts), fixed by #179. #174 fixes the planner copy and now reads globs the same way as #179. Workflowon:path filters reach this matcher through #182.fix(planner): match task input patterns as path globs (DiffCI#174)