Answer principles round 2: 0 🔴, 1 🟡 (0 misread); count the launched subagents the archive has no transcript of

This commit is contained in:
2026-10-28 11:27:58 +01:00
parent 0c1e92943a
commit 7c5af45aaf
2 changed files with 14 additions and 3 deletions
+6 -3
View File
@@ -54,7 +54,7 @@ class Reports:
@dataclasses.dataclass(frozen=True)
class ChunkFigures:
"""dollars maps each of DIMENSIONS to its labels' dollars; start is the rung a routed chunk started on, None where no item routed it; escalated counts the worker's escalations by trigger; unattributed is the recorded cost that no message of the chunk takes."""
"""dollars maps each of DIMENSIONS to its labels' dollars; start is the rung a routed chunk started on, None where no item routed it; escalated counts the worker's escalations by trigger; unattributed is the recorded cost that no message of the chunk takes; lacking counts the subagents the worker launched that the archive holds no transcript of."""
dollars: dict[str, collections.Counter[str]]
start: Rung | None
rounds_past_first: int
@@ -63,6 +63,7 @@ class ChunkFigures:
reports: dict[str, Reports]
escalated: collections.Counter[int]
unattributed: float
lacking: int = 0
@dataclasses.dataclass(frozen=True)
@@ -75,6 +76,7 @@ class Figures:
escalated: collections.Counter[int]
skipped: tuple[str, ...] = ()
unattributed: float = 0.0
lacking: int = 0
@dataclasses.dataclass(frozen=True)
@@ -118,6 +120,7 @@ def measured(chunk: Chunk, home: str) -> ChunkFigures:
reports=reports,
escalated=escalations(launches),
unattributed=unattributed,
lacking=len(launches.keys() - {subagent.launched_by for subagent in chunk.subagents}),
)
@@ -239,7 +242,7 @@ def totals(chunks: list[ChunkFigures], skipped: tuple[str, ...] = ()) -> 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), dollars, routed, reports, summed(chunks, lambda chunk: chunk.escalated), skipped, sum(chunk.unattributed for chunk in chunks))
return Figures(len(chunks), dollars, routed, reports, summed(chunks, lambda chunk: chunk.escalated), skipped, sum(chunk.unattributed for chunk in chunks), sum(chunk.lacking for chunk in chunks))
def calls(figures: Figures) -> list[str]:
@@ -263,7 +266,7 @@ def render(figures: Figures, found: list[str], at: str, cycle: int, since: str)
"""The figures as markdown; MEASURED_AT reads the cycle back. since is the latest reset's stamp, empty for none."""
sections = [
"# Routing figures",
f"Measured {at}, at cycle {cycle} across loop-claude's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. Dollars are what each worker transcript's last `cost-state` entry records for each model, cache reads included, split across the messages in the archive in proportion to their cost at list prices, so a subagent transcript the archive lacks puts its cost on the messages it holds; a chunk without the entry keeps the list prices. A message's dollars count towards the tools whose results it took in, split evenly; a message that took in no tool result counts towards `prompt`. The judge's runs are not archived, so their cost is not counted.{f' {money(figures.unattributed)} of the recorded cost is left out, since it belongs to a model with no list price or with no message in the archive.' if figures.unattributed else ''}",
f"Measured {at}, at cycle {cycle} across loop-claude's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. Dollars are what each worker transcript's last `cost-state` entry records for each model, cache reads included, split across the messages in the archive in proportion to their cost at list prices, so a subagent transcript the archive lacks puts its cost on the messages it holds; a chunk without the entry keeps the list prices. A message's dollars count towards the tools whose results it took in, split evenly; a message that took in no tool result counts towards `prompt`. The judge's runs are not archived, so their cost is not counted.{f' {money(figures.unattributed)} of the recorded cost is left out, since it belongs to a model with no list price or with no message in the archive.' if figures.unattributed else ''}{f' {figures.lacking} launched subagent{"" if figures.lacking == 1 else "s"} {"has" if figures.lacking == 1 else "have"} no transcript in the archive.' if figures.lacking else ''}",
"## Calls for a routing change",
"".join(f"- {call}\n" for call in found).rstrip("\n") or "None.",
*[part for dimension in DIMENSIONS for part in (f"## Dollars by {dimension}", table((dimension.capitalize(), "Dollars"), [(label, money(dollars)) for label, dollars in figures.dollars[dimension].most_common()]))],