Skip to content

fix(CodeParser): strip LLM-injected filename headers from extracted c…#1986

Open
dqj1998 wants to merge 1 commit intoFoundationAgents:mainfrom
dqj1998:fix/strip-markdown-filename-header
Open

fix(CodeParser): strip LLM-injected filename headers from extracted c…#1986
dqj1998 wants to merge 1 commit intoFoundationAgents:mainfrom
dqj1998:fix/strip-markdown-filename-header

Conversation

@dqj1998
Copy link
Copy Markdown

@dqj1998 dqj1998 commented Mar 26, 2026

When Engineer generates code, the LLM sometimes echoes the filename marker (e.g., '## quickSort.js') inside the code block instead of outside it. CodeParser.parse_code() then captures this marker as part of the code, producing invalid syntax in the output files.

Features

  • Add a post-extraction strip to remove any leading '## filename.ext' line from the captured code
  • Add regression tests covering both cases (with and without blank line after the header).

…ode blocks

When Engineer generates code, the LLM sometimes echoes the filename
marker (e.g., '## quickSort.js') inside the code block instead of
outside it. CodeParser.parse_code() then captures this marker as
part of the code, producing invalid syntax in the output files.

Add a post-extraction strip to remove any leading '## filename.ext'
line from the captured code, and add regression tests covering both
cases (with and without blank line after the header).

Co-Authored-By: Claude Sonnet 4.6 <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.

1 participant