feat(agentbuilder): harden generated skill prompt boundaries#577
Open
Alan-TheGentleman wants to merge 1 commit into
Open
feat(agentbuilder): harden generated skill prompt boundaries#577Alan-TheGentleman wants to merge 1 commit into
Alan-TheGentleman wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the internal/agentbuilder skill-generation prompt composition by introducing explicit XML-like wrappers around volatile/dynamic prompt payloads and escaping dynamic values to prevent wrapper delimiter breakout, while preserving the contract that the model must output raw SKILL.md Markdown.
Changes:
- Wrap installed-agent context, SDD context, and the user request in
<installed_agents>,<sdd_context>, and<user_request>tags. - Escape dynamic values via
html.EscapeStringto prevent</...>delimiter breakout from user/config-provided content. - Update and extend unit tests to assert wrapper presence/absence and verify breakout-hardening behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/agentbuilder/prompt.go | Adds XML-like wrappers around volatile prompt sections and escapes dynamic values. |
| internal/agentbuilder/prompt_test.go | Updates prompt composition assertions and adds delimiter-breakout regression tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
🔗 Linked Issue
Closes #576
🏷️ PR Type
What kind of change does this PR introduce?
type:bug— Bug fix (non-breaking change that fixes an issue)type:feature— New feature (non-breaking change that adds functionality)type:docs— Documentation onlytype:refactor— Code refactoring (no functional changes)type:chore— Build, CI, or tooling changestype:breaking-change— Breaking change (fix or feature that changes existing behavior)📝 Summary
This PR pilots XML-like prompt boundaries in the custom agent builder. It wraps volatile prompt payloads in explicit tags while preserving the generated artifact contract: the model must still output raw
SKILL.mdMarkdown.What this gains:
</user_request>.This does not convert skills, docs, installer assets, or SDD assets away from Markdown.
📂 Changes
internal/agentbuilder/prompt.gohtml.EscapeString.internal/agentbuilder/prompt_test.goSKILL.mdoutput preservation, and delimiter-breakout cases.🧪 Test Plan
Unit Tests
E2E Tests (Docker required)
go test ./...)cd e2e && ./docker-test.sh)E2E was not run because this is a focused prompt-composition change with package and full Go test coverage.
🤖 Automated Checks
The following checks run automatically on this PR:
additions + deletions) or usesize:exceptionCloses/Fixes/Resolves #Nstatus:approvedtype:*Labeltype:*label must be appliedgo test ./...must passcd e2e && ./docker-test.shmust pass✅ Contributor Checklist
status:approvedsize:exceptionwith rationale documentedtype:*label to this PRgo test ./...)cd e2e && ./docker-test.sh)Co-Authored-Bytrailers💬 Notes for Reviewers
The important boundary is intentionally narrow: XML-like tags are for volatile prompt payloads only.
SKILL.mdremains Markdown because it is the durable human-authored and agent-consumed source of truth.This hardens delimiter breakout, not prompt injection generally. User-controlled text can still contain persuasive instructions inside
<user_request>, but it can no longer close that wrapper and appear as a separate authoritative section.