Repository navigation
fix(spreadsheetbench): return the code of an unclosed fenced block - #489
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
extract_code returned the whole reply when the opening code fence had no closing fence, which happens when a reply is cut off at the token limit. The fence line and any prose before it were then run as Python and the attempt failed with a SyntaxError. Return the text after the opening fence line in that case. Closed blocks and replies without a fence are unchanged.
This branch has not been deployed
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.
Summary
extract_codeinskillopt/envs/spreadsheetbench/codegen_agent.pyreturned the whole reply when the opening code fence had no closing fence. A reply cut off at the token limit is the usual case. Thepythonfence line and any prose before it were then passed on as code, the extracted text did not compile, and the attempt failed with a SyntaxError instead of feedback on the model's logic.This change returns the text after the opening fence line when there is no closing fence.
Changes
skillopt/envs/spreadsheetbench/codegen_agent.py:extract_codereturns the text after the opening fence line when no closing fence follows. Closed blocks and replies without a fence keep their current output.tests/test_spreadsheetbench_extract_code.py: new tests (see below).CHANGELOG.md: entry under Fixed.Tests
pythonfence, and with a language-less fence) and a reply without a fence.ruff checkandruff format --checkpass on the new test file.codegen_agent.pyhas the same ruff findings as on main (5 fixable lint items and 43 format differences, the same counts as on main), so this change adds none.Fixes #488