From ee435104b6b7bd0f2646cf32e097b8bc098e7a78 Mon Sep 17 00:00:00 2001 From: Arjithar8 Date: Sat, 16 May 2026 00:02:39 +0530 Subject: [PATCH 1/3] fix(opencode): use valid continue placeholder session id, since validation will fail and user will be shown an "unexpected server error" message instead of say Session not found which is raised further down the line when validation doesn't fail. --- packages/opencode/src/cli/cmd/tui/app.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 29cca133bbfd..dc680f0d5082 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -209,7 +209,7 @@ export function tui(input: { input.args.continue ? { type: "session", - sessionID: "dummy", + sessionID: "ses_dummy", } : undefined } From 70668f9fbd848a8e1dcaca51050fc6f1942c901a Mon Sep 17 00:00:00 2001 From: Arjithar8 Date: Sat, 16 May 2026 00:08:15 +0530 Subject: [PATCH 2/3] fix(opencode): improve continue flag error for new projects, previously it was showing "Session not found: ses_dummy" error when the project was never used in the past --- packages/opencode/src/cli/cmd/tui/app.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index dc680f0d5082..eb654ad1c8a8 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -401,6 +401,10 @@ function App(props: { onSnapshot?: () => Promise }) { const match = sync.data.session .toSorted((a, b) => b.time.updated - a.time.updated) .find((x) => x.parentID === undefined)?.id + if (!match) { + toast.show({ message: "No previous sessions in this project", variant: "error" }) + route.navigate({ type: "home" }) + } if (match) { continued = true if (args.fork) { From 19e20becf8507930cd018c7233ebd4e3b8329a6c Mon Sep 17 00:00:00 2001 From: Arjithar8 Date: Sat, 16 May 2026 00:49:06 +0530 Subject: [PATCH 3/3] fix(opencode): updating the structure of how i used if statement earlier it was not a great way --- packages/opencode/src/cli/cmd/tui/app.tsx | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 0c2877aab8a6..d5eef882a20b 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -399,23 +399,24 @@ function App(props: { onSnapshot?: () => Promise }) { const match = sync.data.session .toSorted((a, b) => b.time.updated - a.time.updated) .find((x) => x.parentID === undefined)?.id + + continued = true + if (!match) { toast.show({ message: "No previous sessions in this project", variant: "error" }) route.navigate({ type: "home" }) + return } - if (match) { - continued = true - if (args.fork) { - void sdk.client.session.fork({ sessionID: match }).then((result) => { - if (result.data?.id) { - route.navigate({ type: "session", sessionID: result.data.id }) - } else { - toast.show({ message: "Failed to fork session", variant: "error" }) - } - }) - } else { - route.navigate({ type: "session", sessionID: match }) - } + if (args.fork) { + void sdk.client.session.fork({ sessionID: match }).then((result) => { + if (result.data?.id) { + route.navigate({ type: "session", sessionID: result.data.id }) + } else { + toast.show({ message: "Failed to fork session", variant: "error" }) + } + }) + } else { + route.navigate({ type: "session", sessionID: match }) } })