fix(plugin-dev): read full multi-line description in validate-agent.sh#76985
Open
AliAltivate wants to merge 1 commit into
Open
fix(plugin-dev): read full multi-line description in validate-agent.sh#76985AliAltivate wants to merge 1 commit into
AliAltivate wants to merge 1 commit into
Conversation
validate-agent.sh extracted the description with `grep '^description:'`, which captures only the first physical line of a multi-line YAML description and drops the continuation lines where the <example> blocks live. As a result desc_length was computed on the truncated line and the <example> check always failed, so every agent with a multi-line description (agent-creator, plugin-validator, skill-reviewer) got a false "should include <example> blocks" warning. On Linux (bash >= 4.1) this was worse than cosmetic: under `set -euo pipefail`, the `((warning_count++))` triggered by the false warning returns exit 1 and aborts the script, so the validator exited 1 with no summary when run on the repo's own agents. Extract the full description block (from `description:` up to the next known frontmatter key) via awk so the length and <example> checks run on the complete value. It stops only at name/model/color/tools, not at generic `word:` lines, because <example> blocks contain Context:/user:/assistant: lines. Verified on all 15 plugins/**/agents/*.md: 3 false warnings removed, 11 files byte-identical, no exit-code changes; on Linux (bash 5.2) the validator now completes (exit 0) instead of aborting. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
plugins/plugin-dev/skills/agent-development/scripts/validate-agent.shextracts the agent'sdescriptionfrontmatter with:DESCRIPTION=$(echo "$FRONTMATTER" | grep '^description:' | sed 's/description: *//')grepis line-oriented, so this keeps only the first physical line of a multi-line YAML description and drops the continuation lines — which is exactly where the<example>blocks live. Two checks then misfire:desc_lengthis computed on the truncated first line.<example>check (grep -q '<example>') always fails.So every agent with a multi-line description gets a bogus
⚠️ description should include <example> blocks for triggering— including the repo's ownplugin-devagents (agent-creator,plugin-validator,skill-reviewer).Why it's more than cosmetic (Linux)
On Linux with bash ≥ 4.1, under the script's
set -euo pipefail, the((warning_count++))that the false warning triggers evaluates to0on the first increment, returns exit status 1, and aborts the script. Running the shipped validator on the repo's ownagent-creator.mdinbash:5.2:before — dies right after the false warning, no summary, exit 1:
after — runs to completion, exit 0:
(On macOS bash 3.2 the script doesn't errexit on
(( )), so there the same bug surfaces as just the false warning.)The fix
Extract the full description block — from the
description:line up to the next known frontmatter key — so the length and<example>checks run on the complete value:It stops only at
name/model/color/tools, not at genericword:lines, because<example>blocks contain column-0Context:/user:/assistant:lines that a naive next-key match would trip on.Verification
Before/after on all 15
plugins/**/agents/*.md:agent-creator,plugin-validator,skill-reviewer)code-simplifier— reported character count corrected (no warning or exit-code change)bash -nclean; theawkprogram works on BSD awk (macOS) and busybox awk (Alpine)Out of scope (noted, not fixed here)
The same script has a separate, pre-existing fragility: under
set -euo pipefail,grep '^field:'for a missing field and((count++))from0can each abort the script independently of this bug. Fixing that touches ~12 sites and is a larger change, so I've kept this PR focused. Happy to follow up if that would be useful.🤖 Generated with Claude Code