Fix coldbox ai refresh custom-skill manifest crash and preserve AGENTS.md content outside managed markers#71
Merged
Conversation
…ions Agent-Logs-Url: https://github.com/ColdBox/coldbox-cli/sessions/d4c4e167-5ab3-4436-a91f-9cd8a0a58a0e Co-authored-by: lmajano <137111+lmajano@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
lmajano
May 14, 2026 20:57
View session
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability of coldbox ai refresh by fixing a Lucee closure-scope crash during custom-skill syncing and by hardening the agent file merge logic to preserve user-authored content outside the CLI-managed marker block.
Changes:
- Fixes Lucee closure scoping in
SkillManager.refresh()by using the function-scopedmanifestreference insideeach()/filter()closures. - Updates
AgentRegistry.mergeUserContent()to preserve content both before<!-- COLDBOX-CLI:START -->and after<!-- COLDBOX-CLI:END -->when refreshing agent files. - Updates inline documentation to reflect the new marker-pair behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| models/SkillManager.cfc | Uses function-scoped manifest inside closures to prevent Lucee runtime errors when syncing/removing skills-custom entries. |
| models/AgentRegistry.cfc | Reworks merge logic to preserve user content on both sides of the managed marker block during refresh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var newStartPos = findNoCase( startMarker, newContent ) | ||
| var newEndPos = findNoCase( endMarker, newContent ) | ||
| if ( !newStartPos || !newEndPos || newEndPos <= newStartPos ) { | ||
| return newContent & userContentAfterManaged |
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.
coldbox ai refreshcould crash when syncingskills-customdue to invalid closure scope usage inSkillManager. It could also overwrite user-authoredAGENTS.mdcontent when the managed marker block was repositioned.Custom skill sync crash fix (
SkillManager.refresh)arguments.manifestwith the locally scopedmanifeststruct during custom-skill removal/sync.skills-customentries.Agent file merge hardening (
AgentRegistry.mergeUserContent)<!-- COLDBOX-CLI:START --><!-- COLDBOX-CLI:END -->Behavioral impact
coldbox ai refreshnow safely picks up new/deleted custom skills without manifest-scope exceptions.AGENTS.mdremains intact outside the CLI-managed section, even if the marker block is moved lower in the file.