Repository navigation
Description
What happened
aforge do ends with one footer — the settle line — and it prints three numbers:
45m0s · 3 nodes · $1.5182
None of them says how much of that money bought nothing. In the three-run worker
trial, $0.2951 of $4.5956 — 6.4% — went to hedge arms that lost their race and
were cancelled mid-stream, and 881 seconds of the 135-minute wall (about 11%)
went to model answers that were produced, billed for, and thrown away. The settle
line has no field for any of it, and neither does --json.
The claim as filed was ~12% of spend to 429 retries and hedge waste. Verified
figure: 6.4% of spend, all of it hedge waste; 429s cost nothing in money. The
~12% is real but it is a WALL figure, not a spend figure. Both halves are below.
Verified — the money
Losing hedge arms, from ~/.aforge/logs/calls.jsonl over each run's window:
| run store | billed | hedge races | losing-arm waste | share |
|---|---|---|---|---|
aforge-do-1923110067 |
$1.9783 | 3 | $0.0964 | 4.9% |
aforge-do-1792941490 |
$1.5182 | 9 | $0.1442 | 9.5% |
aforge-do-4060048231 |
$1.0992 | 4 | $0.0545 | 5.0% |
| total | $4.5956 | 16 | $0.2951 | 6.4% |
The log writes this itself: waste_usd on a call row is
hedgeRace.spend() (internal/provider/hedge.go:1001-1010) — the estimated cost
of every arm of the race OTHER than this one — plumbed onto the record at
internal/provider/calllog.go:243-245 and marked hedged: true with arms: N.
The losing arm is the row carrying "action": "hedge" and
"error": "decode stream: context canceled". A worked example, run 2:
{"ts":"2026-09-03T05:53:27.834-04:00","tag":"gate","node":"task-2-x1",
"model":"moonshotai/kimi-k3","attempt":1,"status":200,"ms":58195,
"lane":"DigitalOcean","hedged":true,"action":"report","arms":2,
"waste_usd":0.021736949999999998,"error":"decode stream: context canceled"}Verified — the 429s
17 requests across the trial came back 429 (8 in run 1, 9 in run 2, 0 in run 3),
all of them "deepseek-v4-pro is temporarily rate-limited upstream" or the same
for kimi-k3. Their summed cost is $0.0000 — a rejected request bills nothing —
so they are not spend waste. What they cost is retries and wall: run 2's fanout
call went out six times over 30 seconds before giving up
(attempt: 1..6, every one 429), and run 1's leaf hit three separate 429 storms
that each burned 3-4 attempts.
Separately, and worse: 16 calls returned status: 200 and had their answer
discarded — cancelled hedge arms plus decode stream: context deadline exceeded
plus two replies that were the model's own internal markup and were cut. Those
consumed 881 seconds of stream time (162s / 216s / 503s per run). Their cost
field is absent, so they are not in spend either — which is #161's territory,
and the reason the true waste figure is a floor rather than a measurement.
Verified — what the settle line prints, and that it has no field for waste
Composer: reportErrand, cmd/aforge/do.go:2449-2451:
fmt.Fprintf(request.stdout, "%s · %s · $%.4f\n",
time.Duration(outcome.Seconds*float64(time.Second)).Round(time.Second),
plural(outcome.Nodes, "node"), outcome.Spend)Three fields, and the money one is outcome.Spend.
The struct behind it, headlessOutcome at cmd/aforge/do.go:107-180, splits money
exactly two ways — Spend, SpendWork, SpendOverhead (:124-126) — and its own
comment names the two questions it thinks a reader has: "A caller comparing
workers on a corpus wants Work; a caller paying the bill wants Spend." There is no
third field, and no term anywhere in the object for money that bought nothing. The
--json object (same struct) therefore hides it too.
The information exists, is measured, and is written down one layer below — it just
never reaches the person. internal/session/usage_ledger.go:239-246 already
carries Hedged bool and HedgeWasteUSD float64 on a usage line.
Replication
# the settle line, and its composer
aforge do 'say hello'; sed -n '2449,2451p' cmd/aforge/do.go
# the money: losing-arm waste over a run's window, deduplicated per race
python3 - <<'PY'
import json, collections
from datetime import datetime as D
lo, hi = D.fromisoformat("2026-09-03T05:11:50-04:00"), D.fromisoformat("2026-09-03T05:56:51-04:00")
rows = []
for l in open('/home/santosh/.aforge/logs/calls.jsonl'):
try: o = json.loads(l)
except: continue
try: t = D.fromisoformat(o['ts'])
except: continue
if lo <= t <= hi and o.get('phase') != 'start': rows.append(o)
billed = sum(r.get('cost', 0) for r in rows)
races = collections.defaultdict(list)
for r in rows:
if r.get('hedged'): races[(r['ts'], r.get('tag'), r.get('node'))].append(r)
waste = sum(max(a.get('waste_usd', 0) for a in arms) for arms in races.values())
n429 = [r for r in rows if r.get('status') == 429]
disc = [r for r in rows if r.get('status') == 200 and r.get('error')]
print(f"billed ${billed:.4f} races {len(races)} hedge waste ${waste:.4f} ({100*waste/billed:.1f}%)")
print(f"429s {len(n429)} costing ${sum(r.get('cost',0) for r in n429):.4f}")
print(f"discarded 200-answers {len(disc)}, {sum(r.get('ms',0) for r in disc)/1000:.0f}s of wall")
PYThe window bounds come from the run store —
sqlite3 graph.db "select min(ts), max(ts) from events", converted to local time.
The three windows contain exactly 104 / 105 / 82 start rows, which is the call
count the trial report independently states, so the filter is clean of the other
sessions sharing this log.
Shape of a fix
A run knows what it wasted and does not say so. Give the outcome a third money
field beside SpendWork / SpendOverhead — money that bought no answer: losing
hedge arms plus discarded streams — carry it into --json, and let the settle line
name it when it is not zero (the emptiness law says a zero waste renders as
nothing at all). The figure exists at internal/provider/calllog.go:244-245 and
internal/session/usage_ledger.go:246; what is missing is the plumbing up to
headlessOutcome and one clause in the footer. docs/HEADLESS.md and
internal/manual/chat/adaptive-runs.md both state what the footer prints and
change in the same commit.
Related: #161 (a cut stream is provider money the ledger never sees), #346 (the
hedge verdict written with its reason), #215 (a stream that trickles is only cut at
the wall).
From the aforge do worker trial (three 45-minute runs against #510 on dev
b95f8c29f): report at bench/worker-trial/REPORT.md on branch
trial/aforge-as-worker (local branch, not yet pushed to origin). Related: #510.
Queued for after the WIP freeze; do not start without the coordinator.
Drafted with CodeAF · reviewed and owned by the author
Activity
santoshkumarradha commentedon Sep 10, 2026
Consolidated into #815 — a run's ending is a receipt: the verdict, the waste, the words and the marks. This issue's evidence, replication and acceptance are reproduced there in full under its own heading, alongside the four others that share the reporting seam in
cmd/aforge/do.go; the lane that takes #815 takes this. Nothing is lost — this issue stays readable and #815 links back to it.Closed as part of the 2026-09-10 triage sweep, which folded five separately-filed complaints about what a headless run hands back into one piece of work. Verified at dev@95a0d0a9b that this one is still live.