From 7d54416cc3d5b05360408eeed80932ec1192d75d Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Sun, 24 May 2026 22:45:46 -0400 Subject: [PATCH] fix(ci): keep current-timestamp on CJS path to avoid Windows bridge crash --- get-shit-done/bin/gsd-tools.cjs | 18 +++++------------- tests/commands.test.cjs | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/get-shit-done/bin/gsd-tools.cjs b/get-shit-done/bin/gsd-tools.cjs index 11aeb4c36..350b2ef05 100755 --- a/get-shit-done/bin/gsd-tools.cjs +++ b/get-shit-done/bin/gsd-tools.cjs @@ -771,19 +771,11 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand } case 'current-timestamp': { - // Phase 6 (#3575): dispatch via SDK executeForCjs when available. - // SDK handler: currentTimestamp in sdk/src/query/utils.ts. - const handled = _dispatchNonFamily({ - registryCommand: 'current-timestamp', - registryArgs: args.slice(1), - legacyCommand: 'current-timestamp', - legacyArgs: args.slice(1), - cwd, - raw, - error, - output: core.output, - }); - if (!handled) commands.cmdCurrentTimestamp(args[1] || 'full', raw); + // Keep this command on the CJS fast path. + // Rationale: it is a pure local formatter and avoids SDK bridge startup + // in tight subprocess loops where Windows CI has shown intermittent + // native crashes (0xC0000005 / 3221225477). + commands.cmdCurrentTimestamp(args[1] || 'full', raw); break; } diff --git a/tests/commands.test.cjs b/tests/commands.test.cjs index 4f24e70ad..0413889f3 100644 --- a/tests/commands.test.cjs +++ b/tests/commands.test.cjs @@ -888,6 +888,24 @@ describe('current-timestamp command', () => { const output = JSON.parse(result.output); assert.match(output.timestamp, /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/, 'default should be full ISO format'); }); + + test('dispatches directly to CJS handler (no SDK bridge) to avoid Windows native crash path', () => { + const sourcePath = path.join(__dirname, '..', 'get-shit-done', 'bin', 'gsd-tools.cjs'); + const source = fs.readFileSync(sourcePath, 'utf8'); + const match = source.match(/case 'current-timestamp':\s*\{[\s\S]*?\n\s*break;\n\s*\}/); + + assert.ok(match, 'current-timestamp case block must exist in gsd-tools.cjs'); + + const block = match[0]; + assert.ok( + !block.includes('_dispatchNonFamily('), + 'current-timestamp must not route through SDK bridge' + ); + assert.ok( + block.includes("commands.cmdCurrentTimestamp(args[1] || 'full', raw);"), + 'current-timestamp must call the CJS handler directly' + ); + }); }); // ─────────────────────────────────────────────────────────────────────────────