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
1 changed files with 190 additions and 35 deletions
|
|
@ -175,6 +175,7 @@ impl<S: CostSink> Acp<S> {
|
|||
pr: run.pr,
|
||||
model: provider.model.clone(),
|
||||
amount: crate::cost::amount(&provider.prices, usage),
|
||||
usage: *usage,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -387,6 +388,10 @@ done
|
|||
("o/r", 7, "qwen")
|
||||
);
|
||||
assert!((cost.amount - 0.006).abs() < 1e-12, "{}", cost.amount);
|
||||
assert_eq!(
|
||||
(cost.usage.input_tokens, cost.usage.output_tokens),
|
||||
(1000, 200)
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue