ci: address review feedback — per-model timeout + simpler cost math

- Per-model timeout of 60s so one hung model does not block siblings
- Simplify cost_cents math (cost_usd * 100 directly, no double-rounding)

Defer: fine-grained PAT for CTO_ADMIN_TOKEN (requires manual OAuth device flow).

Agent-Session: cowork-reviewer-ab-20260414
This commit is contained in:
peptiderepo
2026-04-14 17:31:54 +07:00
parent 616552b3bc
commit 1dc1eb5e07

View File

@@ -252,6 +252,8 @@ jobs:
}
}]
PER_MODEL_TIMEOUT = 60 # seconds; one hung model should not block siblings
def call_model(slug, display, in_rate, out_rate, is_primary):
body = {
"model": slug,
@@ -275,7 +277,7 @@ jobs:
method="POST"
)
try:
with urllib.request.urlopen(req, timeout=120) as resp:
with urllib.request.urlopen(req, timeout=PER_MODEL_TIMEOUT) as resp:
data = json.loads(resp.read())
except Exception as e:
return {
@@ -307,7 +309,7 @@ jobs:
ptok = usage.get("prompt_tokens", 0)
ctok = usage.get("completion_tokens", 0)
cost_usd = (ptok * in_rate / 1_000_000) + (ctok * out_rate / 1_000_000)
cost_cents = int(round(cost_usd * 100 * 100)) / 100 # two-decimal cents
cost_cents = cost_usd * 100
return {
"slug": slug, "display": display, "is_primary": is_primary,
"review": review, "prompt_tokens": ptok, "completion_tokens": ctok,