Answer stability round 1: 1 🔴, 11 🟡 (0 misread); drop keys typed ahead on leaving an answer, wrap every line to the drawn width, list the routing calls, test the paths mutants survived
This commit is contained in:
@@ -15,7 +15,7 @@ from claude_code.trust import trust
|
||||
from loop_claude.project.checkout import worktrees
|
||||
|
||||
ANSWER_QUESTION = "answer the question above"
|
||||
# TALK and ASK_ANSWER were picked on 2026-10-17 by a bench of three readers seated as the README's audience, as ~/.claude/CLAUDE.md → "Working loop" → "Bench a syntax with the people who write it." has it.
|
||||
# ASK_ANSWER was picked on 2026-10-17 by a bench of three readers seated as the README's audience, as ~/.claude/CLAUDE.md → "Working loop" → "Bench a syntax with the people who write it." has it.
|
||||
ASK_ANSWER = f"Answer ({TALK} opens claude, Enter stops the loop): "
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class WorkerSession:
|
||||
id: uuid.UUID
|
||||
rung: Rung
|
||||
transcript_path: str
|
||||
# What the worker's claude adds to its environment, as the claude /talk opens does.
|
||||
# Added to the environment of the worker's claude, and of the claude /talk opens.
|
||||
env: dict[str, str]
|
||||
|
||||
def claude_command(self) -> ClaudeCommand:
|
||||
@@ -76,7 +76,7 @@ def first_answer(ask: Ask, paths: Paths, effects: Effects) -> str | Talk | Stop:
|
||||
|
||||
|
||||
def shown(paths: Paths, ask: Ask, effects: Effects) -> None:
|
||||
"""Shows ask in loop-inbox. A failure only warns: the question is still answered on the terminal."""
|
||||
"""Shows ask in loop-inbox. A failure only warns. The question is then still answered on the terminal, unless claude was to open in loop-inbox: loop-inbox then gives up, and the loop stops."""
|
||||
if unshown := publish(paths.waiting, ask):
|
||||
say(f"loop-inbox cannot show this question: {unshown.reason}", effects)
|
||||
|
||||
@@ -88,7 +88,7 @@ def withdrawn(paths: Paths, ask: Ask, effects: Effects) -> None:
|
||||
|
||||
|
||||
def talk(chosen: Talk, session: WorkerSession, paths: Paths, effects: Effects) -> Stop | None:
|
||||
"""Holds the loop while the human answers in the worker's claude session, listed in loop-inbox as open where it is; the human must type something there."""
|
||||
"""Holds the loop while the human answers in the worker's claude session, which loop-inbox lists as open on loop-claude's terminal or in loop-inbox. A Stop where they type nothing there."""
|
||||
try:
|
||||
return human_typed(session.transcript_path, lambda: opened(chosen, session, paths, effects))
|
||||
finally:
|
||||
@@ -97,7 +97,7 @@ def talk(chosen: Talk, session: WorkerSession, paths: Paths, effects: Effects) -
|
||||
|
||||
def opened(chosen: Talk, session: WorkerSession, paths: Paths, effects: Effects) -> Stop | None:
|
||||
"""Returns once the claude the human answers in has ended: the one it opens on the terminal, or the one loop-inbox opened."""
|
||||
# For loop-inbox, this shows that the loop has stopped reading its terminal, so it may open claude.
|
||||
# Tells loop-inbox where claude is open; for OpenInInbox, it is the go-ahead claim_talk waits for.
|
||||
shown(paths, dataclasses.replace(chosen.ask, state=chosen.where), effects)
|
||||
match chosen.where:
|
||||
case OpenOnTerminal():
|
||||
@@ -127,7 +127,7 @@ def human_typed(transcript_path: str, held_open: typing.Callable[[], Stop | None
|
||||
|
||||
|
||||
def hand_over(command: ClaudeCommand, paths: Paths, effects: Effects) -> Failure | None:
|
||||
"""Marks the checkout command runs in, and each of its worktrees, trusted, then runs claude on the terminal as command says; the failure is why claude could not start."""
|
||||
"""Marks trusted the checkout that command runs in, and each of its worktrees, then runs claude on the terminal as command says; the failure is why claude could not start."""
|
||||
trust(paths.claude_json, worktrees(command.cwd, effects), lambda text: say(text, effects))
|
||||
try:
|
||||
effects.claude_on_terminal(command.args, command.cwd, command.env)
|
||||
|
||||
Reference in New Issue
Block a user