Operator limits: exact model cost of Diff Reviews
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python, typescript
- Ambito
- backend
Direzione di ricerca
Start in runner/.../pr_agent_runtime.py, where costUsd is currently summed from PR-Agent's own price table, and read the Dynamic Review accounting proxy from #267 that this must match. The first step is the design spike: choose one of the three listed mechanisms and record it in runner/README.md. Done means the cost is the exact sum of provider-reported costs, null when any call is unpriced, and tests T01 to T08 pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Part of #268. Depends on #272 and #267.
Problem
#267 makes the cost of a Dynamic Review exact, because its model calls pass through the runner's accounting proxy and OpenRouter states the charge of every request. A Diff Review does not: PR-Agent calls the model itself through LiteLLM, and the costUsd it reports (runner/.../pr_agent_runtime.py) is a sum over the calls PR-Agent could price with its own price table, which can be missing, stale or different from the charge OpenRouter actually made. For a workspace that runs on the operator's key, Diff Review spend must be measured with the same exactness as Dynamic Review, or the usage records of #272 would be exact for one kind and approximate for the other.
Behavior
- Decision first (spike inside this issue). Pick one mechanism, record it in the issue and
runner/README.md, then implement it. Candidates, in order of preference:- Route PR-Agent's OpenRouter calls through the same loopback accounting proxy the Dynamic Review uses (per-job capability, fixed destination, no agent-supplied routing), reading
usage.costof every answer, with #267's rules. - Read the cost from LiteLLM's response object where OpenRouter's
usage.costis passed through, if it is the provider's value and not a table lookup. - Ask OpenRouter for the generation record of each request id after the run (
GET /api/v1/generation?id=…), if the ids are available and the lookup is cheap.
- Route PR-Agent's OpenRouter calls through the same loopback accounting proxy the Dynamic Review uses (per-job capability, fixed destination, no agent-supplied routing), reading
- Whatever is chosen: the result's
usage.costUsdis the exact sum of the provider-reported costs of all calls, all or nothing as in #267 (any unpriced call makes itnull), never derived from a price table. - It applies to every Diff job, not only managed ones (a consistent shape; own-key jobs just do not use it for limits).
- The request path still goes to OpenRouter's fixed address with the same credential as today;
provider.require_parameters(#270) is unaffected. - If the chosen mechanism cannot be made exact for fallback-model retries and chunked reviews, the issue says exactly what is exact and what is
null, and the tests pin it.
Scope
Runner Diff path, fakes (fake LLM already returns usage; extend it with cost), tests, runner/README.md, contract text for usage.costUsd.
Out of scope
The Dynamic path (#267), how cost is used, changing the review quality or prompts.
Test cases
| ID | kind | level | case | expected |
|---|---|---|---|---|
| T01 | behavior | unit (runner) | a Diff run with three model calls that each report a cost | usage.costUsd is their exact decimal sum |
| T02 | behavior | unit (runner) | one call has no cost | costUsd is null, tokens still reported |
| T03 | behavior | unit (runner) | fallback model is used after the first failed | both attempts' costs are included, or the rule the spike set is applied and pinned |
| T04 | behavior | unit (runner) | chunked review with several calls | all calls counted |
| T05 | regression | integration (runner) | Diff run against the fake LLM | result unchanged except for the exact cost |
| T06 | security | unit | the model destination and key are not controllable from the pull request or the model | as before |
| T07 | contract | unit | result validation in the runner and the app | accepts the cost unchanged |
| T08 | regression | unit | no price table or per-token rate used for the reported cost | pinned by a test |
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 1
- Merge medio
- 1h 15m
- PR unite (30g)
- 217
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ExpidetGames/code-reviewer
-
area: app type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ExpidetGames/code-reviewer#308 ·
I maintainer di solito rispondono entro 1 giorno
-
type: docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ExpidetGames/code-reviewer#94 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
ExpidetGames/code-reviewer#401 ·
I maintainer di solito rispondono entro 1 giorno
-
area: app type: chore
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
ExpidetGames/code-reviewer#393 ·
I maintainer di solito rispondono entro 1 giorno
-
area: runner type: bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
ExpidetGames/code-reviewer#390 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ExpidetGames/code-reviewer
Issue simili
-
`cf complete zsh >> .zshrc` fails on vanilla zshForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
cloudflare/cf#340 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Rename Madson cameraAperta
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 75/100
StoDevX/AAO-React-Native#8785 ·
I maintainer di solito rispondono entro 1 giorno
-
Broken links in the docsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commitForse già presa @myOmikron l’ha presa oggi. Apertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100