fix(audit): 修复深度审计 P1/P2 问题 — 记忆统一、持久化、前端适配
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
H3: 重写 memory_commands.rs 统一到 VikingStorage 单一存储,移除双写 H4: 心跳引擎 record_interaction() 持久化到 VikingStorage,启动时恢复 M4: 反思结果/状态持久化到 VikingStorage metadata,重启后自动恢复 - HandApprovalModal import 修正 (handStore 替代 gatewayStore) - kernel-client.ts 幽灵调用替换为 kernel_status - PersistentMemoryStore dead_code warnings 清理 - 审计报告和 README 更新至 v0.6.3,完成度 58%→62%
This commit is contained in:
@@ -53,10 +53,10 @@
|
||||
|
||||
| 功能 | 文档声称 | 真实完成度 | 差距模式 | 严重度 |
|
||||
|------|----------|-----------|----------|--------|
|
||||
| **Agent 记忆** | L4 (90%) | **L3 (75%)** | 双存储路径使用不同数据库 | HIGH |
|
||||
| **Agent 记忆** | L4 (90%) | **L4 (85%)** | ~~双存储路径使用不同数据库~~ ✅ 已修复 (H3) — 统一到 VikingStorage | ~~HIGH~~ FIXED |
|
||||
| **身份演化** | L2 (70%) | **L2 (65%)** | SOUL.md 注入已验证,但前端回滚 UI 缺失 | MEDIUM |
|
||||
| **反思引擎** | L2 (65%) | **L2 (55%)** | ~~传入空记忆数组~~ ✅ 已修复 (C2);结果仍未反馈到行为 | ~~MEDIUM~~ PARTIAL |
|
||||
| **心跳引擎** | L2 (70%) | **L1 (35%)** | 默认禁用(enabled=false),无持久化,无定时器 | HIGH |
|
||||
| **反思引擎** | L2 (65%) | **L2 (60%)** | ~~传入空记忆数组~~ ✅ 已修复 (C2);~~结果未持久化~~ ✅ 已修复 (M4);UI 展示仍缺失 | ~~MEDIUM~~ PARTIAL |
|
||||
| **心跳引擎** | L2 (70%) | **L1 (40%)** | ~~无持久化~~ ✅ 已修复 (H4);默认禁用(enabled=false),需前端主动启动 | ~~HIGH~~ PARTIAL |
|
||||
| **自主授权** | L2 (75%) | **L2 (60%)** | 前端组件存在但未在执行链路中调用 canAutoExecute | MEDIUM |
|
||||
| **上下文压缩** | L2 (75%) | **L2 (70%)** | 规则压缩已集成,LLM 压缩存在但默认关闭 | LOW |
|
||||
|
||||
@@ -75,9 +75,9 @@
|
||||
|
||||
| 维度 | 文档声称 | 审计结果 | 修复后 |
|
||||
|------|----------|----------|--------|
|
||||
| **整体** | 68% | **~50%** | **~58%** |
|
||||
| **核心可用** | 85% | **75%** | **~82%** |
|
||||
| **真实可用** | 100% | **~55%**(排除模拟实现和 PromptOnly 技能后) | **~70%** |
|
||||
| **整体** | 68% | **~50%** | **~62%** |
|
||||
| **核心可用** | 85% | **75%** | **~85%** |
|
||||
| **真实可用** | 100% | **~55%**(排除模拟实现和 PromptOnly 技能后) | **~72%** |
|
||||
|
||||
---
|
||||
|
||||
@@ -129,7 +129,9 @@
|
||||
- 短期: UI 明确标注"模拟模式",禁用写操作
|
||||
- 中期: 实现 Twitter API v2 或改为 Mastodon API
|
||||
|
||||
#### H3: 记忆系统双存储路径不同步
|
||||
#### H3: 记忆系统双存储路径不同步 ✅ **已修复**
|
||||
- **修复方案**: 完全重写 `memory_commands.rs`,所有操作统一委派到 VikingStorage (SqliteStorage)。移除了 PersistentMemoryStore 的双写逻辑。保留 PersistentMemory 类型作为前端 API 兼容层,内部通过 `to_persistent()` 转换。
|
||||
- **修复文件**: `memory_commands.rs`, `viking_commands.rs`, `memory/mod.rs`
|
||||
- **路径A**: `memory_commands.rs` → `PersistentMemoryStore` → `{app_data_dir}/memory/memories.db`(UI 面板使用)
|
||||
- **路径B**: `intelligence_hooks.rs` → `VikingStorage` → `{data_dir}/zclaw/memories/memories.db`(聊天流程使用)
|
||||
- **证据**: 两个路径使用**不同的数据库文件**。`memory_store()` 第88-94行虽有双写逻辑,但 `memory_search()` 优先用 VikingStorage,`intelligence_hooks` 也只用 VikingStorage。`memory_db_path()` 返回的是 PersistentMemoryStore 的路径。
|
||||
@@ -137,7 +139,9 @@
|
||||
- **影响**: UI 面板存储的记忆可能无法在聊天时被检索到
|
||||
- **解决方案**: 统一到 `zclaw-growth` 的 SqliteStorage(已有 FTS5 + TF-IDF + 可选 embedding)
|
||||
|
||||
#### H4: 心跳引擎无持久化(已在启动时运行)
|
||||
#### H4: 心跳引擎无持久化(已在启动时运行) ✅ **已修复**
|
||||
- **修复方案**: `record_interaction()` 现在通过 `tokio::spawn` 将交互时间戳持久化到 VikingStorage metadata(key: `heartbeat:last_interaction:{agent_id}`)。`heartbeat_init()` 在初始化时调用 `restore_last_interaction()` 从 VikingStorage 恢复上次交互时间,确保 `idle-greeting` 检查在应用重启后仍能正确工作。
|
||||
- **修复文件**: `heartbeat.rs`
|
||||
- **文件**: `desktop/src-tauri/src/intelligence/heartbeat.rs`
|
||||
- **证据**:
|
||||
- `HeartbeatConfig::default()` 中 `enabled: false`(第103行),但 `App.tsx:181` 主动调用 `heartbeat.start()`
|
||||
@@ -214,7 +218,9 @@
|
||||
- **影响**: 无法按 hand 类型筛选审批
|
||||
- **解决方案**: 实现按 hand_name + run_id 联合查找
|
||||
|
||||
#### M4: 反思引擎结果未反馈到行为
|
||||
#### M4: 反思引擎结果未反馈到行为 ✅ **已修复(持久化部分)**
|
||||
- **修复方案**: `reflect()` 完成后通过 `tokio::spawn` 将 ReflectionState 和 ReflectionResult 持久化到 VikingStorage metadata。新增 `restore_state()` 方法在初始化时从 VikingStorage 恢复状态,确保 `conversations_since_reflection` 计数器在重启后保持。`intelligence_hooks` 在首次 `post_conversation_hook` 时通过 `pop_restored_state/result` 消费恢复数据。
|
||||
- **修复文件**: `reflection.rs`, `intelligence_hooks.rs`
|
||||
- **文件**: `desktop/src-tauri/src/intelligence/reflection.rs:190-233`
|
||||
- **证据**: `reflect()` 基于规则检测模式(task ≥ 5、preference ≥ 5、lesson ≥ 5),生成改进建议,但结果仅存入内存 `history: Vec<ReflectionResult>`(最多保留 20 条),不持久化且不用于修改后续行为。**更严重的是,由于 C1 bug,这些结果永远是空的。**
|
||||
- **差距模式**: 传了没存 + 存了没用
|
||||
|
||||
Reference in New Issue
Block a user