test(perf): trim slow gateway, daemon, and command specs

This commit is contained in:
Vincent Koc
2026-04-14 23:40:03 +01:00
parent d5b1329bf3
commit 59b5db5cbf
5 changed files with 22 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vitest";
import {
auditGatewayServiceConfig,
buildGatewayInstallPlan,
@@ -11,17 +11,10 @@ import {
serviceRestart,
writeConfigFile,
} from "./doctor.e2e-harness.js";
let doctorCommand: typeof import("./doctor.js").doctorCommand;
let healthCommand: typeof import("./health.js").healthCommand;
import { doctorCommand } from "./doctor.js";
import { healthCommand } from "./health.js";
describe("doctor command update-mode repairs", () => {
beforeEach(async () => {
vi.resetModules();
({ doctorCommand } = await import("./doctor.js"));
({ healthCommand } = await import("./health.js"));
});
it("skips gateway installs during non-interactive update repairs", async () => {
mockDoctorConfigSnapshot();

View File

@@ -93,7 +93,7 @@ export async function sessionsCommand(
const displayDefaults = resolveSessionDisplayDefaults(cfg);
const configContextTokens =
cfg.agents?.defaults?.contextTokens ??
lookupContextTokens(displayDefaults.model) ??
lookupContextTokens(displayDefaults.model, { allowAsyncLoad: false }) ??
DEFAULT_CONTEXT_TOKENS;
const targets = resolveSessionStoreTargetsOrExit({
cfg,
@@ -161,7 +161,10 @@ export async function sessionsCommand(
totalTokensFresh:
typeof r.totalTokens === "number" ? r.totalTokensFresh !== false : false,
contextTokens:
r.contextTokens ?? lookupContextTokens(model) ?? configContextTokens ?? null,
r.contextTokens ??
lookupContextTokens(model, { allowAsyncLoad: false }) ??
configContextTokens ??
null,
model,
};
}),
@@ -201,7 +204,10 @@ export async function sessionsCommand(
for (const row of rows) {
const model = resolveSessionDisplayModel(cfg, row, displayDefaults);
const contextTokens = row.contextTokens ?? lookupContextTokens(model) ?? configContextTokens;
const contextTokens =
row.contextTokens ??
lookupContextTokens(model, { allowAsyncLoad: false }) ??
configContextTokens;
const total = resolveFreshSessionTotalTokens(row);
const line = [

View File

@@ -0,0 +1,8 @@
import { wrapExternalContent } from "../security/external-content.js";
export function wrapUntrustedFileContent(content: string): string {
return wrapExternalContent(content, {
source: "unknown",
includeWarning: false,
});
}

View File

@@ -31,7 +31,6 @@ import {
type InputImageSource,
} from "../media/input-files.js";
import { defaultRuntime } from "../runtime.js";
import { wrapExternalContent } from "../security/external-content.js";
import { resolveAssistantStreamDeltaText } from "./agent-event-assistant-text.js";
import type { AuthRateLimiter } from "./auth-rate-limit.js";
import type { ResolvedGatewayAuth } from "./auth.js";
@@ -55,6 +54,7 @@ import {
type StreamingEvent,
type Usage,
} from "./open-responses.schema.js";
import { wrapUntrustedFileContent } from "./openresponses-file-content.js";
import { buildAgentPrompt } from "./openresponses-prompt.js";
import { createAssistantOutputItem, createFunctionCallOutputItem } from "./openresponses-shape.js";
@@ -70,13 +70,6 @@ type OpenResponsesHttpOptions = {
const DEFAULT_BODY_BYTES = 20 * 1024 * 1024;
const DEFAULT_MAX_URL_PARTS = 8;
function wrapUntrustedFileContent(content: string): string {
return wrapExternalContent(content, {
source: "unknown",
includeWarning: false,
});
}
// In-memory map from responseId -> sessionKey for previous_response_id continuity.
// Entries are evicted after 30 minutes to bound memory usage.
const RESPONSE_SESSION_TTL_MS = 30 * 60 * 1000;

View File

@@ -6,6 +6,7 @@
*/
import { beforeAll, describe, it, expect } from "vitest";
import { wrapUntrustedFileContent } from "./openresponses-file-content.js";
let InputImageContentPartSchema: typeof import("./open-responses.schema.js").InputImageContentPartSchema;
let InputFileContentPartSchema: typeof import("./open-responses.schema.js").InputFileContentPartSchema;
@@ -13,7 +14,6 @@ let ToolDefinitionSchema: typeof import("./open-responses.schema.js").ToolDefini
let CreateResponseBodySchema: typeof import("./open-responses.schema.js").CreateResponseBodySchema;
let OutputItemSchema: typeof import("./open-responses.schema.js").OutputItemSchema;
let buildAgentPrompt: typeof import("./openresponses-prompt.js").buildAgentPrompt;
let wrapUntrustedFileContent: typeof import("./openresponses-http.js").__testing.wrapUntrustedFileContent;
describe("OpenResponses Feature Parity", () => {
beforeAll(async () => {
@@ -25,9 +25,6 @@ describe("OpenResponses Feature Parity", () => {
OutputItemSchema,
} = await import("./open-responses.schema.js"));
({ buildAgentPrompt } = await import("./openresponses-prompt.js"));
({
__testing: { wrapUntrustedFileContent },
} = await import("./openresponses-http.js"));
});
describe("Schema Validation", () => {