Answer stability round 1: 1 🔴, 8 🟡; read each cycle's route from its own outcomes file, skip and name an unreadable chunk, and test the rungs, names, token edge cases, call boundaries, render order and stamps

This commit is contained in:
2026-10-15 01:00:40 +02:00
parent ad3f1d3cad
commit a389a670a2
7 changed files with 119 additions and 27 deletions
+9 -6
View File
@@ -32,9 +32,9 @@ class Subagent:
@dataclasses.dataclass(frozen=True)
class Chunk:
"""outcomes joins every outcomes file archived for the chunk; worker is its finished transcript's entries."""
"""outcomes holds each outcomes file archived for the chunk, one per transcript copy, each opening with its task; worker is its finished transcript's entries."""
project: str
outcomes: str
outcomes: list[str]
worker: list[dict]
subagents: list[Subagent]
@@ -63,14 +63,16 @@ class ChunkFigures:
@dataclasses.dataclass(frozen=True)
class Figures:
"""skipped names each chunk folder the archive could not read whole."""
chunks: int
tokens: dict[str, collections.Counter[str]]
routed: dict[Rung, list[ChunkFigures]]
reports: dict[str, Reports]
skipped: tuple[str, ...] = ()
def measured(chunk: Chunk, home: str) -> ChunkFigures:
cycles = sorted(workers(chunk.outcomes), key=lambda cycle: cycle[0])
cycles = sorted((cycle for kept in chunk.outcomes for cycle in workers(kept)), key=lambda cycle: cycle[0])
tokens: dict[str, collections.Counter[str]] = {dimension: collections.Counter() for dimension in DIMENSIONS}
for at, tools, spent in spend(chunk.worker):
add(tokens, chunk.project, "worker", str(rung_at(cycles, at)), tools, spent)
@@ -87,7 +89,7 @@ def measured(chunk: Chunk, home: str) -> ChunkFigures:
for _, tools, spent in spend(subagent.entries):
add(tokens, chunk.project, kind, rung, tools, spent)
start = route_from(cycles[0][1]) if cycles else None
return ChunkFigures(tokens, start.rung if start and start.item else None, rounds_past_first(chunk.worker, home), len(UNFINISHED_AT.findall(chunk.outcomes)), delegated, reports)
return ChunkFigures(tokens, start.rung if start and start.item else None, rounds_past_first(chunk.worker, home), sum(len(UNFINISHED_AT.findall(kept)) for kept in chunk.outcomes), delegated, reports)
def agent_calls(worker: list[dict]) -> dict[str, tuple[str, dict]]:
@@ -179,7 +181,7 @@ def due(cycle: int, last_measured: int) -> bool:
return cycle >= last_measured + CYCLES_PER_CHECK
def totals(chunks: list[ChunkFigures]) -> Figures:
def totals(chunks: list[ChunkFigures], skipped: tuple[str, ...] = ()) -> Figures:
tokens = {dimension: sum((chunk.tokens.get(dimension, collections.Counter()) for chunk in chunks), collections.Counter()) for dimension in DIMENSIONS}
routed: dict[Rung, list[ChunkFigures]] = {}
reports: dict[str, Reports] = {}
@@ -188,7 +190,7 @@ def totals(chunks: list[ChunkFigures]) -> Figures:
routed.setdefault(chunk.start, []).append(chunk)
for kind, found in chunk.reports.items():
reports[kind] = reports.get(kind, Reports(0, 0, 0)) + found
return Figures(len(chunks), tokens, routed, reports)
return Figures(len(chunks), tokens, routed, reports, skipped)
def calls(figures: Figures) -> list[str]:
@@ -223,6 +225,7 @@ def render(figures: Figures, found: list[str], at: str, cycle: int, since: str)
]),
"## Subagent reports against the searches they ran, in characters",
table(("Subagent type", "Subagents", "Reports", "Searches"), [(kind, str(found.subagents), str(found.report), str(found.searches)) for kind, found in sorted(figures.reports.items())]),
*(["## Chunks skipped, unreadable", "".join(f"- {folder}\n" for folder in figures.skipped).rstrip("\n")] if figures.skipped else []),
]
return "\n\n".join(sections) + "\n"