* fix(#373): replace unquoted $GSD_SDK with space-safe gsd_run launcher Workflow bash blocks resolved the runtime as GSD_SDK="node $GSD_TOOLS" and invoked it unquoted ($GSD_SDK query ...). On install paths containing spaces (e.g. /Volumes/Mini Me/...) the unquoted expansion word-split into `node /Volumes/Mini gsd-tools.cjs ...`, failing with "Cannot find module '/Volumes/Mini'" and getting masked by `2>/dev/null || echo "{}"` into a silent empty state. Replace the string variable with a single-line shell launcher that defines a gsd_run function, invokes the runtime with a fully-quoted path and "$@", and preserves the local-cjs / installed-gsd-tools-on-PATH fallback (#3668) plus the loud not-found error and install hint. The launcher uses _GSD_SHIM_NAME indirection so no workflow emits the /gsd-tools substring that the do.md dispatcher-parity scanner would misread, and is single-line to stay within the per-file progressive-disclosure line budgets (#2551). The canonical launcher lives in get-shit-done/workflows/_runtime-launcher.snippet.sh, is propagated once per file by scripts/sync-runtime-launcher.cjs, and is locked by tests/runtime-launcher-parity.test.cjs (fails CI on drift, on a reappearing $GSD_SDK token, or on a /gsd-tools substring). Dependent workflow-assertion tests are updated from $GSD_SDK to gsd_run, and the runtime launcher is registered in CONTEXT.md. Fixes #373 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci(#373): add changeset fragment and allow-test-rule for parity guard The runtime-launcher parity test is a structural drift guard that reads workflow markdown to assert the canonical launcher is present and the retired $GSD_SDK / /gsd-tools tokens are absent; annotate it with allow-test-rule per the no-source-grep lint escape hatch. Add the required .changeset fragment for this user-facing fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(#373): make parity PATH-fallback assertion cross-platform (Windows) Subtest (E) compared GSD_TOOLS against the Node-side absolute temp path, but the value originates from git-bash which reports the POSIX form, so the prefix comparison failed on windows-latest while the launcher itself worked (the installed stub was invoked). Assert the resolved binary by normalized suffix (/bin/gsd-tools, not .cjs) instead of the absolute prefix; the behavioral stub-invocation assertion is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
2.8 KiB
JavaScript
70 lines
2.8 KiB
JavaScript
/**
|
|
* Regression test for bug #3360.
|
|
*
|
|
* Codex does not have a direct equivalent of Claude Code's
|
|
* `Agent(... isolation="worktree")`. The execute-phase workflow must fail
|
|
* closed for Codex + workflow.use_worktrees=true instead of spawning
|
|
* workspace-write executors in the main checkout.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const ROOT = path.join(__dirname, '..');
|
|
const EXECUTE_PHASE = path.join(ROOT, 'get-shit-done', 'workflows', 'execute-phase.md');
|
|
const { getCodexSkillAdapterHeader } = require('../bin/install.js');
|
|
|
|
function parseWorkflowSteps(content) {
|
|
return [...content.matchAll(/<step name="([^"]+)"[^>]*>([\s\S]*?)<\/step>/g)]
|
|
.map((match) => {
|
|
const body = match[2];
|
|
return {
|
|
name: match[1],
|
|
// After #3797 architectural fix, callsites use gsd_run
|
|
readsRuntimeConfig: body.includes('RUNTIME=$(gsd_run query config-get runtime --default claude'),
|
|
codexWorktreeGuard: body.includes('Codex execute-phase worktree isolation is unsupported'),
|
|
worktreeDispatchGuidance: body.includes('isolation="worktree"'),
|
|
};
|
|
});
|
|
}
|
|
|
|
function executePhaseWorktreeContract(content) {
|
|
const steps = parseWorkflowSteps(content);
|
|
const initializeIndex = steps.findIndex((step) => step.name === 'initialize');
|
|
const firstWorktreeDispatchIndex = steps.findIndex((step) => step.worktreeDispatchGuidance);
|
|
assert.notEqual(initializeIndex, -1, 'workflow must have an initialize step');
|
|
assert.notEqual(firstWorktreeDispatchIndex, -1, 'workflow must still document worktree dispatch guidance');
|
|
|
|
const initialize = steps[initializeIndex];
|
|
return {
|
|
initializeReadsRuntimeConfig: initialize.readsRuntimeConfig,
|
|
initializeHasCodexWorktreeGuard: initialize.codexWorktreeGuard,
|
|
guardStepPrecedesWorktreeDispatch: initializeIndex <= firstWorktreeDispatchIndex,
|
|
};
|
|
}
|
|
|
|
describe('#3360 — Codex execute-phase fails closed for unsupported worktree isolation', () => {
|
|
test('execute-phase reads runtime before worktree dispatch and blocks Codex worktree mode', () => {
|
|
const workflow = fs.readFileSync(EXECUTE_PHASE, 'utf8');
|
|
const contract = executePhaseWorktreeContract(workflow);
|
|
|
|
assert.deepEqual(contract, {
|
|
initializeReadsRuntimeConfig: true,
|
|
initializeHasCodexWorktreeGuard: true,
|
|
guardStepPrecedesWorktreeDispatch: true,
|
|
});
|
|
});
|
|
|
|
test('Codex adapter documents that worktree isolation has no direct spawn_agent mapping', () => {
|
|
const header = getCodexSkillAdapterHeader('gsd-execute-phase');
|
|
assert.match(header, /isolation="worktree"/);
|
|
assert.match(header, /no direct Codex mapping/i);
|
|
});
|
|
});
|