From 8882f0fe260b03d7b557b5b1cc2b9a5b0e34a4b6 Mon Sep 17 00:00:00 2001 From: Aaddrick Date: Tue, 5 May 2026 07:32:46 -0400 Subject: [PATCH] fix(cowork.sh): WARNING on Patch 2a/2b inner anchor miss (#576) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D5 of #559's followup. Patch 2a (vmClient log gate, line 107) and Patch 2b (vm module assignment, line 123) had no else branch on the inner anchor regex. A miss silently ships a half-patched asar — the exact PR #555 failure mode that took hours to diagnose because the build log printed "Applied 10 cowork patches" with no warning. Three-branch pattern matches Patch 4b at line 227-234: - regex matches: patch + log + count - post-patch literal already in code: "already applied" - otherwise: WARNING naming the patch site Empirically validated against the pinned 1.5354.0 installer: deliberately broke the 2a anchor (replaced "vmClient" with "XXMISSXX" in the regex) → WARNING fires, verify-cowork-patches.sh from PR #575 catches missing vmclient-log-gate marker. Same for 2b. Baseline unchanged: no new WARNINGs on a fresh upstream. Refs #559. Builds on #575 (D6 verification scaffolding). Co-authored-by: Claude --- scripts/patches/cowork.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/patches/cowork.sh b/scripts/patches/cowork.sh index 2ed1009..35853c0 100644 --- a/scripts/patches/cowork.sh +++ b/scripts/patches/cowork.sh @@ -109,6 +109,13 @@ if (vmClientLogMatch) { '(' + win32Var + '||process.platform==="linux")$1'); console.log(' Patched VM client log check for Linux'); patchCount++; + } else if (code.includes( + '||process.platform==="linux")?"vmClient (TypeScript)"' + )) { + console.log(' VM client log gate already applied (Patch 2a)'); + } else { + console.log(' WARNING: Could not find anchor for VM client log' + + ' gate (Patch 2a) — half-patched asar will fail Cowork startup'); } // 2b: Patch the actual module assignment @@ -125,6 +132,12 @@ if (vmClientLogMatch) { '(' + win32Var + '||process.platform==="linux")$1'); console.log(' Patched VM module assignment for Linux'); patchCount++; + } else if (/\|\|process\.platform==="linux"\)\??\(?[\w$]+=\{vm:[\w$]+\}/.test(code)) { + console.log(' VM module assignment already applied (Patch 2b)'); + } else { + console.log(' WARNING: Could not find anchor for VM module' + + ' assignment (Patch 2b) — half-patched asar will fail' + + ' Cowork startup (PR #555 failure mode)'); } } else { console.log(' WARNING: Could not find vmClient variable for module loading patch');