From aa98ea9ed57e34550d7d2bcad271340d06683c55 Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 19 Aug 2026 02:04:51 +0200 Subject: [PATCH] test: settled in-flight auto-title request between orphan-submit iterations The title latch from PR #8911 dedupes a second title start while one is in flight; the orphan-submit loop implicitly relied on the first mocked request having settled. Drain its promise chain at a macrotask boundary before the next submit. --- .../test/input-controller-orphan-submit.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/coding-agent/test/input-controller-orphan-submit.test.ts b/packages/coding-agent/test/input-controller-orphan-submit.test.ts index 6e9777832..b0b5b4044 100644 --- a/packages/coding-agent/test/input-controller-orphan-submit.test.ts +++ b/packages/coding-agent/test/input-controller-orphan-submit.test.ts @@ -331,6 +331,13 @@ describe("InputController orphaned submit", () => { images: undefined, }); expect(titleSpy).toHaveBeenCalledWith(forwardedText); + // Drain the title request's .then/.finally chain so the in-flight + // latch clears before the next submit; a request still in flight is + // deliberately deduped (see agent-session-title-generation-dispose). + // The chain exposes no settlement promise; sleep(0) is a macrotask + // boundary that deterministically drains all pending microtasks — + // not a wall-clock wait, so fake timers would not help here. + await Bun.sleep(0); } } finally { vi.restoreAllMocks();