feat: add review effort accounting and budget governor
This commit is contained in:
@@ -249,6 +249,11 @@ def build_batch(
|
||||
tags.append(f"tier:{tier}")
|
||||
for lens in lenses or []:
|
||||
tags.append(f"lens:{lens}")
|
||||
if usage.get("budget_cap_hit"):
|
||||
tags.extend([
|
||||
"budget:capped",
|
||||
f"budget:{usage.get('budget_cap_reason', 'unknown')}",
|
||||
])
|
||||
|
||||
costs, cost_basis = _cost_details(usage, model, price_target) if usage else ({}, "")
|
||||
if cost_basis:
|
||||
@@ -267,7 +272,19 @@ def build_batch(
|
||||
"severities": _severity_counts(findings),
|
||||
"provider_cost_usd": usage.get("cost"),
|
||||
"cost_basis": cost_basis or None,
|
||||
"iterations": usage.get("steps"),
|
||||
"tool_calls": usage.get("tool_calls"),
|
||||
"cap_hit": usage.get("budget_cap_hit"),
|
||||
"cap_reason": usage.get("budget_cap_reason"),
|
||||
"tokens_per_finding": round(
|
||||
float(usage.get("total") or 0) / max(1, len(findings or [])), 2
|
||||
),
|
||||
"steps_per_finding": round(
|
||||
float(usage.get("steps") or 0) / max(1, len(findings or [])), 2
|
||||
),
|
||||
}
|
||||
if usage.get("iterations"):
|
||||
metadata["iteration_usage"] = usage["iterations"][:50]
|
||||
if lenses:
|
||||
metadata["lenses"] = lenses
|
||||
if tier:
|
||||
|
||||
Reference in New Issue
Block a user