Answer architecture round 2: 2 🔴, 3 🟡; route from the ladder by rung, keep a stepped-up rung across reruns and reloads, test the judge's bundled range, and file item 136 for routing on the item taken
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import dataclasses
|
||||
import pathlib
|
||||
|
||||
from transcript_archive.location import chunk_folder
|
||||
from failure import Failure
|
||||
from transcript_archive.outcomes import FINISHED_AT
|
||||
from transcript_archive.outcomes import FINISHED_AT, workers
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -33,3 +34,14 @@ def read_threads(chunk: FinishedChunk) -> list[bytes] | Failure:
|
||||
return [path.read_bytes() for path in (chunk.transcript, *chunk.subagents)]
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read {failure.filename}: {failure.strerror}")
|
||||
|
||||
|
||||
def latest_worker(project_archive: pathlib.Path, transcript: str) -> str | Failure | None:
|
||||
"""The worker the latest verdict archived for the transcript's chunk names; None before its first verdict."""
|
||||
try:
|
||||
with open(transcript, "rb") as handle:
|
||||
folder = chunk_folder(project_archive, handle.read())
|
||||
found = sorted(stamped for outcomes in folder.glob("*.outcomes.md") for stamped in workers(outcomes.read_text(encoding="utf-8")))
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read the archive {project_archive}: {failure}")
|
||||
return found[-1][1] if found else None
|
||||
|
||||
Reference in New Issue
Block a user