Skip to content

Commit ce93483

Browse files
committed
fix(git_review): try to find message with a real snapshot
Only relying on last_message to find a snapshot was often triggering a `No changes to review` message since the LLM usually does a summary with no snapshots at the end Not I try to find a snapshot starting from the top.
1 parent 8f1c8fd commit ce93483

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lua/opencode/git_review.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,13 @@ M.get_first_snapshot = require_git_project(function()
129129
vim.notify('No active session found.')
130130
return nil
131131
end
132-
local snapshots = session.get_message_snapshot_ids(state.current_message)
133132

134-
return snapshots and snapshots[1] or nil
133+
for _, msg in ipairs(state.messages or {}) do
134+
local snapshots = session.get_message_snapshot_ids(msg)
135+
if snapshots and #snapshots > 0 then
136+
return snapshots[1]
137+
end
138+
end
135139
end)
136140

137141
M.review = require_git_project(function(ref)

0 commit comments

Comments
 (0)