fix(plan-mode): compared canonical local urls for scan membership

The scan-membership test used a raw string includes, so a resumed single-slash local:/ state path failed to match the scanner's local:// entry and wrongly gained precedence over a newer draft. Normalize both sides via normalizeLocalScheme before comparing.

Fixes #6569
This commit is contained in:
roboomp
2026-07-25 01:58:12 +00:00
parent 28068f53d3
commit 9bba7ac007
2 changed files with 28 additions and 1 deletions
@@ -1,3 +1,4 @@
import { normalizeLocalScheme } from "../tools/path-utils";
import { ToolError } from "../tools/tool-errors";
/** Shape forwarded from the plan-proposal handler to InteractiveMode's
@@ -167,7 +168,10 @@ export async function resolveApprovedPlan(input: ResolveApprovedPlanInput): Prom
// it keeps precedence over scanned artifacts — otherwise a stale older draft
// could shadow the deliberately-set current plan. A state plan already inside
// the scan competes purely on the newest-first ordering below (issue #6569).
if (input.statePlanFilePath && !listed.includes(input.statePlanFilePath)) {
// Compare canonical `local://` spellings so a resumed `local:/…` state path
// still matches the scanner's `local://…` entry (normalizeLocalScheme).
const canonicalListed = new Set(listed.map(normalizeLocalScheme));
if (input.statePlanFilePath && !canonicalListed.has(normalizeLocalScheme(input.statePlanFilePath))) {
consider(input.statePlanFilePath);
}
for (const url of listed) consider(url);