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:
6
.github/workflows/cto-review.yml
vendored
6
.github/workflows/cto-review.yml
vendored
@@ -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):
|
def call_model(slug, display, in_rate, out_rate, is_primary):
|
||||||
body = {
|
body = {
|
||||||
"model": slug,
|
"model": slug,
|
||||||
@@ -275,7 +277,7 @@ jobs:
|
|||||||
method="POST"
|
method="POST"
|
||||||
)
|
)
|
||||||
try:
|
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())
|
data = json.loads(resp.read())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {
|
return {
|
||||||
@@ -307,7 +309,7 @@ jobs:
|
|||||||
ptok = usage.get("prompt_tokens", 0)
|
ptok = usage.get("prompt_tokens", 0)
|
||||||
ctok = usage.get("completion_tokens", 0)
|
ctok = usage.get("completion_tokens", 0)
|
||||||
cost_usd = (ptok * in_rate / 1_000_000) + (ctok * out_rate / 1_000_000)
|
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 {
|
return {
|
||||||
"slug": slug, "display": display, "is_primary": is_primary,
|
"slug": slug, "display": display, "is_primary": is_primary,
|
||||||
"review": review, "prompt_tokens": ptok, "completion_tokens": ctok,
|
"review": review, "prompt_tokens": ptok, "completion_tokens": ctok,
|
||||||
|
|||||||
Reference in New Issue
Block a user