Skip to content

Commit db5ab7b

Browse files
Danilo Verde RibeiroDanilo Verde Ribeiro
authored andcommitted
fix(ui): remove assistant_mode backfill to preserve historical mode labels
The backfill loop was seeding from state.current_mode and stamping all historical assistant messages without assistant_mode, causing every message to show the current mode's name on restart rather than the mode used at that point in time. Removed lines 35-46 (backfill loop). Historical messages without assistant_mode now display as generic 'ASSISTANT' via existing fallback logic in _format_message_header (lines 299-304). This preserves immutability of stored assistant_mode values and prevents cross-session pollution.
1 parent 9a59aaf commit db5ab7b

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

lua/opencode/ui/session_formatter.lua

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@ function M.format_session(session)
3232
M.output:add_line('')
3333
M.output:add_line('')
3434

35-
-- Backfill assistant_mode for all assistant messages once so names remain stable
36-
local last_seen_mode = state.current_mode
37-
for _, amsg in ipairs(state.messages) do
38-
if amsg.role == 'assistant' then
39-
if amsg.assistant_mode and amsg.assistant_mode ~= '' then
40-
last_seen_mode = amsg.assistant_mode
41-
else
42-
amsg.assistant_mode = last_seen_mode or state.current_mode or 'assistant'
43-
last_seen_mode = amsg.assistant_mode
44-
end
45-
end
46-
end
47-
4835
for i, msg in ipairs(state.messages) do
4936
M.output:add_lines(M.separator)
5037
state.current_message = msg

0 commit comments

Comments
 (0)