probe internal PR #1

Closed
ossfix26 wants to merge 1 commit from fix/code-blob-fence-parsing-201 into main

1 commit

Author SHA1 Message Date
45c78079d0 fix: parse Markdown code fences robustly in model output
parse_code_blobs fell back to a single regex requiring a lowercase
```python/```py fence with a newline immediately before the closing
fence. Common LLM variants were rejected (bare fences, capitalized
```Python, indented and tilde fences), and the info string of a
```python3 fence leaked into the extracted code.

Replace the fallback with extract_markdown_code_from_text, which
recognizes CommonMark-style fences (backticks or tildes, optional
indentation, optional case-insensitive python/py info string with an
optional version suffix), strips the info string, normalizes CRLF and
de-indenes fenced bodies. Non-Python blocks and unclosed fences are
ignored, preserving the existing ValueError/ast-parse fallbacks.

Adds deterministic unit tests covering the reported variants.

Fixes #201.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-27 17:14:40 +00:00