mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:51:25 +00:00
fix: /status shows incorrect context percentage — totalTokens clamped to contextTokens (#15114) (#15133)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: a489669fc7
Co-authored-by: echoVic <16428813+echoVic@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -47,7 +47,7 @@ describe("normalizeUsage", () => {
|
||||
expect(hasNonzeroUsage({ total: 1 })).toBe(true);
|
||||
});
|
||||
|
||||
it("caps derived session total tokens to the context window", () => {
|
||||
it("does not clamp derived session total tokens to the context window", () => {
|
||||
expect(
|
||||
deriveSessionTotalTokens({
|
||||
usage: {
|
||||
@@ -58,7 +58,7 @@ describe("normalizeUsage", () => {
|
||||
},
|
||||
contextTokens: 200_000,
|
||||
}),
|
||||
).toBe(200_000);
|
||||
).toBe(2_400_027);
|
||||
});
|
||||
|
||||
it("uses prompt tokens when within context window", () => {
|
||||
|
||||
Reference in New Issue
Block a user