From c322d0f12d6eb507650358aa4552b5fbe710fcac Mon Sep 17 00:00:00 2001 From: Sergei Solo Date: Sat, 31 Jan 2026 21:51:41 +0500 Subject: [PATCH] fix(tui): pass directory to tui() to fix session loading When running opencode from a different working directory, sessions were not loading because the directory parameter was not being passed to the tui() function. This caused the SDK to not set the x-opencode-directory header, and the server fell back to process.cwd() which was incorrect in the worker context (Bun Workers don't inherit process.chdir()). --- packages/opencode/src/cli/cmd/tui/thread.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opencode/src/cli/cmd/tui/thread.ts b/packages/opencode/src/cli/cmd/tui/thread.ts index 6d41fe857a61..a2ccf0c2a162 100644 --- a/packages/opencode/src/cli/cmd/tui/thread.ts +++ b/packages/opencode/src/cli/cmd/tui/thread.ts @@ -161,6 +161,7 @@ export const TuiThreadCommand = cmd({ const tuiPromise = tui({ url, + directory: cwd, fetch: customFetch, events, args: {