Skip to content

fix: drop the fence language tag when a full rewrite falls back to any code block - #544

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
r0h1tb:fix/full-rewrite-fence-tag
Oct 25, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
r0h1tb:fix/full-rewrite-fence-tag

Conversation

@r0h1tb

@r0h1tb r0h1tb commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

When a full-rewrite response's fence language doesn't match config.language, parse_full_rewrite falls back to ```(.*?)```, which keeps the tag. So ```py, ```python3, ```Python (or ```js with language: javascript, ```rs with rust) put the tag on the first line of the extracted program, and evaluation fails with a NameError/syntax error.

The fallback now skips a single-word tag on the fence line, with the same trailing-whitespace and CRLF handling as the language-specific pattern. Fences without a tag, and the one-line ```x = 1``` form, are parsed as before.

Tests: new test_parse_full_rewrite_other_language_tag (LF/CRLF, several tags); all 9 subtests fail on main. Full unit suite 881 → 882 passed, 2 skipped. Black passes.

…y code block

When the response's fence language doesn't match the configured one
(```py, ```python3, ```js for javascript, ...), parse_full_rewrite fell
back to a pattern that captured everything after the backticks, so the tag
became the first line of the extracted program.
@CLAassistant

CLAassistant commented Oct 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion merged commit 6461f7d into algorithmicsuperintelligence:main Oct 25, 2026
5 checks passed
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.

3 participants