From d8d77ffbae7156595fb90947efe33df8a2ee4fe2 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Thu, 30 Jul 2026 06:15:41 +0200 Subject: [PATCH] test(e2e): delay the draft-proof final answer past the start gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A progress draft only exists while the agent is working, and OpenClaw's exec returns instantly for a mock tool call, so the whole turn finished in ~86ms — inside the 1.5s draft gate. No draft was created, which is correct behavior but proves nothing about rendering. The draft-proof scenario now holds its final answer (MOCK_DRAFTPROOF_FINAL_DELAY_MS, default 6s) so the turn straddles the gate. That is what made the live Discord recording possible: draft created, edited with the status headline above the tool line, replaced by the final answer, then deleted. --- scripts/e2e/mock-openai-server.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/e2e/mock-openai-server.mjs b/scripts/e2e/mock-openai-server.mjs index d34994204bec..65f0bddaf42f 100644 --- a/scripts/e2e/mock-openai-server.mjs +++ b/scripts/e2e/mock-openai-server.mjs @@ -600,6 +600,10 @@ const server = http.createServer((req, res) => { ); return; } + // Hold the final answer so the turn outlives the progress-draft start + // gate. Without this the whole turn finishes in well under a second and + // no draft is created, which is correct behavior but proves nothing. + await delay(readPositiveIntEnv("MOCK_DRAFTPROOF_FINAL_DELAY_MS", 6000)); writeChatCompletion(res, body.stream !== false, "OPENCLAW_E2E_DRAFTPROOF"); return; }