mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:28:29 +00:00
fix: context overflow compaction and subagent announce improvements (#11664) (thanks @tyler6204)
* initial commit * feat: implement deriveSessionTotalTokens function and update usage tests * Added deriveSessionTotalTokens function to calculate total tokens based on usage and context tokens. * Updated usage tests to include cases for derived session total tokens. * Refactored session usage calculations in multiple files to utilize the new function for improved accuracy. * fix: restore overflow truncation fallback + changelog/test hardening (#11551) (thanks @tyler6204)
This commit is contained in:
@@ -294,6 +294,29 @@ describe("callGateway error details", () => {
|
||||
expect(err?.message).toContain("Bind: loopback");
|
||||
});
|
||||
|
||||
it("does not overflow very large timeout values", async () => {
|
||||
startMode = "silent";
|
||||
loadConfig.mockReturnValue({
|
||||
gateway: { mode: "local", bind: "loopback" },
|
||||
});
|
||||
resolveGatewayPort.mockReturnValue(18789);
|
||||
pickPrimaryTailnetIPv4.mockReturnValue(undefined);
|
||||
|
||||
vi.useFakeTimers();
|
||||
let err: Error | null = null;
|
||||
const promise = callGateway({ method: "health", timeoutMs: 2_592_010_000 }).catch((caught) => {
|
||||
err = caught as Error;
|
||||
});
|
||||
|
||||
await vi.advanceTimersByTimeAsync(1);
|
||||
expect(err).toBeNull();
|
||||
|
||||
lastClientOptions?.onClose?.(1006, "");
|
||||
await promise;
|
||||
|
||||
expect(err?.message).toContain("gateway closed (1006");
|
||||
});
|
||||
|
||||
it("fails fast when remote mode is missing remote url", async () => {
|
||||
loadConfig.mockReturnValue({
|
||||
gateway: { mode: "remote", bind: "loopback", remote: {} },
|
||||
|
||||
Reference in New Issue
Block a user