Operator limits: account the cost of runs that fail after using the model
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with the failure path of the Diff and Dynamic runners and the contract text for a failed result, where usage may already be set; the issue names no file paths, so locate them from there. The app's settle rule for failed results and the no_result reason are in the app layer, and the issue depends on #267, #272 and #274, so read those first. Done means cases T01 to T08 pass, with successful results unchanged.
Written by the indexing model from the issue text.
Description
Part of #268. Depends on #272 and #267.
Problem
A run reports its usage only when it succeeds. A run that fails after it used the model (a timeout at the end, a result the validator refuses, a publish error, a lost lease on the last attempt) still cost real money, but reports no usage. On a workspace that uses the operator's key this is spend nobody sees and nothing limits: a pull request that always fails near the end can be retried indefinitely at the operator's cost. The cost of a failed Dynamic run is the explicit out-of-scope item of #267.
Behavior
- A run that fails after at least one model call reports the usage it has: the model proxy and the Diff run know their counters and (after #267 and #274) their cost at the time of the failure. The runner puts it in the failed result; the contract already has the shape (
usagemay be set on a failed result; this issue makes the runners fill it and the contract text say so). - Cost rules stay those of #267: all or nothing. If any call of the failed run is unpriced, the cost is unknown (
null), the token counters are still reported. - The app settles the record of #272 from a failed result exactly like a successful one: with usage present it is
settled(counts, cost possibly null); without any model call it isvoid. - A job that ends without any result from the runner (the runner died, the lease expired for the last time) stays
settledwith unknown cost, notvoid: the model may have been used, and counting it is the conservative reading. The record says so with a reason code (no_result). - Nothing about display changes: the Runs view keeps hiding usage of failed runs unless it already shows it.
Scope
Runner result building for the failure path (Diff and Dynamic), contract text and example, the app's settle rule for failed results and no_result, docs.
Out of scope
How the cost is used (#277), measuring Diff cost exactly (#274), retries and backoff policy.
Test cases
| ID | kind | level | case | expected |
|---|---|---|---|---|
| T01 | behavior | unit (runner) | a Dynamic run fails after three priced calls | the failed result carries tokens and the summed cost |
| T02 | behavior | unit (runner) | one of the calls is unpriced | tokens reported, cost null |
| T03 | behavior | unit (runner) | a Dynamic run fails before the first model call | no usage, as today |
| T04 | behavior | unit (runner) | a Diff run fails after its model call | the usage PR-Agent measured is reported |
| T05 | behavior | integration (app) | a failed result with usage | record settled with that usage |
| T06 | behavior | integration (app) | a job whose last lease expires with no result | record settled, cost null, reason no_result |
| T07 | contract | unit | the contract example for a failed result with usage | valid in both suites |
| T08 | regression | unit | successful results | unchanged |
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 1h 15m
- Merged PRs (30d)
- 168
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ExpidetGames/code-reviewer
-
area: app type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ExpidetGames/code-reviewer#308 ·
Maintainers usually reply within 1 day
-
type: docs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ExpidetGames/code-reviewer#94 ·
Maintainers usually reply within 1 day
-
Dynamic Review: recover when the engine turn ends without a structured answerPossibly taken @Schacki-Jr claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 18/100
ExpidetGames/code-reviewer#309 ·
Maintainers usually reply within 1 day
-
area: runner type: chore
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ExpidetGames/code-reviewer#307 ·
Maintainers usually reply within 1 day
-
Dynamic Review: an incremental review with an ancestor as previous commit becomes a full reviewOpenarea: runner type: bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ExpidetGames/code-reviewer#306 ·
Maintainers usually reply within 1 day
All issues in ExpidetGames/code-reviewer
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dsh-market/dsh-market#877 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-dev-skill#151 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:arcade game ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fderuiter/deruiter.dev#2281 · 1 comment ·
Maintainers usually reply within 1 day
-
scope: data grid type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days