Skip to content

Commit 82cf73e

Browse files
Danilo Verde RibeiroDanilo Verde Ribeiro
authored andcommitted
fix: show current mode for latest assistant message when assistant_mode is missing
Display-time fallback for the most recent assistant message to show the current mode name when assistant_mode field hasn't been stamped yet. This fixes new messages showing generic 'ASSISTANT' instead of the active mode label (e.g., 'NEOAGENT'). Historical messages remain unchanged, preserving their original mode labels or showing generic 'ASSISTANT' for old messages created before mode tracking was added.
1 parent db5ab7b commit 82cf73e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lua/opencode/ui/session_formatter.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,14 @@ function M._format_message_header(message, msg_idx)
300300
if mode and mode ~= '' then
301301
display_name = mode:upper()
302302
else
303-
display_name = 'ASSISTANT'
303+
-- For the most recent assistant message, show current_mode if assistant_mode is missing
304+
-- This handles new messages that haven't been stamped yet
305+
local is_last_message = msg_idx == #state.messages
306+
if is_last_message and state.current_mode and state.current_mode ~= '' then
307+
display_name = state.current_mode:upper()
308+
else
309+
display_name = 'ASSISTANT'
310+
end
304311
end
305312
else
306313
display_name = role:upper()

0 commit comments

Comments
 (0)