From d583e6161f372bcf5018493f7ef6c01246479f3a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:39:33 +0000 Subject: [PATCH 01/12] Initial plan From 566b4597a22947faf3a6f1d15ddd79c0dba7f686 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:45:38 +0000 Subject: [PATCH 02/12] Add initializing state to prevent race condition errors Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 32 ++++++++++++++++++++++++++++---- lua/opencode/ui/chat_events.lua | 9 ++------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 4be0de0..4f2b1eb 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -10,6 +10,7 @@ local M = {} ---@field streaming_message_index number|nil ---@field provider_id string ---@field model_id string +---@field initializing boolean ---@type opencode.ui.chat.State|nil M.state = nil @@ -86,6 +87,7 @@ function M.open(opts) streaming_message_index = nil, provider_id = opts.provider_id or config.provider_id or "anthropic", model_id = opts.model_id or config.model_id or "claude-3-5-sonnet-20241022", + initializing = true, } -- Setup keymaps @@ -237,7 +239,17 @@ end ---Prompt for user input function M.prompt_input() - if not M.state or not M.state.port or not M.state.session_id then + if not M.state or not M.state.port then + vim.notify("No connection to opencode", vim.log.levels.ERROR, { title = "opencode" }) + return + end + + if M.state.initializing then + vim.notify("Session is initializing, please wait...", vim.log.levels.WARN, { title = "opencode" }) + return + end + + if not M.state.session_id then vim.notify("No active session", vim.log.levels.ERROR, { title = "opencode" }) return end @@ -252,7 +264,17 @@ end ---Send a message ---@param text string function M.send_message(text) - if not M.state or not M.state.port or not M.state.session_id then + if not M.state or not M.state.port then + vim.notify("No connection to opencode", vim.log.levels.ERROR, { title = "opencode" }) + return + end + + if M.state.initializing then + vim.notify("Session is initializing, please wait...", vim.log.levels.WARN, { title = "opencode" }) + return + end + + if not M.state.session_id then vim.notify("No active session", vim.log.levels.ERROR, { title = "opencode" }) return end @@ -356,17 +378,18 @@ function M.new_session() return end - -- Clear messages + -- Clear messages and mark as initializing M.state.messages = {} M.state.session_id = nil M.state.streaming_message_index = nil + M.state.initializing = true M.render() -- Create new session local client = require("opencode.cli.client") client.tui_execute_command("session.new", M.state.port, function() -- Session ID will be set via SSE event - vim.notify("New session started", vim.log.levels.INFO, { title = "opencode" }) + -- Don't notify here - let the SSE event handler notify when session is ready end) end @@ -400,6 +423,7 @@ end function M.set_session_id(session_id) if M.state then M.state.session_id = session_id + M.state.initializing = false end end diff --git a/lua/opencode/ui/chat_events.lua b/lua/opencode/ui/chat_events.lua index 2f5fe8a..7f62adb 100644 --- a/lua/opencode/ui/chat_events.lua +++ b/lua/opencode/ui/chat_events.lua @@ -56,13 +56,8 @@ function M.subscribe(port) local session = event.properties and event.properties.session if session and session.id then chat.set_session_id(session.id) - -- Add a system message to indicate new session - chat.add_message({ - role = "system", - text = "Session started: " .. session.id, - streaming = false, - complete = true, - }) + -- Notify that session is ready + vim.notify("Session ready - you can now send messages", vim.log.levels.INFO, { title = "opencode" }) end elseif event.type == "session.idle" then -- Session finished responding From d1478bc6b2bafef93613d84192827d3acc2e2475 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:47:20 +0000 Subject: [PATCH 03/12] Refactor: extract validate_session_ready to reduce duplication Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 4f2b1eb..5885bdf 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -237,20 +237,30 @@ function M.render() end end ----Prompt for user input -function M.prompt_input() +---Validate that the chat is ready for interaction +---@return boolean ready True if ready, false otherwise (with notification shown) +local function validate_session_ready() if not M.state or not M.state.port then vim.notify("No connection to opencode", vim.log.levels.ERROR, { title = "opencode" }) - return + return false end if M.state.initializing then vim.notify("Session is initializing, please wait...", vim.log.levels.WARN, { title = "opencode" }) - return + return false end if not M.state.session_id then vim.notify("No active session", vim.log.levels.ERROR, { title = "opencode" }) + return false + end + + return true +end + +---Prompt for user input +function M.prompt_input() + if not validate_session_ready() then return end @@ -264,18 +274,7 @@ end ---Send a message ---@param text string function M.send_message(text) - if not M.state or not M.state.port then - vim.notify("No connection to opencode", vim.log.levels.ERROR, { title = "opencode" }) - return - end - - if M.state.initializing then - vim.notify("Session is initializing, please wait...", vim.log.levels.WARN, { title = "opencode" }) - return - end - - if not M.state.session_id then - vim.notify("No active session", vim.log.levels.ERROR, { title = "opencode" }) + if not validate_session_ready() then return end From dfb83e928d8aa984db0c75363fe4a3e990eedb6b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:54:38 +0000 Subject: [PATCH 04/12] Add timeout to prevent stuck initialization state Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 14 ++++++++++++++ lua/opencode/ui/chat_events.lua | 3 +++ lua/opencode/ui/chat_init.lua | 15 +++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 5885bdf..244069b 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -390,6 +390,20 @@ function M.new_session() -- Session ID will be set via SSE event -- Don't notify here - let the SSE event handler notify when session is ready end) + + -- Add a timeout to handle case where SSE event doesn't arrive + vim.defer_fn(function() + if M.state and M.state.initializing then + -- Still initializing after 5 seconds, something is wrong + vim.notify( + "Session initialization timed out. Please try again or check opencode server.", + vim.log.levels.WARN, + { title = "opencode" } + ) + -- Reset initializing flag to allow user to retry + M.state.initializing = false + end + end, 5000) end ---Interrupt the current session diff --git a/lua/opencode/ui/chat_events.lua b/lua/opencode/ui/chat_events.lua index 7f62adb..892608d 100644 --- a/lua/opencode/ui/chat_events.lua +++ b/lua/opencode/ui/chat_events.lua @@ -15,6 +15,9 @@ function M.subscribe(port) return end + -- Debug: Log received event type + -- vim.notify("Received SSE event: " .. (event.type or "unknown"), vim.log.levels.DEBUG, { title = "opencode" }) + -- Handle different event types if event.type == "message.delta" then -- Streaming message chunk diff --git a/lua/opencode/ui/chat_init.lua b/lua/opencode/ui/chat_init.lua index 23bb279..4c29cea 100644 --- a/lua/opencode/ui/chat_init.lua +++ b/lua/opencode/ui/chat_init.lua @@ -24,6 +24,21 @@ function M.start_chat(opts) -- Session will be set via SSE event end) + -- Add a timeout to handle case where SSE event doesn't arrive + vim.defer_fn(function() + local current_state = chat.get_state() + if current_state and current_state.initializing then + -- Still initializing after 5 seconds, something is wrong + vim.notify( + "Session initialization timed out. Please try pressing 'n' to create a new session.", + vim.log.levels.WARN, + { title = "opencode" } + ) + -- Reset initializing flag to allow user to retry + current_state.initializing = false + end + end, 5000) + -- Show welcome message vim.schedule(function() if chat.get_state() then From fc8b3c53d09b5a768cdc7b4705d7a26adbd60e92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:55:56 +0000 Subject: [PATCH 05/12] Remove commented debug code Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat_events.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/lua/opencode/ui/chat_events.lua b/lua/opencode/ui/chat_events.lua index 892608d..7f62adb 100644 --- a/lua/opencode/ui/chat_events.lua +++ b/lua/opencode/ui/chat_events.lua @@ -15,9 +15,6 @@ function M.subscribe(port) return end - -- Debug: Log received event type - -- vim.notify("Received SSE event: " .. (event.type or "unknown"), vim.log.levels.DEBUG, { title = "opencode" }) - -- Handle different event types if event.type == "message.delta" then -- Streaming message chunk From 5a26b158133b7d6ee9f6ea41fa1a65461fe24c47 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:02:01 +0000 Subject: [PATCH 06/12] Remove initializing flag and use on-demand session creation Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 34 ++++++++------------------------- lua/opencode/ui/chat_events.lua | 2 +- lua/opencode/ui/chat_init.lua | 15 --------------- 3 files changed, 9 insertions(+), 42 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 244069b..b6b06ad 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -10,7 +10,6 @@ local M = {} ---@field streaming_message_index number|nil ---@field provider_id string ---@field model_id string ----@field initializing boolean ---@type opencode.ui.chat.State|nil M.state = nil @@ -87,7 +86,6 @@ function M.open(opts) streaming_message_index = nil, provider_id = opts.provider_id or config.provider_id or "anthropic", model_id = opts.model_id or config.model_id or "claude-3-5-sonnet-20241022", - initializing = true, } -- Setup keymaps @@ -245,13 +243,14 @@ local function validate_session_ready() return false end - if M.state.initializing then - vim.notify("Session is initializing, please wait...", vim.log.levels.WARN, { title = "opencode" }) - return false - end - if not M.state.session_id then - vim.notify("No active session", vim.log.levels.ERROR, { title = "opencode" }) + vim.notify( + "No active session. Creating a new session...", + vim.log.levels.WARN, + { title = "opencode" } + ) + -- Try to create a session on-demand + M.new_session() return false end @@ -377,33 +376,17 @@ function M.new_session() return end - -- Clear messages and mark as initializing + -- Clear messages M.state.messages = {} M.state.session_id = nil M.state.streaming_message_index = nil - M.state.initializing = true M.render() -- Create new session local client = require("opencode.cli.client") client.tui_execute_command("session.new", M.state.port, function() -- Session ID will be set via SSE event - -- Don't notify here - let the SSE event handler notify when session is ready end) - - -- Add a timeout to handle case where SSE event doesn't arrive - vim.defer_fn(function() - if M.state and M.state.initializing then - -- Still initializing after 5 seconds, something is wrong - vim.notify( - "Session initialization timed out. Please try again or check opencode server.", - vim.log.levels.WARN, - { title = "opencode" } - ) - -- Reset initializing flag to allow user to retry - M.state.initializing = false - end - end, 5000) end ---Interrupt the current session @@ -436,7 +419,6 @@ end function M.set_session_id(session_id) if M.state then M.state.session_id = session_id - M.state.initializing = false end end diff --git a/lua/opencode/ui/chat_events.lua b/lua/opencode/ui/chat_events.lua index 7f62adb..c548aaf 100644 --- a/lua/opencode/ui/chat_events.lua +++ b/lua/opencode/ui/chat_events.lua @@ -57,7 +57,7 @@ function M.subscribe(port) if session and session.id then chat.set_session_id(session.id) -- Notify that session is ready - vim.notify("Session ready - you can now send messages", vim.log.levels.INFO, { title = "opencode" }) + vim.notify("Session ready", vim.log.levels.INFO, { title = "opencode" }) end elseif event.type == "session.idle" then -- Session finished responding diff --git a/lua/opencode/ui/chat_init.lua b/lua/opencode/ui/chat_init.lua index 4c29cea..23bb279 100644 --- a/lua/opencode/ui/chat_init.lua +++ b/lua/opencode/ui/chat_init.lua @@ -24,21 +24,6 @@ function M.start_chat(opts) -- Session will be set via SSE event end) - -- Add a timeout to handle case where SSE event doesn't arrive - vim.defer_fn(function() - local current_state = chat.get_state() - if current_state and current_state.initializing then - -- Still initializing after 5 seconds, something is wrong - vim.notify( - "Session initialization timed out. Please try pressing 'n' to create a new session.", - vim.log.levels.WARN, - { title = "opencode" } - ) - -- Reset initializing flag to allow user to retry - current_state.initializing = false - end - end, 5000) - -- Show welcome message vim.schedule(function() if chat.get_state() then From c58ffee32bb6ba323c96e090b9e42ae74b067195 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:04:27 +0000 Subject: [PATCH 07/12] Add session creation pending flag to prevent infinite loops Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index b6b06ad..9d7d663 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -10,6 +10,7 @@ local M = {} ---@field streaming_message_index number|nil ---@field provider_id string ---@field model_id string +---@field session_creation_pending boolean ---@type opencode.ui.chat.State|nil M.state = nil @@ -86,6 +87,7 @@ function M.open(opts) streaming_message_index = nil, provider_id = opts.provider_id or config.provider_id or "anthropic", model_id = opts.model_id or config.model_id or "claude-3-5-sonnet-20241022", + session_creation_pending = false, } -- Setup keymaps @@ -244,6 +246,12 @@ local function validate_session_ready() end if not M.state.session_id then + -- Check if session creation is already in progress + if M.state.session_creation_pending then + vim.notify("Session is being created, please wait...", vim.log.levels.WARN, { title = "opencode" }) + return false + end + vim.notify( "No active session. Creating a new session...", vim.log.levels.WARN, @@ -376,10 +384,11 @@ function M.new_session() return end - -- Clear messages + -- Clear messages and mark session creation as pending M.state.messages = {} M.state.session_id = nil M.state.streaming_message_index = nil + M.state.session_creation_pending = true M.render() -- Create new session @@ -387,6 +396,18 @@ function M.new_session() client.tui_execute_command("session.new", M.state.port, function() -- Session ID will be set via SSE event end) + + -- Add a timeout to reset the pending flag if session creation fails + vim.defer_fn(function() + if M.state and M.state.session_creation_pending and not M.state.session_id then + M.state.session_creation_pending = false + vim.notify( + "Session creation timed out. Please check opencode server or try again.", + vim.log.levels.WARN, + { title = "opencode" } + ) + end + end, 10000) end ---Interrupt the current session @@ -419,6 +440,7 @@ end function M.set_session_id(session_id) if M.state then M.state.session_id = session_id + M.state.session_creation_pending = false end end From 5397148f5596ae71755ac4dd06e3103e2491808f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:05:31 +0000 Subject: [PATCH 08/12] Improve timeout logic to always reset pending flag Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 9d7d663..c07c289 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -399,13 +399,16 @@ function M.new_session() -- Add a timeout to reset the pending flag if session creation fails vim.defer_fn(function() - if M.state and M.state.session_creation_pending and not M.state.session_id then + if M.state and M.state.session_creation_pending then M.state.session_creation_pending = false - vim.notify( - "Session creation timed out. Please check opencode server or try again.", - vim.log.levels.WARN, - { title = "opencode" } - ) + -- Only notify if session still hasn't been created + if not M.state.session_id then + vim.notify( + "Session creation timed out. Please check opencode server or try again.", + vim.log.levels.WARN, + { title = "opencode" } + ) + end end end, 10000) end From 1fea0ec4f73f082c7d66702d9dfb2872656c29fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:10:05 +0000 Subject: [PATCH 09/12] Improve welcome message and clarify session creation behavior Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat_init.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lua/opencode/ui/chat_init.lua b/lua/opencode/ui/chat_init.lua index 23bb279..fbdf72e 100644 --- a/lua/opencode/ui/chat_init.lua +++ b/lua/opencode/ui/chat_init.lua @@ -18,13 +18,7 @@ function M.start_chat(opts) -- Subscribe to events first require("opencode.ui.chat_events").subscribe(port) - -- Create new session via TUI command - local client = require("opencode.cli.client") - client.tui_execute_command("session.new", port, function() - -- Session will be set via SSE event - end) - - -- Show welcome message + -- Show welcome message with instructions vim.schedule(function() if chat.get_state() then local config = require("opencode.config").opts.chat or {} @@ -49,7 +43,7 @@ function M.start_chat(opts) chat.add_message({ role = "assistant", text = string.format( - "Chat session starting... Type '%s' to send a message.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", + "Welcome to OpenCode Chat!\n\nType '%s' to send a message. A session will be created automatically when you send your first message.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", send_keys, send_keys, new_session_key, @@ -62,6 +56,13 @@ function M.start_chat(opts) }) end end) + + -- Try to create initial session, but don't block if it fails + local client = require("opencode.cli.client") + client.tui_execute_command("session.new", port, function() + -- Session will be set via SSE event + -- If this fails, session will be created on-demand when user sends first message + end) end) :catch(function(err) vim.notify("Failed to start opencode: " .. err, vim.log.levels.ERROR, { title = "opencode" }) From 9dcda9c3239f20b277bdcdcd038bc3a3d3e1e8c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:11:36 +0000 Subject: [PATCH 10/12] Refine welcome message wording Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/opencode/ui/chat_init.lua b/lua/opencode/ui/chat_init.lua index fbdf72e..5f74e69 100644 --- a/lua/opencode/ui/chat_init.lua +++ b/lua/opencode/ui/chat_init.lua @@ -43,7 +43,7 @@ function M.start_chat(opts) chat.add_message({ role = "assistant", text = string.format( - "Welcome to OpenCode Chat!\n\nType '%s' to send a message. A session will be created automatically when you send your first message.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", + "Welcome to OpenCode Chat!\n\nType '%s' to send a message. A session will be created if needed.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", send_keys, send_keys, new_session_key, From 620e4f9db10db704deea30be2a5b1e3fbad5adf6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:16:26 +0000 Subject: [PATCH 11/12] Add diagnostic info showing port and troubleshooting steps Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 6 +++++- lua/opencode/ui/chat_init.lua | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index c07c289..207d109 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -403,8 +403,12 @@ function M.new_session() M.state.session_creation_pending = false -- Only notify if session still hasn't been created if not M.state.session_id then + local port_info = M.state.port and (" (port: " .. M.state.port .. ")") or "" vim.notify( - "Session creation timed out. Please check opencode server or try again.", + "Session creation timed out" .. port_info .. ". The opencode server may not be responding. Try:\n" .. + "1. Close this chat and restart opencode server\n" .. + "2. Press 'n' to create a new session\n" .. + "3. Check if multiple opencode processes are running", vim.log.levels.WARN, { title = "opencode" } ) diff --git a/lua/opencode/ui/chat_init.lua b/lua/opencode/ui/chat_init.lua index 5f74e69..0b0ec5c 100644 --- a/lua/opencode/ui/chat_init.lua +++ b/lua/opencode/ui/chat_init.lua @@ -43,7 +43,8 @@ function M.start_chat(opts) chat.add_message({ role = "assistant", text = string.format( - "Welcome to OpenCode Chat!\n\nType '%s' to send a message. A session will be created if needed.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", + "Welcome to OpenCode Chat!\nConnected to opencode server on port %d\n\nType '%s' to send a message. A session will be created if needed.\n\nKeybindings:\n %s - Send message\n %s - New session\n %s - Close\n %s - Yank message\n %s - Interrupt", + port, send_keys, send_keys, new_session_key, From d4de94d074bd62234e501d339bee265cd202081b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:17:57 +0000 Subject: [PATCH 12/12] Refactor timeout message for better readability Co-authored-by: verlihirsh <6280012+verlihirsh@users.noreply.github.com> --- lua/opencode/ui/chat.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/opencode/ui/chat.lua b/lua/opencode/ui/chat.lua index 207d109..c0459e8 100644 --- a/lua/opencode/ui/chat.lua +++ b/lua/opencode/ui/chat.lua @@ -404,14 +404,14 @@ function M.new_session() -- Only notify if session still hasn't been created if not M.state.session_id then local port_info = M.state.port and (" (port: " .. M.state.port .. ")") or "" - vim.notify( - "Session creation timed out" .. port_info .. ". The opencode server may not be responding. Try:\n" .. - "1. Close this chat and restart opencode server\n" .. - "2. Press 'n' to create a new session\n" .. + local message = table.concat({ + "Session creation timed out" .. port_info .. ".", + "The opencode server may not be responding. Try:", + "1. Close this chat and restart opencode server", + "2. Press 'n' to create a new session", "3. Check if multiple opencode processes are running", - vim.log.levels.WARN, - { title = "opencode" } - ) + }, "\n") + vim.notify(message, vim.log.levels.WARN, { title = "opencode" }) end end end, 10000)