Browse Source

fix(tui): --continue selects wrong session (#5513)

Ravi Kumar 2 months ago
parent
commit
fdf560c343
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/opencode/src/cli/cmd/tui/app.tsx

+ 3 - 1
packages/opencode/src/cli/cmd/tui/app.tsx

@@ -218,7 +218,9 @@ function App() {
   let continued = false
   let continued = false
   createEffect(() => {
   createEffect(() => {
     if (continued || sync.status !== "complete" || !args.continue) return
     if (continued || sync.status !== "complete" || !args.continue) return
-    const match = sync.data.session.find((x) => x.parentID === undefined)?.id
+    const match = sync.data.session
+      .toSorted((a, b) => b.time.updated - a.time.updated)
+      .find((x) => x.parentID === undefined)?.id
     if (match) {
     if (match) {
       continued = true
       continued = true
       route.navigate({ type: "session", sessionID: match })
       route.navigate({ type: "session", sessionID: match })