@@ -1048,23 +1048,25 @@ public actor OpenClawChatSQLiteTranscriptCache: OpenClawChatTranscriptCache,
10481048 bindings: [ self . gatewayID, id] )
10491049 else { return . unavailable }
10501050 guard sqlite3_changes ( db) > 0 else { return . unavailable }
1051- let isProven = self . canonicalMessageProofHub. lockProofDecision ( for: messageKey)
1052- defer { self . canonicalMessageProofHub. unlockProofDecision ( ) }
10531051 let result : OpenClawChatOutboxUpdateResult
1054- if isProven {
1055- committed = self . execute ( db, sql: " COMMIT " , bindings: [ ] )
1056- result = committed ? . confirmed : . unavailable
1057- } else {
1058- guard self . removeCachedMessage (
1059- db,
1060- sessionKey: sessionKey,
1061- agentID: Self . transcriptCacheAgentID (
1052+ do {
1053+ let isProven = self . canonicalMessageProofHub. lockProofDecision ( for: messageKey)
1054+ defer { self . canonicalMessageProofHub. unlockProofDecision ( ) }
1055+ if isProven {
1056+ committed = self . execute ( db, sql: " COMMIT " , bindings: [ ] )
1057+ result = committed ? . confirmed : . unavailable
1058+ } else {
1059+ guard self . removeCachedMessage (
1060+ db,
10621061 sessionKey: sessionKey,
1063- agentID: agentID) ,
1064- idempotencyKey: messageKey)
1065- else { return . unavailable }
1066- committed = self . execute ( db, sql: " COMMIT " , bindings: [ ] )
1067- result = committed ? . updated : . unavailable
1062+ agentID: Self . transcriptCacheAgentID (
1063+ sessionKey: sessionKey,
1064+ agentID: agentID) ,
1065+ idempotencyKey: messageKey)
1066+ else { return . unavailable }
1067+ committed = self . execute ( db, sql: " COMMIT " , bindings: [ ] )
1068+ result = committed ? . updated : . unavailable
1069+ }
10681070 }
10691071 if result == . confirmed {
10701072 self . emitOutboxChange ( . confirmed( id: id) )
0 commit comments