You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TestFilterLargeDiffs_Boundary fails because exactNTokens fixture is not token-exact #1012
TestFilterLargeDiffs_Boundary currently fails on the latest main branch because its exactNTokens helper assumes that repeating "a "n times produces exactly ncl100k_base tokens. The tokenizer can merge that repeated pattern, so the assumption does not hold.
Reproduction
At commit 9c5e90d0b1b64f84119754b8517b6d9b0978d15f:
go test ./internal/agent -run '^TestFilterLargeDiffs_Boundary$' -count=1
Output on macOS arm64 with the repository's Go 1.25.5 toolchain:
The same failure also appears during go test ./....
Cause
The helper constructs its fixture with:
s:=strings.TrimSpace(strings.Repeat("a ", n))
BPE tokenization is content-dependent, so repeated source words are not guaranteed to map one-to-one to tokens.
Expected behavior
The boundary test should construct text based on the actual tokenizer result (or use a verified non-merging fixture) so a clean checkout's tests pass while still testing exactly 80 versus 81 tokens.
One robust option is to append text incrementally and stop when llm.CountTokens reaches the requested count, failing only if it skips past it.
The full suite also exposes the same fixture bug in internal/scan: TestFilterLargeScans_Boundary fails with llm.CountTokens(<80-token string>) = 39, want 80. The helper/pattern therefore affects both review-diff and full-scan boundary coverage.
Confirmed — I reproduced the exact 39, want 80 failure at commit 9c5e90d in both TestFilterLargeDiffs_Boundary and TestFilterLargeScans_Boundary. The failure appears to involve the tokenizer initialization/fallback path, and I am working on a fix. I will follow up with the implementation and verification results.
Activity
dongyikuan919 commentedon Aug 20, 2026
The full suite also exposes the same fixture bug in
internal/scan:TestFilterLargeScans_Boundaryfails withllm.CountTokens(<80-token string>) = 39, want 80. The helper/pattern therefore affects both review-diff and full-scan boundary coverage.wu21-web commentedon Aug 20, 2026
Cannot reproduce on:
with go 1.27
Qiyuanqiii commentedon Aug 20, 2026
Confirmed — I reproduced the exact 39, want 80 failure at commit 9c5e90d in both TestFilterLargeDiffs_Boundary and TestFilterLargeScans_Boundary. The failure appears to involve the tokenizer initialization/fallback path, and I am working on a fix. I will follow up with the implementation and verification results.
fix(llm): install the embedded BPE loader from package init (alibaba#…
fix(llm): install the embedded BPE loader from package init (alibaba#…