Answer stability round 1: 1 🔴, 4 🟡 (1 misread); keep a shell whose command holds a heavy slot, and say a failed record write on stderr

This commit is contained in:
2026-11-18 20:12:40 +01:00
parent abae3a0559
commit a7439c2e00
6 changed files with 108 additions and 66 deletions
+5 -5
View File
@@ -25,16 +25,16 @@ def run_worker(root: str, args: list[str], env: dict[str, str], project_archive:
except OSError as failure:
return Failure(f"could not start claude: {failure.strerror}")
result: dict | None = None
# When the worker printed its latest result; None while its latest line is something else, since a worker that prints on is working.
settled_at: float | None = None
# Whether the worker's latest line is its result; a worker that prints on is working.
printed_result = False
resets: list[int] = []
for raw in proc.lines(CHECK_EVERY):
if raw is None:
stopped_shells(proc, settled_at, project_archive / RECORD, effects)
stopped_shells(proc, printed_result, project_archive / RECORD, effects)
continue
event = json_object(raw) or {}
settled_at = effects.now() if ends_stream(event) else None
if ends_stream(event):
printed_result = ends_stream(event)
if printed_result:
result = event
if (resets_at := rejected_until(event)) is not None:
resets.append(resets_at)