缺陷 / 高 / 后端服务
electron/harness/hooks/audit-log-hook.ts
AuditLogHook 在 preExecute / postExecute 中直接调用 auditService.log()。 若数据库写入失败(如磁盘满、WAL 锁定),异常会冒泡到 ToolRegistry,导致:
preExecute
postExecute
auditService.log()
AuditHook 应该是 "fire and forget",不应影响主流程。
async preExecute(context) { try { await this.auditService.log({ // ... }); } catch (err) { log.error('[AuditLogHook] Failed to log audit:', err); // 不抛出,让工具继续执行 } }
所有 hook 都应该 try-catch,确保 hook 失败不影响主流程。
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 高 / 后端服务
文件位置
electron/harness/hooks/audit-log-hook.ts问题描述
AuditLogHook 在
preExecute/postExecute中直接调用auditService.log()。若数据库写入失败(如磁盘满、WAL 锁定),异常会冒泡到 ToolRegistry,导致:
AuditHook 应该是 "fire and forget",不应影响主流程。
影响
建议修复
所有 hook 都应该 try-catch,确保 hook 失败不影响主流程。