Conversation
…block Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ownbench/runner.py::extract_code_blockhad two defects that could silently zero a correct answer:blocks[-1]. When a model emits the complete fixed file first and then appends prose containing a small ```py snippet, the tiny (wrong) trailing block was returned instead of the full file.\``[^\n]\n(.?)```` used DOTALL with a closing fence that was not anchored to the start of a line. A ``` appearing inside file content (e.g. an indented fence in a docstring) ended the capture early, returning a truncated slice.Fix
Replaced the single regex with a line-based scan:
^\s*```[^]*$` (leading whitespace allowed, optional info string), only when not already inside a block.^```\s*$, i.e. three backticks at column 0 (optional trailing whitespace).\n, preserving the newline before the closing fence to match prior semantics).max(blocks, key=len)), orNonewhen there are none.The full file outweighs a trailing snippet, and inner docstring fences are indented so they never match a column-0 closing fence. Signature/return type unchanged.
Tests added (
tests/test_extract.py)test_trailing_snippet_ignored— full-file block followed by prose + a tiny ```py snippet; the full block must win.test_nested_fence_in_docstring— a block containing an indented fence inside a docstring must be returned whole, not truncated.test_regression— a single clean block is extracted exactly; text with no fence returnsNone.Verification
Co-authored-by: CommandCodeBot noreply@commandcode.ai