diff options
| author | Dax Raad <[email protected]> | 2026-02-01 20:39:58 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-02-01 20:39:58 -0500 |
| commit | 6c9b2c37a5e12f0e79ce5a18af33073c9e646cc1 (patch) | |
| tree | b6290f6e152572f9eb10d7ee1df572358772d347 | |
| parent | 3ab41d548f0c2352d6fd351e16d8151bc4c25f00 (diff) | |
| download | opencode-6c9b2c37a5e12f0e79ce5a18af33073c9e646cc1.tar.gz opencode-6c9b2c37a5e12f0e79ce5a18af33073c9e646cc1.zip | |
core: allow starting new sessions after errors by fixing stuck session status
| -rw-r--r-- | packages/opencode/src/session/processor.ts | 1 | ||||
| -rw-r--r-- | packages/opencode/src/session/prompt.ts | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/opencode/src/session/processor.ts b/packages/opencode/src/session/processor.ts index ada6f8314..24b4a4f9f 100644 --- a/packages/opencode/src/session/processor.ts +++ b/packages/opencode/src/session/processor.ts @@ -368,6 +368,7 @@ export namespace SessionProcessor { sessionID: input.assistantMessage.sessionID, error: input.assistantMessage.error, }) + SessionStatus.set(input.sessionID, { type: "idle" }) } if (snapshot) { const patch = await Snapshot.patch(snapshot) diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index c6d040f2f..98dce97ba 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -62,7 +62,7 @@ export namespace SessionPrompt { abort: AbortController callbacks: { resolve(input: MessageV2.WithParts): void - reject(): void + reject(reason?: any): void }[] } > = {} @@ -72,7 +72,7 @@ export namespace SessionPrompt { for (const item of Object.values(current)) { item.abort.abort() for (const callback of item.callbacks) { - callback.reject() + callback.reject(new DOMException("Aborted", "AbortError")) } } }, @@ -251,10 +251,13 @@ export namespace SessionPrompt { log.info("cancel", { sessionID }) const s = state() const match = s[sessionID] - if (!match) return + if (!match) { + SessionStatus.set(sessionID, { type: "idle" }) + return + } match.abort.abort() for (const item of match.callbacks) { - item.reject() + item.reject(new DOMException("Aborted", "AbortError")) } delete s[sessionID] SessionStatus.set(sessionID, { type: "idle" }) |
