review classifier: commit shas and index lines stay out of the prompt
Every classification's shared context began with the PR's head sha, headed each commit with its sha, and carried each file's `index <hash>..<hash>` line in the diff. A push or rebase rewrites all of those, so the provider's prompt cache missed from the first line of the user message even when the commit messages and hunks were unchanged (#5245: "cache hits show as 0.1x"). The header now names only repo#pr, each commit is headed by its position, and the diff drops `index` lines before lockfiles collapse. The `diff --git` paths and every hunk stay. The TryOut's head_sha is untouched: the controller still posts the review against it, and the journal line still logs it. On the ACP runtime the cost sink also adds each classification's tokens to `hyperhive.review_classifier.token.usage`, typed input / output / cacheRead / cacheCreation like claude's own `claude_code.token.usage`, so the hit rate is a number in the metrics store on both runtimes.
This commit is contained in:
parent
57d6d67556
commit
74b63dd031
4 changed files with 190 additions and 35 deletions
|
|
@ -268,6 +268,14 @@ Only the last part differs per classification: that classification's
|
|||
description and the task to classify the PR against it. The identical prefix
|
||||
lets the runtime's prompt cache reuse it across questions.
|
||||
|
||||
No object hash is in that prefix: the header names the repo and the PR number,
|
||||
not the head commit, each commit's heading gives its position instead of its
|
||||
sha, and the diff loses each file's `index <hash>..<hash>` line, keeping its
|
||||
`diff --git` paths and every hunk. A rebase rewrites all of those hashes, so
|
||||
with them in, a rebased PR with the same messages and hunks would miss the
|
||||
cache from the first line. The head commit still goes to the controller,
|
||||
which posts the review against it.
|
||||
|
||||
### One question, one answer
|
||||
|
||||
The model answers each classification in JSON. The answer holds:
|
||||
|
|
@ -520,6 +528,13 @@ deadline, or whose agent reports no token counts, adds nothing. opencode
|
|||
reports no cost of its own for a provider without prices in its config, which
|
||||
is why the prices are a setting.
|
||||
|
||||
Each such classification also adds the tokens it used to the counter
|
||||
`hyperhive.review_classifier.token.usage`, with the same labels bar `currency`
|
||||
and a `type` of `input`, `output`, `cacheRead` or `cacheCreation`. Those are
|
||||
the types of `claude_code.token.usage`, which `claude` exports on the claude
|
||||
runtimes, so the cache hit rate reads the same way on every runtime: `cacheRead`
|
||||
over the sum of `input`, `cacheRead` and `cacheCreation`.
|
||||
|
||||
The classifier logs each run's result to its journal, which ships to
|
||||
VictoriaLogs like every swarm service container's
|
||||
([`services.md`](services.md#logs-victorialogs)).
|
||||
|
|
|
|||
Loading…
Reference in a new issue