This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Description Issue
When generating code files, Claude Sonnet occasionally generates malformed XML closing tags that break file extraction.
Example
Project ID: 3jWgMMickCJqLWQCB (on macserver)
Model: anthropic/claude-haiku-4-5-20251001
The LLM generated:
<sg-file path="src/components/ui/button.tsx" summary="Created button UI component">
... code content ...
</sx-file> ❌ WRONG - should be </sg-file>
Impact
❌ File extraction fails - content not written to workspace
❌ Raw XML tags left in message display, confusing users
✅ In this case, build still succeeded because button.tsx already existed in scaffold
Root Cause
Claude Sonnet made a typo in the closing tag: </sx-file> instead of </sg-file>
Sigrid's XML parser expects exact tag matching:
Opening: <sg-file>
Closing: </sg-file>
When tags don't match, the parser:
Fails to extract file content
Fails to clean up tags from message content
Leaves raw XML visible to users
Suggested Fixes
Option 1: More lenient parsing
Accept common typos like </sx-file>, </sg-files>
Use fuzzy matching for closing tags
Option 2: Better error recovery
Strip malformed tags from message display even if extraction fails
Show user-friendly error message instead of raw XML
Option 3: Prompt engineering
Add explicit examples in system prompt emphasizing exact tag format
Add validation reminder before generating closing tags
Related Code
File extraction likely happens in:
filetooling.js
llm-static.js or llm-dynamic.js
Reactions are currently unavailable