Summary: correct the guard line; pipeline summary reads the limit from .env

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:05:49 +02:00
parent 5bcd1bf9cd
commit 224ba1a5f8
3 changed files with 6 additions and 4 deletions

View File

@@ -277,13 +277,15 @@ class Pipeline:
return "; ".join(f"{k} {v[1]}/{v[0]} (repair {v[2]})" for k, v in sorted(agg.items()))
s = spent()
used = (s - BASE_LEDGER) / LEDGER_TO_USAGE
guard = float(os.environ.get("BUDGET_LIMIT_USD", "0")) - float(os.environ.get("BUDGET_RESERVE_USD", "0"))
from .ledger import _env_budget
lim, res = _env_budget()
guard = lim - res
text = f"""### Stage 2 summary at {n} accepted trajectories ({time.strftime('%Y-%m-%d %H:%M')})
- Tasks: {acc_t} accepted of {len(logs)} generated (K variants {sum(1 for l in logs if l.get('category') == 'K')}); \
trajectory runs {len(rows)}, accepted trajectories {len(accepted)} (acceptance {len(accepted) / max(len(rows), 1):.0%}).
- Budget: used {used:.1f} usage (ledger {s - BASE_LEDGER:.1f}) since 2026-10-05; left to the guard {(guard - s) / LEDGER_TO_USAGE:.1f} usage \
(ledger {guard - s:.1f}; reserve {os.environ.get('BUDGET_RESERVE_USD', '0')} ledger kept); allowance until 11 October {ALLOWANCE_USAGE - used:.1f} usage.
(ledger {guard - s:.1f}; reserve {res:g} ledger kept); allowance until 11 October {ALLOWANCE_USAGE - used:.1f} usage.
- Repair share (accepted trajectories with an error followed by a fix): {repairs}/{len(accepted)} = {repairs / max(len(accepted), 1):.0%}.
- By category, accepted/runs: {table('category')}.
- By object type, accepted/runs: {table('object_type')}.