Decode the worker's stream leniently, name UserEntryKind's members only, and restore the section-headers decision's citation

This commit is contained in:
2026-09-28 16:28:43 +02:00
parent 72d04227f9
commit 9659f70efd
6 changed files with 24 additions and 20 deletions
+9 -8
View File
@@ -67,7 +67,7 @@ def run_cycle(root, task, premises, chosen, paths, env):
return stop
if verdict["finished"]:
archive(root, path, f"Task: {task}\n\nVerdict: finished", paths)
delete_session(path)
delete_session(session)
return Continue()
@@ -254,14 +254,15 @@ def interrupt(root, session_id, chosen, path, question, paths, env):
if not (sys.stdin.isatty() and sys.stdout.isatty()):
return Stop(2, "stdin or stdout is not a terminal")
trust(paths.claude_json, checkouts(root))
before = read(path)
if isinstance(before, Failure):
return Stop(1, before.reason)
entries = read(path)
if isinstance(entries, Failure):
return Stop(1, entries.reason)
before = human_turns(entries)
subprocess.run(["claude", "--model", model_for(env, "LOOP_CLAUDE_WORKER_MODEL", chosen), "--permission-mode", "bypassPermissions", "--resume", str(session_id)], cwd=root)
after = read(path)
if isinstance(after, Failure):
return Stop(1, f"could not tell whether you typed anything: {after.reason}")
if human_turns(after) <= human_turns(before):
entries = read(path)
if isinstance(entries, Failure):
return Stop(1, f"could not tell whether you typed anything: {entries.reason}")
if human_turns(entries) <= before:
return Stop(2, "the interrupt ended without the human typing anything")
return None