fix(chat): route abort to the session's own OpenCode instance
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.
This commit is contained in:
@@ -721,8 +721,14 @@ export async function optimisticSend(input: {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function abortCurrentOperation(sessionId: string): Promise<void> {
|
||||
// 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user