fix: re-read fresh messages before empty scan & dedup isRecord import
- Re-read messages from SDK after injectTextPartAsync to prevent stale snapshot from causing duplicate placeholder injection (P2) - Replace local isRecord with shared import from record-type-guard (P3)
This commit is contained in:
parent
c799584e61
commit
106cd5c8b1
@ -91,7 +91,8 @@ export async function recoverEmptyContentMessageFromSDK(
|
||||
}
|
||||
}
|
||||
|
||||
const emptyMessageIDs = findEmptyMessagesFromSDK(messages)
|
||||
const freshMessages = await readMessagesFromSDK(client, sessionID)
|
||||
const emptyMessageIDs = findEmptyMessagesFromSDK(freshMessages)
|
||||
for (const messageID of emptyMessageIDs) {
|
||||
if (
|
||||
await dependencies.replaceEmptyTextPartsAsync(
|
||||
|
||||
@ -4,13 +4,10 @@ import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import type { StoredMessageMeta } from "../types"
|
||||
import { getMessageDir } from "./message-dir"
|
||||
import { isSqliteBackend } from "../../../shared"
|
||||
import { isRecord } from "../../../shared/record-type-guard"
|
||||
|
||||
type OpencodeClient = PluginInput["client"]
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null
|
||||
}
|
||||
|
||||
function normalizeSDKMessage(
|
||||
sessionID: string,
|
||||
value: unknown
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user