Skip to content

fix(agents): resolve skill placeholders in Goose (yaml) command output#3374

Open
jawwad-ali wants to merge 2 commits into
github:mainfrom
jawwad-ali:fix/goose-yaml-skill-placeholders
Open

fix(agents): resolve skill placeholders in Goose (yaml) command output#3374
jawwad-ali wants to merge 2 commits into
github:mainfrom
jawwad-ali:fix/goose-yaml-skill-placeholders

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

Description

CommandRegistrar.register_commands resolves command-body placeholders — {SCRIPT}, __AGENT__ (via resolve_skill_placeholders) and $ARGUMENTS (via _convert_argument_placeholder) — in the markdown and toml branches, but the yaml branch (Goose recipes) called render_yaml_command directly and skipped both:

elif agent_config["format"] == "yaml":
    output = self.render_yaml_command(frontmatter, body, source_id, cmd_name)

So an extension/preset command installed for Goose kept the literal {SCRIPT}, __AGENT__, and unrewritten repo-relative script paths in the generated .goose/recipes/*.yaml prompt. Reproduced on main @ 92b7cf7: the same command body renders correctly for claude (skills) and gemini (toml) but Goose emitted Run {SCRIPT} for agent __AGENT__ with $ARGUMENTS. verbatim.

Fix

Mirror the markdown/toml branches — run resolve_skill_placeholders + _convert_argument_placeholder on body before render_yaml_command. (body is reassigned before the downstream alias loop, so aliases inherit the resolved text too.)

Testing

New TestGooseCommandPlaceholderResolution: registers a command whose body has {SCRIPT}/__AGENT__/$ARGUMENTS for goose, then asserts the generated .goose/recipes/speckit.example.yaml contains none of the literals (they resolve to .specify/scripts/..., agent goose, {{args}}). Fails before (literals present — verified by source-stash), passes after. Full goose suite: 25 passed. uvx ruff check clean.

AI Disclosure

  • I did use AI assistance (describe below)

Found and fixed with Claude Code (Claude Fable 5) under my direction. AI flagged the yaml branch as the odd one out across the three format branches; I reproduced the literal-placeholder leak against the claude/gemini baselines, verified fail-before/pass-after, and reviewed the diff.

CommandRegistrar.register_commands resolves {SCRIPT}/__AGENT__ and the
$ARGUMENTS placeholder in the markdown and toml branches, but the yaml
branch (Goose recipes) called render_yaml_command directly, skipping
both. So extension/preset command bodies installed for Goose kept literal
{SCRIPT}, __AGENT__, and repo-relative script paths in the generated
.goose/recipes/*.yaml prompt. Mirror the markdown/toml branches: run
resolve_skill_placeholders + _convert_argument_placeholder on the body
before render_yaml_command.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Goose (YAML recipe) command generation so command-body placeholders like {SCRIPT}, __AGENT__, and $ARGUMENTS are resolved consistently with the markdown and toml output branches when CommandRegistrar.register_commands() renders commands.

Changes:

  • Apply resolve_skill_placeholders() for the YAML (Goose) branch before rendering recipes.
  • Apply _convert_argument_placeholder() for the YAML (Goose) branch after placeholder resolution so newly-introduced $ARGUMENTS (via {ARGS} / {SCRIPT}) are converted.
  • Add a regression test ensuring Goose-generated recipes do not emit the placeholder literals verbatim.
Show a summary per file
File Description
src/specify_cli/agents.py Resolves {SCRIPT} / __AGENT__ and converts $ARGUMENTS in the YAML (Goose) branch before rendering the recipe.
tests/integrations/test_integration_goose.py Adds a regression test covering placeholder resolution behavior for Goose recipe output.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread tests/integrations/test_integration_goose.py Outdated
Per review: parse the generated recipe with yaml.safe_load and assert the
prompt contains the resolved values (.specify/scripts/, 'agent goose',
{{args}}), not merely that the literal tokens are absent — a wrong output
that happens to omit the exact strings would otherwise pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants