Merge nucleic/plucky-north-vole-sdna into dev
This commit is contained in:
@@ -64,6 +64,25 @@ class LabelSWEChatPromptsTests(unittest.TestCase):
|
||||
encoded = json.dumps(state)
|
||||
self.assertNotIn("It fails only on CI.", encoded)
|
||||
|
||||
def test_response_sanitizer_preserves_all_prose_and_removes_code_payloads(self):
|
||||
response = (
|
||||
"I found the likely cause.\n\n"
|
||||
"```swift\nlet secret = \"not teacher context\"\n```\n\n"
|
||||
"The fix is to await the task.\n"
|
||||
"<tool_use>{\"cmd\": \"rm -rf /\"}</tool_use>\n"
|
||||
"Then rerun the focused test."
|
||||
)
|
||||
sanitized = label_swe_chat_prompts.response_for_labeling(response, 2_000)
|
||||
self.assertIn("I found the likely cause.", sanitized)
|
||||
self.assertIn("The fix is to await the task.", sanitized)
|
||||
self.assertIn("Then rerun the focused test.", sanitized)
|
||||
self.assertNotIn("let secret", sanitized)
|
||||
self.assertNotIn("rm -rf", sanitized)
|
||||
|
||||
def test_response_sanitizer_refuses_to_truncate_prose(self):
|
||||
with self.assertRaisesRegex(ValueError, "rather than truncating"):
|
||||
label_swe_chat_prompts.response_for_labeling("x" * 1_001, 1_000)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user