mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 01:32:22 +03:00
* feat(logging): bump CHAT_LOG_ARRAY_TAIL_ITEMS default 24 -> 128 Real agentic CLIs with many MCP servers routinely declare 40-50+ tools in a single request — a live OpenClaw session logged 47. The tail-24 default silently dropped the array's earlier entries behind an _omniroute_truncated_array marker, so investigating why a specific tool call (apply_patch) behaved oddly turned up nothing: its declared shape (function vs custom type) was unrecoverable from the call log across 40 recent requests, even though the calls themselves succeeded. Bumped the configurable default to comfortably cover real large tool lists with headroom. Updated .env.example and docs/reference/ ENVIRONMENT.md to match (env-doc-sync check passes). * test(logging): pin CHAT_LOG_ARRAY_TAIL_ITEMS default at 128 The bump commit had no dedicated test asserting the literal default value; the existing chatcore-log-truncation.test.ts derives its expectations from getChatLogArrayTailItems() itself, so it can't discriminate a regression back toward the old, too-small 24 default. --------- Co-authored-by: Markus Hartung <mail@hartmark.se>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
/**
|
|
* Regression test for the CHAT_LOG_ARRAY_TAIL_ITEMS default bump 24 -> 128.
|
|
*
|
|
* Real agentic CLIs with many MCP servers routinely declare 40-50+ tools in
|
|
* a single request — a live OpenClaw session logged 47. The old tail-24
|
|
* default silently dropped the array's earlier entries behind an
|
|
* `_omniroute_truncated_array` marker, including (in one traced case) the
|
|
* tool actually being called, making its declared shape unrecoverable from
|
|
* the call log even though the call itself succeeded.
|
|
*
|
|
* Pins the literal default so a future edit can't silently regress it back
|
|
* toward the old, too-small value.
|
|
*/
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { getChatLogArrayTailItems } from "@/lib/logEnv";
|
|
|
|
test("getChatLogArrayTailItems defaults to 128 (not the old 24) when unset", () => {
|
|
const saved = process.env.CHAT_LOG_ARRAY_TAIL_ITEMS;
|
|
delete process.env.CHAT_LOG_ARRAY_TAIL_ITEMS;
|
|
try {
|
|
assert.equal(getChatLogArrayTailItems(), 128);
|
|
} finally {
|
|
if (saved === undefined) delete process.env.CHAT_LOG_ARRAY_TAIL_ITEMS;
|
|
else process.env.CHAT_LOG_ARRAY_TAIL_ITEMS = saved;
|
|
}
|
|
});
|