






























@@ -4,6 +4,7 @@ import {
44isConfigApplyNoopForSnapshot,
55isConfigHashConflict,
66isConfigPatchNoopForSnapshot,
7+patchConfig,
78waitForConfigRestartSettle,
89} from "./suite-runtime-gateway.js";
910import type { QaSuiteRuntimeEnv } from "./suite-runtime-types.js";
@@ -26,6 +27,25 @@ function createRestartSettleEnv(waitReady: (params: unknown) => Promise<void>) {
2627} as unknown as Pick<QaSuiteRuntimeEnv, "gateway" | "transport">;
2728}
282930+function createConfigMutationEnv(
31+gatewayCall: (method: string, params: unknown, options: unknown) => Promise<unknown>,
32+) {
33+const waitReady = vi.fn(async (_params: { gateway: unknown; timeoutMs: number }) => {});
34+const env = {
35+gateway: {
36+baseUrl: "http://127.0.0.1:43123",
37+call: gatewayCall,
38+},
39+transport: {
40+ waitReady,
41+},
42+providerMode: "mock-openai",
43+primaryModel: "openai/gpt-5.5",
44+alternateModel: "openai/gpt-5.5-mini",
45+} as unknown as QaSuiteRuntimeEnv;
46+return { env, waitReady };
47+}
48+2949describe("qa suite gateway helpers", () => {
3050it("reads retry-after from the primary gateway error before appended logs", () => {
3151const error = new Error(
@@ -134,6 +154,41 @@ describe("qa suite gateway helpers", () => {
134154).toBe(false);
135155});
136156157+it("uses the live timeout profile for config mutations and restart settle", async () => {
158+const release = vi.fn(async () => {});
159+fetchWithSsrFGuardMock.mockResolvedValue({
160+response: { ok: true },
161+ release,
162+});
163+const gatewayCall = vi.fn(async (method: string) => {
164+if (method === "config.get") {
165+return { hash: "hash-1", config: { tools: {} } };
166+}
167+return { ok: true };
168+});
169+const { env, waitReady } = createConfigMutationEnv(gatewayCall);
170+171+await patchConfig({
172+ env,
173+patch: { tools: { deny: ["read"] } },
174+restartDelayMs: 0,
175+});
176+177+expect(gatewayCall).toHaveBeenCalledWith(
178+"config.patch",
179+expect.objectContaining({
180+raw: expect.stringContaining('"deny"'),
181+baseHash: "hash-1",
182+}),
183+{ timeoutMs: 90_000 },
184+);
185+expect(waitReady).toHaveBeenCalledWith({
186+gateway: env.gateway,
187+timeoutMs: expect.any(Number),
188+});
189+expect(waitReady.mock.calls[0]?.[0].timeoutMs).toBeGreaterThan(60_000);
190+});
191+137192it("waits for transport readiness after gateway restart health", async () => {
138193const release = vi.fn(async () => {});
139194fetchWithSsrFGuardMock.mockResolvedValue({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。