Skip to content

CodeTailor: stop turning \n escapes in code into newlines - #1620

Merged
bnmnetp merged 1 commit into
RunestoneInteractive:mainfrom
aspadiyath:fix-codetailor-escaped-newlines
Oct 20, 2026
Merged

bnmnetp merged 1 commit into
RunestoneInteractive:mainfrom
aspadiyath:fix-codetailor-escaped-newlines

Conversation

@aspadiyath

Copy link
Copy Markdown
Contributor

get_parsons_help ran .replace("\\n", "\n") on the student code, the test code and the backup example. Callers now pass real text, so this turned every \n escape inside a string literal into an actual line break. A CSAwesome test with String expect = "5\n10\n10"; then fails to compile (RunestoneTests.java:18: error: unclosed string literal), every generated fix "fails" its tests, and CodeTailor silently falls back to the example solution.

This affects any CodeTailor question whose tests, student code or example contain \n in a string, which is common in CSAwesome tests (e.g. expected output "Bill\nDot\n"), and Python tests too.

Found while piloting new Unit 3 CSAwesome problems: 4 of 5 fell back to example_solution even though the LLM's fixed code passed the tests when run on JOBE directly. With this change all 5 return AI_personalized. The problem description still gets the replace; only the code fields change.

🤖 Generated with Claude Code

get_parsons_help replaced every "\n" in the student code, the test code
and the example with a real newline, left over from when these arrived
escaped. Callers now pass real text, so the replace broke any string
literal containing \n -- e.g. a CSAwesome test's String expect =
"5\n10\n10" no longer compiled, every generated fix failed its tests,
and CodeTailor silently fell back to the example solution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aspadiyath
aspadiyath requested a review from bnmnetp as a code owner October 19, 2026 18:00
@bnmnetp
bnmnetp merged commit a21f038 into RunestoneInteractive:main Oct 20, 2026
2 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.

2 participants