From 81b8218d7cee839884a6d279bf8d153a2eba9f9c Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sun, 5 Jul 2026 10:47:09 +0300 Subject: [PATCH] fix(chat): route abort to the session's own OpenCode instance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stop button sent the abort with the UI's active directory, but OpenCode dispatches the request to the per-directory instance — for a session running under a different project, worktree, or a mapped docker path the abort hit an instance that didn't own the prompt, cancelled nothing, and still returned 200. The abort now resolves the session's own directory, like the revert flow's aborts always did. --- packages/ui/src/sync/session-actions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/sync/session-actions.ts b/packages/ui/src/sync/session-actions.ts index e0dc66c5..6195f127 100644 --- a/packages/ui/src/sync/session-actions.ts +++ b/packages/ui/src/sync/session-actions.ts @@ -721,8 +721,14 @@ export async function optimisticSend(input: { // --------------------------------------------------------------------------- export async function abortCurrentOperation(sessionId: string): Promise { + // The abort must carry the SESSION'S directory, not the active UI directory: + // OpenCode routes the request to the per-directory instance, and an abort + // sent to the wrong instance cancels nothing while still returning 200 true + // (the "stop button does nothing" report — sessions in another project/ + // worktree than the UI's current directory could never be aborted). + const { directory } = dirStoreForSession(sessionId) try { - await sdk().session.abort({ sessionID: sessionId, directory: dir() }) + await sdk().session.abort({ sessionID: sessionId, directory }) } catch (error) { console.error("[session-actions] abort failed", error) }