Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion examples/opencode-memory-plugin/openviking-memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,19 @@ async function pollCommitTaskOnce(

return task.status
} catch (error: any) {
// If task not found (404/expired), clear commit state so new commits can proceed
if (error.message?.includes("not found") || error.message?.includes("404")) {
log("INFO", "session", "Commit task expired or not found, clearing commit state", {
openviking_session: mapping.ovSessionId,
opencode_session: opencodeSessionId,
task_id: mapping.commitTaskId,
error: error.message,
})
clearCommitState(mapping)
debouncedSaveSessionMap()
return "completed"
}

log("ERROR", "session", "Failed to poll OpenViking background commit", {
openviking_session: mapping.ovSessionId,
opencode_session: opencodeSessionId,
Expand Down Expand Up @@ -1454,7 +1467,7 @@ export const OpenVikingMemoryPlugin = async (input: PluginInput): Promise<Hooks>
role: role,
})
}
} else if (role === "assistant" && finish === "stop") {
} else if (role === "assistant") {
mapping.messageRoles.set(messageId, role)

log("DEBUG", "message", `${role} message completed and role stored`, {
Expand All @@ -1463,6 +1476,15 @@ export const OpenVikingMemoryPlugin = async (input: PluginInput): Promise<Hooks>
role: role,
finish: finish,
})

if (finish && finish !== "stop") {
log("INFO", "message", `assistant message role stored with non-stop finish`, {
session_id: sessionId,
message_id: messageId,
role: role,
finish: finish,
})
}
}

await flushPendingMessages(sessionId, mapping, config)
Expand Down