-
Notifications
You must be signed in to change notification settings - Fork 756
Description
Describe the bug
Agents defined in markdown files fail to load if any line in the YAML frontmatter ends with CRLF (\r\n) characters. Only agents with pure LF (\n) line endings load successfully.
The CLI logs warnings depending on the type of CRLF usage:
- For pure CRLF files:
failed to parse front matter: Unexpected scalar at node end - For mixed line endings containing any CRLF:
custom agent markdown frontmatter is malformed
Affected version
0.0.353 Commit: f8fd3e3 0.0.365 Commit: 76d0881
Steps to reproduce the behavior
-
Set up a project with the following structure:
.github/ └── agents/ ├── test-agent-ending-crlf.md (all lines CRLF - FAILS) ├── test-agent-ending-lf.md (all lines LF - WORKS) ├── test-agent-ending-crlf-lf.md (alternating CRLF/LF - FAILS) └── test-agent-ending-lf-crlf.md (alternating LF/CRLF - FAILS) -
Create the agent files with specific line endings as described below. Each file has 6 lines with the following content:
--- name: <agent-name> description: '<description>' --- Respond with a random emoji.Confirmed line endings from disk:
-
test-agent-ending-crlf.md: All lines end with CRLF (\r\n)- Line 1: CRLF, Line 2: CRLF, Line 3: CRLF, Line 4: CRLF, Line 5: CRLF, Line 6: CRLF
-
test-agent-ending-lf.md: All lines end with LF (\n)- Line 1: LF, Line 2: LF, Line 3: LF, Line 4: LF, Line 5: LF, Line 6: LF
-
test-agent-ending-crlf-lf.md: Alternating, starting with CRLF- Line 1: CRLF, Line 2: LF, Line 3: CRLF, Line 4: LF, Line 5: CRLF, Line 6: LF
-
test-agent-ending-lf-crlf.md: Alternating, starting with LF- Line 1: LF, Line 2: CRLF, Line 3: LF, Line 4: CRLF, Line 5: LF, Line 6: CRLF
-
-
Run
npx --yes @github/[email protected] --agent <agent-name> --prompt "begin" --log-level all -
Observe the results:
| Agent File | Line Endings | Result | Error Message |
|---|---|---|---|
test-agent-ending-crlf |
All CRLF | ❌ FAILS | "No such agent" |
test-agent-ending-lf |
All LF | ✅ WORKS | (outputs emoji) |
test-agent-ending-crlf-lf |
Alternating CRLF/LF | ❌ FAILS | "No such agent" |
test-agent-ending-lf-crlf |
Alternating LF/CRLF | ❌ FAILS | "No such agent" |
Expected behavior
The agent should load correctly regardless of line endings (CRLF or LF) in the frontmatter. This is especially important on Windows where CRLF is the default line ending.
While it is debatable if the mixed line-ending scenario should work (would be nice) it is more important to see the CRLF scenario work as many of our agents will be authored in Windows. At the very least, a specific error message on the CLI should be output if the line endings are not supported (as of right now they are deep in the logs and hard to understand why the agents do not load).
Additional context
Log Warnings (from --log-level all)
[WARNING] C:\...\test-agent-ending-crlf.md: failed to parse front matter: Unexpected scalar at node end at line 2, column 67:
description: 'A test agent with MCP tools, line endings CRLF \r\n'
^
[WARNING] C:\...\test-agent-ending-crlf-lf.md: custom agent markdown frontmatter is malformed
[WARNING] C:\...\test-agent-ending-lf-crlf.md: custom agent markdown frontmatter is malformed
Output of CRLF scenario
npx --yes @github/[email protected] --agent test-agent-ending-crlf --prompt "begin" --log-level all
No such agent: test-agent-ending-crlf, available: test-agent-ending-lf
Output of LF scenario
npx --yes @github/[email protected] --agent test-agent-ending-lf --prompt "begin" --log-level all
🦋