From 6960fd28fed0086141a7779ace4fb6e55ff4fbfd Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Fri, 10 Apr 2026 13:55:13 -0400 Subject: [PATCH] fix(autonomous): add Agent to allowed-tools in gsd-autonomous skill (#2048) Closes #2043 Co-authored-by: Claude Sonnet 4.6 --- commands/gsd/autonomous.md | 1 + tests/autonomous-allowed-tools.test.cjs | 37 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/autonomous-allowed-tools.test.cjs diff --git a/commands/gsd/autonomous.md b/commands/gsd/autonomous.md index a12a0d548..61243503b 100644 --- a/commands/gsd/autonomous.md +++ b/commands/gsd/autonomous.md @@ -10,6 +10,7 @@ allowed-tools: - Grep - AskUserQuestion - Task + - Agent --- Execute all remaining milestone phases autonomously. For each phase: discuss → plan → execute. Pauses only for user decisions (grey area acceptance, blockers, validation requests). diff --git a/tests/autonomous-allowed-tools.test.cjs b/tests/autonomous-allowed-tools.test.cjs new file mode 100644 index 000000000..ecf1cb5dc --- /dev/null +++ b/tests/autonomous-allowed-tools.test.cjs @@ -0,0 +1,37 @@ +/** + * Regression test for #2043 — autonomous.md must include Agent in allowed-tools. + * + * The gsd-autonomous skill spawns background agents via Agent(..., run_in_background=true). + * Without Agent in allowed-tools the runtime rejects those calls silently. + */ + +'use strict'; + +const { describe, test } = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('fs'); +const path = require('path'); + +describe('commands/gsd/autonomous.md allowed-tools', () => { + test('includes Agent in allowed-tools list', () => { + const filePath = path.join(__dirname, '..', 'commands', 'gsd', 'autonomous.md'); + const content = fs.readFileSync(filePath, 'utf-8'); + + // Extract the YAML frontmatter block between the first pair of --- delimiters + const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/); + assert.ok(frontmatterMatch, 'autonomous.md must have YAML frontmatter'); + + const frontmatter = frontmatterMatch[1]; + + // Parse the allowed-tools list items (lines starting with " - ") + const toolLines = frontmatter + .split('\n') + .filter((line) => /^\s+-\s+/.test(line)) + .map((line) => line.replace(/^\s+-\s+/, '').trim()); + + assert.ok( + toolLines.includes('Agent'), + `allowed-tools must include "Agent" but found: [${toolLines.join(', ')}]` + ); + }); +});