diff --git a/tests/restart-chaos/README.md b/tests/restart-chaos/README.md index 2e015e6a7c2..f32ca0d93ca 100644 --- a/tests/restart-chaos/README.md +++ b/tests/restart-chaos/README.md @@ -1150,7 +1150,8 @@ seeded 0–60 s after that run settled (`rewake.ts`): scheduler's own `issue_monitor_due` wake starts the run. - **W2Q**: phase 1 asks one `request_human_input` question and parks. A board comment (a note to include, not the answer) wakes the task while the question is pending. The board answers after that run settled. -- **W2C**: as W2, and first the board changes the agent's `adapterConfig.idleTimeoutMs`, so the next run +- **W2C**: as W2, and first the board changes the agent's `adapterConfig.idleTimeoutMs` (sending the whole + `adapterConfig` with `replaceAdapterConfig: true`, as the agent settings form does), so the next run cannot resume the saved session. SR1 (`session-faults.ts`, #20844) is the same change while a question is parked; W2C is the change after a run succeeded. diff --git a/tests/restart-chaos/rewake.ts b/tests/restart-chaos/rewake.ts index 369d433ba56..a4d6430e0f0 100644 --- a/tests/restart-chaos/rewake.ts +++ b/tests/restart-chaos/rewake.ts @@ -188,7 +188,8 @@ export async function rewakeStep(input: RewakeStepInput): Promise { const idleTimeoutMs = rewakeIdleTimeoutMs(plan.index); const change: NonNullable = { at: now, idleTimeoutMs, httpStatus: null, error: null }; try { - await input.api.patch(`/api/agents/${input.agentId}`, { adapterConfig: { idleTimeoutMs } }); + const agent = await input.api.get<{ adapterConfig?: Record | null }>(`/api/agents/${input.agentId}`); + await input.api.patch(`/api/agents/${input.agentId}`, { adapterConfig: { ...(agent.adapterConfig ?? {}), idleTimeoutMs }, replaceAdapterConfig: true }); change.httpStatus = 200; } catch (error) { change.httpStatus = statusOf(error); diff --git a/tests/restart-chaos/shape-cells.test.ts b/tests/restart-chaos/shape-cells.test.ts index 9700241cc3f..ab4a08ea1d5 100644 --- a/tests/restart-chaos/shape-cells.test.ts +++ b/tests/restart-chaos/shape-cells.test.ts @@ -51,7 +51,7 @@ describe("W2, W2Q, W2C: re-wake after success", () => { const calls: Array<{ method: string; route: string; body: unknown }> = []; const record = { plan: { taskId: "t01", index: 3, nonce: "0bcd1204", followUpAfterMs: 10_000, workload: "W2", ...plan } } as unknown as TaskRecord; const api = { - async get(route: string) { return (route.endsWith("/interactions") ? interactions : []) as T; }, + async get(route: string) { return (route.endsWith("/interactions") ? interactions : route === "/api/agents/a1" ? { adapterConfig: { model: "m1" } } : []) as T; }, async post(route: string, body?: unknown) { calls.push({ method: "post", route, body }); return { id: "c1" } as T; }, async patch(route: string, body?: unknown) { calls.push({ method: "patch", route, body }); return {} as T; }, }; @@ -94,7 +94,7 @@ describe("W2, W2Q, W2C: re-wake after success", () => { it("W2C: changes the agent configuration first, then wakes at least 5 s later", async () => { const { calls, record, step } = harness({ workload: "W2C", followUpAfterMs: 0 }); await step(sample("in_review", [run("r1", "succeeded", 1_000)]), 5_000); - expect(calls).toEqual([{ method: "patch", route: "/api/agents/a1", body: { adapterConfig: { idleTimeoutMs: 301_003 } } }]); + expect(calls).toEqual([{ method: "patch", route: "/api/agents/a1", body: { adapterConfig: { model: "m1", idleTimeoutMs: 301_003 }, replaceAdapterConfig: true } }]); await step(sample("in_review", [run("r1", "succeeded", 1_000)]), 7_000); expect(calls).toHaveLength(1); await step(sample("in_review", [run("r1", "succeeded", 1_000)]), 10_000);