diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index f8bffe7bd..783d327e6 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -1,7 +1,6 @@ # Changelog ## [Unreleased] - ### Added - Added `task.maxConcurrency` setting to control concurrent limit for subagents (default: 32) @@ -17,6 +16,10 @@ - Removed `MAX_PARALLEL_TASKS` constant and associated task count validation limit +### Fixed + +- Improved frontmatter parsing error messages to include source context for better debugging + ## [10.6.1] - 2026-02-04 ### Added diff --git a/packages/coding-agent/src/config/prompt-templates.ts b/packages/coding-agent/src/config/prompt-templates.ts index 298f6a4d7..4890b5e09 100644 --- a/packages/coding-agent/src/config/prompt-templates.ts +++ b/packages/coding-agent/src/config/prompt-templates.ts @@ -226,6 +226,8 @@ handlebars.registerHelper("not", (value: unknown): boolean => !value); handlebars.registerHelper("jtdToTypeScript", (schema: unknown): string => jtdToTypeScript(schema)); +handlebars.registerHelper("jsonStringify", (value: unknown): string => JSON.stringify(value)); + export function renderPromptTemplate(template: string, context: TemplateContext = {}): string { const compiled = handlebars.compile(template, { noEscape: true, strict: false }); const rendered = compiled(context ?? {}); diff --git a/packages/coding-agent/src/prompts/agents/frontmatter.md b/packages/coding-agent/src/prompts/agents/frontmatter.md index dc298e6fb..a043b089c 100644 --- a/packages/coding-agent/src/prompts/agents/frontmatter.md +++ b/packages/coding-agent/src/prompts/agents/frontmatter.md @@ -1,8 +1,8 @@ --- -name: {{name}} -description: {{description}} -{{#if spawns}}spawns: {{spawns}} -{{/if}}{{#if model}}model: {{model}} -{{/if}}{{#if thinkingLevel}}thinkingLevel: {{thinkingLevel}} +name: {{jsonStringify name}} +description: {{jsonStringify description}} +{{#if spawns}}spawns: {{jsonStringify spawns}} +{{/if}}{{#if model}}model: {{jsonStringify model}} +{{/if}}{{#if thinkingLevel}}thinkingLevel: {{jsonStringify thinkingLevel}} {{/if}}--- {{body}} \ No newline at end of file diff --git a/packages/coding-agent/src/utils/frontmatter.ts b/packages/coding-agent/src/utils/frontmatter.ts index 06da3ede8..54ee3b23d 100644 --- a/packages/coding-agent/src/utils/frontmatter.ts +++ b/packages/coding-agent/src/utils/frontmatter.ts @@ -18,7 +18,7 @@ export class FrontmatterError extends Error { error: Error, public readonly source?: unknown, ) { - super(`Failed to parse YAML frontmatter: ${error.message}`, { cause: error }); + super(`Failed to parse YAML frontmatter (${source}): ${error.message}`, { cause: error }); this.name = "FrontmatterError"; }