Answer stability round 2: 0 🔴, 1 🟡; drop keys typed before the question when a release ready to cut opens claude too, and say where item 182's paste ends

This commit is contained in:
2026-10-17 23:41:59 +02:00
parent e7f5443688
commit 1f380af695
3 changed files with 10 additions and 9 deletions
+2 -2
View File
@@ -27,10 +27,10 @@ def put_question(question: str, answer_here: bool, effects: Effects) -> str | Ta
print(f"\n{question}", file=sys.stderr)
if stop := needs_terminal(ANSWER_QUESTION, effects.on_terminal()):
return stop
# Keys typed while the worker ran wait on the terminal, so they would answer a question no one has read, here or in claude's session, which reads them too. A paste's lines after the first are dropped with them at the next question, never taken as its answer; a longer answer goes through TALK.
effects.discard_typed()
if not answer_here:
return Talk()
# Keys typed while the worker ran wait on the terminal, so they would answer a question no one has read. A paste's lines after the first are dropped with them at the next question, never taken as its answer; a longer answer goes through TALK.
effects.discard_typed()
try:
answer = effects.input(ASK_ANSWER).strip()
except EOFError:
+7 -6
View File
@@ -388,7 +388,7 @@ class Cycles(unittest.TestCase):
resumed = fake.made("stream_claude")[1]
self.assertEqual(resumed[resumed.index("--resume") + 1], str(self.session.id))
typed = resumed[resumed.index("-p") + 1]
self.assertEqual(prompts.typed_answer(typed)[1], "Use B.")
self.assertEqual(prompts.typed_answer(typed).answer, "Use B.")
self.assertIn("Which one?", typed)
self.assertIn("Continue the task. The chunk is finished only once every answer the human typed in it", typed)
judge_prompts = [stdin for args, stdin in fake.made("claude")]
@@ -552,6 +552,7 @@ class Interrupts(unittest.TestCase):
fake = FakeEffects(inputs=typed)
self.assertEqual(self.put(fake, answer_here)[0], interrupt.Talk())
self.assertEqual(len(fake.made("input")), len(typed))
self.assertEqual(fake.calls[0], ("discard_typed", None))
def test_stops_on_an_empty_answer_or_the_inputs_end(self):
for typed, why, said in ((" ", "nothing was typed", ""), (EOFError(), "the input ended", "\n")):
@@ -987,11 +988,11 @@ class TypedAnswers(unittest.TestCase):
def test_splits_the_prompt_handing_over_the_answer_into_the_answer_on_the_line_after_its_marker_and_the_rest_and_no_other_prompt(self):
route = Route(Rung("worker-model"))
marked = "The human answered your question at loop-claude's terminal:\nB"
rest, answer = prompts.typed_answer(prompts.typed("Which one?", "Use B.", route, None, False))
self.assertEqual(answer, "Use B.")
self.assertTrue(rest.startswith("Your question was: Which one?\n\nContinue the task."))
self.assertEqual(prompts.typed_answer(prompts.typed(f"Which one?\n{marked}", "Use B.", route, None, False))[1], "Use B.")
self.assertEqual(prompts.typed_answer(prompts.typed("Which one?", "Use B.", Route(Routing.SONNET, 179, 2, 5), Routing.OPUS, True))[1], "Use B.")
typed = prompts.typed_answer(prompts.typed("Which one?", "Use B.", route, None, False))
self.assertEqual(typed.answer, "Use B.")
self.assertTrue(typed.loop_words.startswith("Your question was: Which one?\n\nContinue the task."))
self.assertEqual(prompts.typed_answer(prompts.typed(f"Which one?\n{marked}", "Use B.", route, None, False)).answer, "Use B.")
self.assertEqual(prompts.typed_answer(prompts.typed("Which one?", "Use B.", Route(Routing.SONNET, 179, 2, 5), Routing.OPUS, True)).answer, "Use B.")
self.assertIsNone(prompts.typed_answer(prompts.answered("Which one?", marked, route, None, False)))
self.assertIsNone(prompts.typed_answer(prompts.resumed(marked, route, None)))
+1 -1
View File
@@ -233,7 +233,7 @@ Raised by PR #302's paired ruling, where two of four seats read the project as w
### 182. Give the answer line of loop-claude's interrupts line editing, so an arrow key moves the cursor instead of typing an escape code into the human's answer.
`bin/loop_claude/cycle/interrupt.py`'s `put_question` reads the answer with `input()`, and nothing under `bin/` imports `readline`, so Left types `^[[D` into the answer the worker gets. Importing `readline` gives line editing, but it writes the prompt to stdout rather than stderr, and its bracketed paste can return several lines, which `prompts.typed_answer` reads only the first of. Raised by the product-owner review of PR #308.
`bin/loop_claude/cycle/interrupt.py`'s `put_question` reads the answer with `input()`, and nothing under `bin/` imports `readline`, so Left types `^[[D` into the answer the worker gets. Importing `readline` gives line editing, but it writes the prompt to stdout rather than stderr, and its bracketed paste can return several lines, while `prompts.typed_answer` ends the answer at its first blank line and shows the judge what follows as loop-claude's words. Raised by the product-owner review of PR #308.
### 171. Group the routing figures' review rounds by the reviewers' rung as well as the worker's, so a call blames a rung only for rounds its own reviews raised.