fix: remove ineffective duplicate attachment cleanup

Keep deletion on the existing IPC attachment cleanup path; remove an unused callback wired to the wrong coordinator and a nonexistent blob-store method. Verified focused conversation deletion test and git diff --check.
This commit is contained in:
Ryder Sun committed 2026-09-15 17:02:26 +08:00
1 parent 9198bf6548
commit 07396fbf29
2 files changed
-14

No files matched your search

@@ -23,7 +23,6 @@ class LocalWorkspaceConversations {
this.isGroupBusy = options.isGroupBusy
this.clearSessionState = options.clearSessionState
this.runLedger = options.runLedger
this.discardAttachments = options.discardAttachments
this.agentLabel = options.agentLabel
this.createId = options.createId
this.now = options.now
@@ -153,17 +152,11 @@ class LocalWorkspaceConversations {
if (!state.groups.some(group => group.id === groupId)) {
throw new Error('LOCAL_GROUP_NOT_FOUND')
}
const attachmentIds = [...new Set(state.messages
.filter(message => message.groupId === groupId)
.flatMap(message => Array.isArray(message.attachments) ? message.attachments : [])
.map(attachment => attachment?.id)
.filter(id => typeof id === 'string'))]
this.commit(() => {
this.clearSessionState(groupId)
state.groups = state.groups.filter(group => group.id !== groupId)
state.messages = state.messages.filter(message => message.groupId !== groupId)
}, () => this.runLedger?.deleteGroup?.(groupId))
this.discardAttachments?.(attachmentIds)
}
deleteMessage(groupId, messageId) {
@@ -217,13 +217,6 @@ class LocalWorkspace extends EventEmitter {
})
this.runLedgerCoordinator = new LocalWorkspaceRunLedger({
runLedger: this.runLedger,
discardAttachments: ids => {
const referenced = new Set(this.state.messages.flatMap(message => (
Array.isArray(message.attachments) ? message.attachments : []
)).map(attachment => attachment?.id).filter(Boolean))
const orphaned = ids.filter(id => !referenced.has(id))
if (orphaned.length) this.contentBlobStore.discard(orphaned)
},
state: () => this.state,
save: () => this.save(),
createId: () => this.createId(),