fix(3610): replace resolved prompt actions and keep explicit block path

This commit is contained in:
Tom Boucher
2026-05-15 22:56:32 -04:00
parent f422a05450
commit 0862df15df
2 changed files with 12 additions and 5 deletions

View File

@@ -217,10 +217,17 @@ function resolveInstallerMigrationPromptsForNonTty(result, options = {}) {
if (choice) {
const resolved = materializeResolution(action, choice);
// Inject the concrete action into plan.actions so the apply
// step picks it up.
// Replace the original prompt-user action in-place when present so
// applyInstallerMigrationPlan never sees an unsupported action type.
// Fallback to append only when the blocked action did not originate
// from plan.actions (defensive).
if (result.plan && Array.isArray(result.plan.actions)) {
result.plan.actions.push(resolved);
const idx = result.plan.actions.indexOf(action);
if (idx >= 0) {
result.plan.actions[idx] = resolved;
} else {
result.plan.actions.push(resolved);
}
}
resolutions.push({
relPath: action.relPath,

View File

@@ -306,7 +306,7 @@ describe('installer migration install integration', { concurrency: false }, () =
});
test('blocks install before materialization when baseline needs explicit user choice', () => {
writeFile(codexHome, 'hooks/gsd-retired-hook.js', 'old gsd hook\n');
writeFile(codexHome, 'hooks/gsd-retired-hook.txt', 'old gsd hook\n');
assert.throws(
() => captureConsole(() =>
@@ -315,7 +315,7 @@ describe('installer migration install integration', { concurrency: false }, () =
/installer migration blocked/
);
assert.equal(fs.readFileSync(path.join(codexHome, 'hooks/gsd-retired-hook.js'), 'utf8'), 'old gsd hook\n');
assert.equal(fs.readFileSync(path.join(codexHome, 'hooks/gsd-retired-hook.txt'), 'utf8'), 'old gsd hook\n');
assert.equal(fs.existsSync(path.join(codexHome, 'skills')), false);
assert.equal(fs.existsSync(path.join(codexHome, 'get-shit-done', 'VERSION')), false);
});