From 07e23e3e6439390be35c507785d116ba5cf51624 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:00:14 +0000 Subject: [PATCH 1/2] Initial plan From cf61ef7539765f19f0c4bac0143c96db8de3c5d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:10:32 +0000 Subject: [PATCH 2/2] Fix Windows CI test failures - add platform checks and USERPROFILE support Co-authored-by: pangerlkr <73515951+pangerlkr@users.noreply.github.com> --- tests/lib/session-manager.test.js | 8 ++++++++ tests/lib/utils.test.js | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/lib/session-manager.test.js b/tests/lib/session-manager.test.js index dbf4d1bb..b36135c2 100644 --- a/tests/lib/session-manager.test.js +++ b/tests/lib/session-manager.test.js @@ -2364,6 +2364,7 @@ file.ts if (test('getSessionById matches old format YYYY-MM-DD-session.tmp via noIdMatch path', () => { const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'r122-old-format-')); const origHome = process.env.HOME; + const origUserProfile = process.env.USERPROFILE; const origDir = process.env.CLAUDE_DIR; try { // Set up isolated environment @@ -2371,6 +2372,7 @@ file.ts const sessionsDir = path.join(claudeDir, 'sessions'); fs.mkdirSync(sessionsDir, { recursive: true }); process.env.HOME = tmpDir; + process.env.USERPROFILE = tmpDir; // Windows: os.homedir() uses USERPROFILE delete process.env.CLAUDE_DIR; // Clear require cache for fresh module with new HOME @@ -2396,6 +2398,8 @@ file.ts 'Non-matching date should return null'); } finally { process.env.HOME = origHome; + if (origUserProfile !== undefined) process.env.USERPROFILE = origUserProfile; + else delete process.env.USERPROFILE; if (origDir) process.env.CLAUDE_DIR = origDir; delete require.cache[require.resolve('../../scripts/lib/utils')]; delete require.cache[require.resolve('../../scripts/lib/session-manager')]; @@ -2485,6 +2489,7 @@ file.ts // "2026/01/15" or "Jan 15 2026" will never match, silently returning empty. // No validation or normalization occurs on the date parameter. const origHome = process.env.HOME; + const origUserProfile = process.env.USERPROFILE; const origDir = process.env.CLAUDE_DIR; const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'r124-date-format-')); const homeDir = path.join(tmpDir, 'home'); @@ -2492,6 +2497,7 @@ file.ts try { process.env.HOME = homeDir; + process.env.USERPROFILE = homeDir; // Windows: os.homedir() uses USERPROFILE delete process.env.CLAUDE_DIR; delete require.cache[require.resolve('../../scripts/lib/utils')]; delete require.cache[require.resolve('../../scripts/lib/session-manager')]; @@ -2530,6 +2536,8 @@ file.ts 'null date skips filter and returns all sessions'); } finally { process.env.HOME = origHome; + if (origUserProfile !== undefined) process.env.USERPROFILE = origUserProfile; + else delete process.env.USERPROFILE; if (origDir) process.env.CLAUDE_DIR = origDir; delete require.cache[require.resolve('../../scripts/lib/utils')]; delete require.cache[require.resolve('../../scripts/lib/session-manager')]; diff --git a/tests/lib/utils.test.js b/tests/lib/utils.test.js index cf991a47..6a7c4125 100644 --- a/tests/lib/utils.test.js +++ b/tests/lib/utils.test.js @@ -836,7 +836,8 @@ function runTests() { console.log('\nrunCommand Edge Cases:'); if (test('runCommand returns trimmed output', () => { - const result = utils.runCommand('echo " hello "'); + // Windows echo includes quotes in output, use node to ensure consistent behavior + const result = utils.runCommand('node -e "process.stdout.write(\' hello \')"'); assert.strictEqual(result.success, true); assert.strictEqual(result.output, 'hello', 'Should trim leading/trailing whitespace'); })) passed++; else failed++; @@ -884,6 +885,10 @@ function runTests() { console.log('\nreadStdinJson maxSize truncation:'); if (test('readStdinJson maxSize stops accumulating after threshold (chunk-level guard)', () => { + if (process.platform === 'win32') { + console.log(' (skipped — stdin chunking behavior differs on Windows)'); + return true; + } const { execFileSync } = require('child_process'); // maxSize is a chunk-level guard: once data.length >= maxSize, no MORE chunks are added. // A single small chunk that arrives when data.length < maxSize is added in full. @@ -1678,6 +1683,10 @@ function runTests() { // ── Round 110: findFiles root directory unreadable — silent empty return (not throw) ── console.log('\nRound 110: findFiles (root directory unreadable — EACCES on readdirSync caught silently):'); if (test('findFiles returns empty array when root directory exists but is unreadable', () => { + if (process.platform === 'win32' || process.getuid?.() === 0) { + console.log(' (skipped — chmod ineffective on Windows/root)'); + return true; + } const tmpDir = fs.mkdtempSync(path.join(utils.getTempDir(), 'r110-unreadable-root-')); const unreadableDir = path.join(tmpDir, 'no-read'); fs.mkdirSync(unreadableDir);