LibreChat/e2e/playwright.config.benchmark.ts
Danny Avila 73699b5c25
perf: Reduce Agent Chat Startup Latency (#14423)
* perf: reduce agent chat startup latency

* test: align Redis stream readiness assertions

* perf: overlap remaining agent startup work

* perf: persist initial agent job metadata atomically

* test: add agent startup latency benchmark

* fix: harden resumable agent stream lifecycle

* fix: isolate replacement stream lifecycles

* fix: preserve terminal stream epochs
2026-07-25 07:58:20 -04:00

29 lines
1 KiB
TypeScript

import { defineConfig } from '@playwright/test';
import path from 'node:path';
import mockConfig from './playwright.config.mock';
process.env.MOCK_LLM_REPLY ??= 'BENCH_TOKEN';
process.env.MOCK_LLM_CHUNK_DELAY_MS ??= '1';
const mongoDelay = Number.parseInt(process.env.E2E_LATENCY_MONGO_DELAY_MS ?? '', 10);
if (Number.isInteger(mongoDelay) && mongoDelay > 0) {
const latencyHook = path.resolve(__dirname, 'benchmarks/mongoose-latency-hook.cjs');
if (!process.env.NODE_OPTIONS?.includes(latencyHook)) {
process.env.NODE_OPTIONS = [process.env.NODE_OPTIONS, `--require=${latencyHook}`]
.filter(Boolean)
.join(' ');
}
}
export default defineConfig({
...mockConfig,
testDir: 'benchmarks',
outputDir: 'benchmarks/.test-results',
timeout: 20 * 60 * 1000,
retries: 0,
reporter: [['line']],
/** The benchmark uses the stdio MCP fixture loaded by LibreChat, not the HTTP fixture. */
webServer: Array.isArray(mockConfig.webServer)
? mockConfig.webServer.slice(0, 1)
: mockConfig.webServer,
});