fix(agents): stabilize overflow compaction retries and session context accounting (openclaw#14102) thanks @vpesh

Verified:
- CI checks for commit 86a7ecb45e
- Rebase conflict resolution for compatibility with latest main

Co-authored-by: vpesh <9496634+vpesh@users.noreply.github.com>
This commit is contained in:
Vladimir Peshekhonov
2026-02-13 00:53:13 +01:00
committed by GitHub
parent da55d70fb0
commit 957b883082
13 changed files with 148 additions and 21 deletions

View File

@@ -74,4 +74,19 @@ describe("normalizeUsage", () => {
}),
).toBe(1_550);
});
it("prefers explicit prompt token overrides", () => {
expect(
deriveSessionTotalTokens({
usage: {
input: 1_200,
cacheRead: 300,
cacheWrite: 50,
total: 9_999,
},
promptTokens: 65_000,
contextTokens: 200_000,
}),
).toBe(65_000);
});
});