Implements 123 tasks across 9 phases (T-001..T-809) totaling 146 source files. Monorepo (P0): - 7-package Bun + Turborepo + TypeScript monorepo - dependency-cruiser enforcing 7 forbidden edges + 5 deep-import rules Contracts (P0): - 16 type files (ids/error/event/runtime/ipc/task/worker-result/tool/artifact/evidence/project/provider/permission/ui/capability/platform) Storage & Events (P1): - DatabaseManager + MigrationRunner (19 tables, 22 indexes, 5 schema_meta seeds) - 16 repositories (Repository<T,I,U> pattern, INV-1 status columns via EventStore.project only) - EventSchemaRegistry (54 durable + 7 ephemeral), EventStore, EventBus, EventIngestor - Project/Session/Artifact/Evidence stores + 8-step Recovery Tools & Permission (P2): - PathClassifier (8 categories), CommandRiskAnalyzer (10 categories), SecretRedactor - PermissionEngine 6-layer evaluation (capability→profile→task_scope→risk→credential→user_prompt) - ToolRegistry with 20+ tools across fs/shell/git/project/artifact/context/permission/doctor - CapabilityManifestValidator + CapabilityRegistry LLM & Context (P3): - ModelConfigLoader, CapabilityMatrix, AnthropicCanonicalConverter - AnthropicAdapter + OpenAICompatibleAdapter - ProviderManager facade - PromptLayerLoader (L0/L1/L3/L5), CompactionPolicy, ContextAssembler Worker IPC & Scheduler (P4): - WorkerProtocol (NDJSON), WorkerProcess (exit codes 0-5), WorkerManager (spawn/handshake) - WorkerRuntime (INV-3: IPC only, no direct fs/shell/SQLite) - 5 worker roles (Executor/Reviewer/Debugger/Compactor/ExperienceMiner) - TaskGraph, WavePlanner, RetryPlanner, AgentMonitor, WorkspaceManager - Scheduler (state machine), 8-step Recovery C++ Toolchain (P5): - DiagnosticParser, CppProjectDetector, CMakeConfigurator, CppBuilder - CppTestRunner, CppcheckRunner, ClangdClient - CppToolRegistrar + capability manifest Projection & TUI (P6): - ProjectionStore (hydrate/apply/snapshot/subscribe) - TuiApp + 8 components (Session/Task/Agent/Tool/Diff/Evidence/Permission/Blocker/Hud) - ProjectionClient in-process ref Agents & Knowledge (P7): - MainAgent, ArchitectureDesigner - DebugKnowledgeStore + LearnedMemoryStore (single-writer, outbox model) - Role integration wiring CLI & Doctor & Release (P8): - Logger + DeveloperLogEncryptor (AES-256-GCM) - DoctorService (self_bootstrap first) - RuntimeApp + ServiceRegistry - 11 CLI commands: run/init/doctor/provider/resume/compact/history/session/restore/e2e/release - CliEntrypoint + air<TODO> Audit (in AirPlan/docs/): - Deepseek开发阶段审计.md (97 findings) - Opus开发阶段审计.md (140+ findings, 18 P0 blockers) - MiniMaxM3开发阶段审计.md (18 P0 blockers, focuses on executability) - AirPlan/TODO.md (technical debt + 42 TODOs by phase) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
475 lines
24 KiB
Markdown
Executable File
475 lines
24 KiB
Markdown
Executable File
# AirCoding V1.0.0 Alpha — MiniMax-M3 开发阶段审计报告
|
||
|
||
> **审计员**: MiniMax-M3
|
||
> **审计日期**: 2026-06-02
|
||
> **审计方法**: 2 个独立子代理(无前两份审计引用)
|
||
> **审计依据**: baselineV1 / interface-contracts-v1 / system-overview-design / system-detailed-design §7-§22 / event-registry-v1 / db-schema-v1 / main-agent-state-machine / c4/code-view / error-taxonomy-v1 / tool-registry-v1 / capability-trust-v1
|
||
> **审计范围**: 全部 146 个源文件 (137 TS + 9 TSX) vs 全部规范文档
|
||
|
||
---
|
||
|
||
## 0. 执行摘要
|
||
|
||
### 评级:**C+ — 架构轮廓合规,关键执行路径断的,V1.0.0 Alpha 不应在当前状态下发布**
|
||
|
||
### 三方审计对比
|
||
|
||
| 维度 | DeepSeek | Opus | **M3 (本文档)** |
|
||
|------|----------|------|---------------|
|
||
| 总体评级 | B+ | C+ | **C+** |
|
||
| 阻断级 | 10 | 18 | **18 (P0)** |
|
||
| 严重 | 46 | — | **20+ (P1)** |
|
||
| 侧重 | 问题数量 | 逐字段对照 | **可执行性 + 治理** |
|
||
| 独有发现 | — | 权限旁路 / 状态机终态缺失 | **Scheduler空壳 / TUI无OpenTUI / e2e假报绿 / 退出码错配 / Worker握手反转 / 3个RCE / DeveloperLog对称加密错配spec** |
|
||
|
||
**M3 的独特角度**:前两份审计侧重"代码与规范是否一致",M3 额外关注 **"代码即使符合规范,是否真能跑"** ——发现大量"接口定义清晰、实现是 stub、连接链路不存在"的可执行性阻断。
|
||
|
||
### 18 项 P0 阻断级缺陷速览
|
||
|
||
| # | 缺陷 | 文件:行 | 不变量/规范 |
|
||
|---|------|---------|-----------|
|
||
| 1 | 退出码 4 语义错配(spec 父取消 vs 实现任务阻塞) | WorkerProcess.ts:12-19 | baselineV1 §8 |
|
||
| 2 | WorkerManager 握手顺序反转 + agent.start 缺三件套 | WorkerManager.ts:45-91, 75-80 | contracts §10 |
|
||
| 3 | find_bun shell 命令注入 (test -x ${path}) | WorkerManager.ts:195-209 | baselineV1 §23 |
|
||
| 4 | workers/main.ts 启动即发 ready + 信号走 exit(0) 而非 4 | workers/src/main.ts:33-57, 65-73 | baselineV1 §8 |
|
||
| 5 | **Scheduler 多处 mark_terminal 直接写 tasks.status 绕过事件投影** | Scheduler.ts:128-175, TaskGraph.ts:99-105 | **INV-1 根本违反** |
|
||
| 6 | **Scheduler 不调 WorkspaceManager/WorkerManager/ContextAssembler/EventIngestor** | Scheduler.ts:74-204 | DD §19.1 |
|
||
| 7 | **CMakeConfigurator execSync 字符串拼接 → RCE** | CMakeConfigurator.ts:48 | baselineV1 §23 |
|
||
| 8 | **CppBuilder execSync 字符串拼接 → RCE** | CppBuilder.ts:30 | baselineV1 §23 |
|
||
| 9 | **CppcheckRunner execSync 字符串拼接 → RCE** | CppcheckRunner.ts:36 | baselineV1 §23 |
|
||
| 10 | **ProjectionStore 8 投影只实现 3 个,不处理 ephemeral 事件** | ProjectionStore.ts:11-133 | contracts §17 |
|
||
| 11 | **TUI 不依赖 OpenTUI,render 走 console.log** | TuiApp.tsx:24-82, tui/package.json:18-24 | DD §13.2 |
|
||
| 12 | **MainAgent 状态机缺 7/11 态**(CLASSIFYING/SCHEDULING/...) | MainAgent.ts:13 | main-agent-state-machine.md |
|
||
| 13 | ArchitectureDesigner 不 emit `architecture.plan.updated` | ArchitectureDesigner.ts:57-62 | DD §14.2 |
|
||
| 14 | **INV-2 outbox:debug.record.created / memory.promoted 永不发出** | wiring.ts:35-73 | **INV-2 根本违反** |
|
||
| 15 | DeveloperLogEncryptor 对称加密 + 默认 'dev-key'(spec 要团队公钥) | DeveloperLogEncryptor.ts:22 | baselineV1 §23 |
|
||
| 16 | Doctor.fix 永远返回 ok:false | DoctorService.ts:70-73 | DD §16.1 |
|
||
| 17 | CLI init 直接 fs 写入,绕过 ToolRegistry+PermissionEngine | cli/commands/init.ts:5-7 | **INV-3 根本违反** |
|
||
| 18 | e2e 命令 hardcoded 全 ✅,不跑任何测试 | cli/commands/e2e.ts:6-16 | baselineV1 §24 release gate 形同欺骗 |
|
||
|
||
---
|
||
|
||
## 第一部分:P0 仓库骨架
|
||
|
||
### 评级:✅ 合规 + 仓库卫生存根
|
||
|
||
| 项 | 评级 | 文件 |
|
||
|----|------|------|
|
||
| workspaces 配置 | ✅ | package.json:1-22 |
|
||
| turbo.json 任务依赖 | ✅ | turbo.json:1-19 |
|
||
| bunfig.toml | ✅ | bunfig.toml:1-7 |
|
||
| tsconfig 路径别名 | ✅ | tsconfig.base.json:1-32 |
|
||
| 7 包依赖方向全部正确 | ✅ | 各 package.json |
|
||
| dependency-cruiser 7 forbidden + 5 deep-import 规则 | ✅ | .dependency-cruiser.js |
|
||
| **根 tsconfig.tsbuildinfo 1.4MB 留仓库** | 🔧 | 根目录 |
|
||
| **packages/*/node_modules** | 🔧 | 应在 .gitignore |
|
||
|
||
**M3 强项**:7 个包的 `package.json` 依赖方向**完全符合 c4/module.md**:
|
||
- contracts: 0 deps (leaf)
|
||
- llm/tui/toolchain-cpp/workers: 仅 → contracts
|
||
- runtime: → contracts + llm
|
||
- cli: → contracts + runtime + tui + llm + toolchain-cpp(无 → workers,符合 c4 规则)
|
||
|
||
---
|
||
|
||
## 第二部分:P1 合约 / 存储 / 事件 / 项目 / 会话 / 制品
|
||
|
||
### 评级:🟢 整体合规,存储层有 4 项 P0
|
||
|
||
### 2.1 Contracts(packages/contracts/src/)
|
||
|
||
16 个文件**忠实编码**了 interface-contracts-v1 §2-§22 全部规范。**这是全项目最合规的部分**。
|
||
|
||
| 区块 | 状态 | 详情 |
|
||
|------|------|------|
|
||
| §2-§5 IDs/Errors/EntityRef/RuntimeEvent | ✅ | 完全一致 |
|
||
| §8 Project/Session | ✅ | 一致 |
|
||
| §9 Task/Scheduler | ✅ | 一致 |
|
||
| §10 IPC | ✅ | IpcDirection/IpcEnvelope/IpcKind/WorkerRole/WorkerRuntime |
|
||
| §11 WorkerResult | ✅ | 5 角色结果齐全 |
|
||
| §12 Tool | ✅ | 16 类别 + PermissionSpec/PathPolicy |
|
||
| §13 Permission | ✅ | Action/GrantScope/RiskLevel/Decision/Engine |
|
||
| §14 Artifact/Evidence | ✅ | 一致 |
|
||
| §15 Provider | ✅ | 17 字段 supports + 5 字段 conversion |
|
||
| §17 Projection/UI | ✅ | 8 投影 + ProjectionStore/Client + UiCommandChannel |
|
||
| §18 Capability | ✅ | 5 信任级别 + ManifestV1 |
|
||
| §19 Doctor/Logger | ✅ | DoctorRunInput/Output + Logger + DeveloperLogEncryptor |
|
||
| §20 DebugRecord/LearnedMemory | ✅ | 字段一致 |
|
||
|
||
### 2.2 存储层 4 项 P0 阻断
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `EventStore.ts:900,909` | workspace 投影写 `status:'created'/'merging'`,不在闭合枚举 → assertEnum 抛错 |
|
||
| 2 | `DebugKnowledgeStore.ts:30,42-56` | 路径 `.air/shared` 应 `.air/local`;列集合偏离 db-schema §20 |
|
||
| 3 | `LearnedMemoryStore.ts:31,40-55` | 表名 `learned_memory` 应 `learned_memories`;列偏离 |
|
||
| 4 | `EventRepository.ts:185` | `route_prefix.join('.')` 拼接,但存储用 `/` 拼接(toRecord:462)→ 多段路由前缀过滤永久失效 |
|
||
|
||
### 2.3 事件系统
|
||
|
||
| 项 | 评级 | 详情 |
|
||
|----|------|------|
|
||
| 54 持久 + 7 短暂事件 | ✅ | EventSchemaRegistry.ts:37-129 程序化零差异 |
|
||
| EventStore.project 30+ 投影 | ✅ | 覆盖 11 大类 |
|
||
| eventBus.publish post-commit | ✅ | EventStore.ts:377,420 INV-5 通过 |
|
||
| project() 唯一 status 写入点 | ✅ | EventStore.ts:492-933 INV-1 通过 |
|
||
| context.compaction.* 投影 | ❌ | 4 事件落入 default |
|
||
| 投影非法枚举 | ❌ | P0-#1 |
|
||
| route_prefix 查询 bug | ❌ | P0-#4 |
|
||
|
||
### 2.4 不变量证据
|
||
|
||
| INV | 评级 | 证据 |
|
||
|-----|------|------|
|
||
| INV-1 | ⚠️ | Projector 内 status 写入唯一,但 P4 Scheduler 旁路(见 P0-#5) |
|
||
| INV-2 | ⚠️ | EventStore.project 不开外部 DB ✓;但 P7 outbox 事件未发(见 P0-#14) |
|
||
| INV-3 | ✅ | 静态层遵守,但 CLI init/RuntimeApp shutdown/CppBuilder 旁路(见 P0-#17, P5-#1, P5-#2) |
|
||
| INV-4 | ✅ | dependency-cruiser 7 规则覆盖,零违规 |
|
||
| INV-5 | ✅ | eventBus.publish 全部 post-commit |
|
||
|
||
---
|
||
|
||
## 第三部分:P2 安全 / 工具 / 能力
|
||
|
||
### 评级:🟠 4 项 P0(编译期阻塞)+ 7 项 P1(spec 错位)
|
||
|
||
### 3.1 4 项 P0 编译期阻塞
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `security/PermissionEngine.ts:481` | 访问不存在的 `decision.redacted` 字段,TS 编译失败 |
|
||
| 2 | `security/PermissionEngine.ts:11`, `tools/ToolRegistry.ts:10` | `import { ToolCall }` 未在 contracts 导出(TS2305) |
|
||
| 3 | `tools/ToolRegistry.ts:331-338` | create_error_result 返回字段 `{call_id, tool_name, type, content}`,应为 `ToolResultEnvelope` 的 `{status, output, error, artifact_ids, evidence_ref_ids}` |
|
||
| 4 | `toolchain-cpp/src/capability.ts:11-67` | `name` 应为 `capability_id`;`trust_level: 'local'` 不在 spec 5 枚举 |
|
||
|
||
### 3.2 7 项 P1 spec 错位
|
||
|
||
| # | 文件:行 | spec vs 实现 |
|
||
|---|---------|---------|
|
||
| 5 | `PermissionEngine.ts:19-26`, `ToolRegistry.ts:36-98` | PermissionAction 6 值错位(spec `ask_user/block/refuse/announce_then_run` vs 实现 `prompt/read_only/sandbox/audit_log`) |
|
||
| 6 | `PathClassifier.ts:13-22` | 8 类别命名分裂(spec 9 类别,缺 `project_air_shared / project_air_local / project_git_internal / credential_or_secret`) |
|
||
| 7 | `CommandRiskAnalyzer.ts:12-22` | 10 类别命名分裂(spec `read_only/build/test/static_analysis/git_read/git_write/destructive/network/system_sensitive/credential_sensitive`) |
|
||
| 8 | `llm/ProviderManager.ts:11-14` | `ModelRequirement/ModelAssignment/StreamEvent` 本地定义,与 contracts §15 不兼容 |
|
||
| 9 | `llm/CapabilityMatrix.ts:10-28` | 4 bool + 2 int vs spec 17 字段 `ProviderSupports` + 5 字段 `ProviderConversion` |
|
||
| 10 | `BuiltInToolRegistrar.ts:33-68` | 28 MVP 工具缺 8 个(fs.stat / process.kill / git.worktree.create / git.merge_workspace / project.scan / project.profile.write / permission.request / doctor.run) |
|
||
| 11 | `toolchain-cpp/capability.ts:51-65` | `cpp.cppcheck/clangd` 应为 `cpp.static.cppcheck/cpp.clangd.query` |
|
||
|
||
### 3.3 工具执行流
|
||
|
||
- ToolRegistry 7 步流程(lookup → validate → permission ctx → evaluate → branch → execute → record)符合 contracts §13
|
||
- 6 个 Action 分支定义但**缺 4 个 spec 值**(#5)
|
||
- `read_before_edit` + `expected_existing_sha256` 在 fs.edit/fs.write 中已实现(对齐 Claude Code 行为基线)
|
||
|
||
---
|
||
|
||
## 第四部分:P3 LLM / Context / Provider
|
||
|
||
### 评级:🟠 CapabilityMatrix 字段严重偏离 spec
|
||
|
||
| 项 | 评级 | 详情 |
|
||
|----|------|------|
|
||
| ModelConfigLoader | ✅ | 配置加载正确 |
|
||
| AnthropicCanonical | ✅ | 4 content blocks + ConversionReport.dropped_fields 满足 §23 无静默丢失 |
|
||
| AnthropicAdapter | ✅ | 完整实现 |
|
||
| OpenAICompatibleAdapter | ✅ | 完整实现 |
|
||
| ProviderManager | ⚠️ | 本地 ModelRequirement/ModelAssignment 与 contracts §15 不兼容(#8) |
|
||
| CapabilityMatrix | ❌ | 4+2 字段 vs spec 22 字段(#9) |
|
||
| PromptLayerLoader | ✅ | 4 方法齐全 |
|
||
| CompactionPolicy | ✅ | should_compact + compact |
|
||
| ContextAssembler | ✅ | 5 层收集,发出 `context.compaction.requested` |
|
||
|
||
---
|
||
|
||
## 第五部分:P4 Worker IPC / Scheduler / Recovery
|
||
|
||
### 评级:🔴 7 项 P0 — 整套调度形同空壳
|
||
|
||
#### 5.1 Worker IPC(4 项 P0)
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `WorkerProcess.ts:12-19` | **退出码 4 语义错配**(spec 父取消 vs 实现任务阻塞) |
|
||
| 2 | `WorkerManager.ts:45-91` | **握手顺序反转**(应 parent→agent.start→worker.ready,实现先等 ready) |
|
||
| 3 | `WorkerManager.ts:75-80` | agent.start 载荷**缺 task_spec/context_pack/runtime 三件套** |
|
||
| 4 | `WorkerManager.ts:195-209` | find_bun shell 注入(test -x ${path}) |
|
||
| 5 | `workers/main.ts:33-57,65-73` | 启动即发 ready + SIGTERM 走 exit(0) 而非 4 |
|
||
|
||
#### 5.2 Scheduler(3 项 P0)
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 6 | `Scheduler.ts:128-175, TaskGraph.ts:99-105` | **mark_terminal 直接写 tasks.status 绕过事件投影**——INV-1 根本违反 |
|
||
| 7 | `Scheduler.ts:74-204` | **不调 WorkspaceManager/WorkerManager/ContextAssembler/EventIngestor**——整套调度形同空壳 |
|
||
| 8 | `Scheduler.ts:18-30` | 缺 BLOCKED/CANCELLED 终态,多了自创 TERMINATED |
|
||
|
||
#### 5.3 Recovery
|
||
|
||
8 步中实际只 3 个 stub 工作:FK-off 8 不变量和 PID liveness 都是 no-op。`readdirSync/statSync` 直接导入绕开 ToolRegistry(INV-3 争议点)。
|
||
|
||
#### 5.4 WorkerRole 角色实现
|
||
|
||
5 个角色全部是 stub,返回 shape 与 spec §11 `WorkerResult<TResult>` 不一致。
|
||
- ExecutorRole: `shell.run('echo "stub"')` 凑出 passed:true
|
||
- ReviewerRole: push 一条 info 假 finding
|
||
- DebuggerRole: 永远 cannot_reproduce
|
||
- CompactorRole: token 算法固定 0.4 倍
|
||
- ExperienceMinerRole: 一条 stub entry
|
||
|
||
#### 5.5 WorkerRuntime INV-3
|
||
|
||
**正面**:grep 验证无 fs/child_process/net/sqlite/bun:sqlite/database 导入,workers 静态边界干净。
|
||
|
||
---
|
||
|
||
## 第六部分:P5 C++ 工具链
|
||
|
||
### 评级:🔴 3 项 P0 RCE + 1 项 P0 capability 字段错位
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `CMakeConfigurator.ts:48` | **execSync(\`cmake ${...} ${project_root}\`)** — shell 字符串拼接 RCE |
|
||
| 2 | `CppBuilder.ts:30` | **execSync(\`cmake --build .${target_arg}\`)** — target 注入 RCE |
|
||
| 3 | `CppcheckRunner.ts:36` | **execSync(\`cppcheck ${...} ${project_root}\`)** — RCE |
|
||
| 4 | `CppToolRegistrar.ts:32-95` | tool permission 字段 `{read, write, network}` 不匹配 spec `ToolPermissionSpec`(`read_paths/write_paths/execute/network/system_sensitive/credentials`)→ **CommandRiskAnalyzer 10 分类被完全绕过** |
|
||
| 5 | `capability.ts:11-67` | manifest 形状错(name→capability_id;trust_level:'local' 不在 spec 枚举) |
|
||
| 6 | `ClangdClient.ts:26-37` | LSP 客户端完全 stub(2 方法都返回 not yet implemented) |
|
||
| 7 | `CppProjectDetector.ts:67-72` | command_exists 仅查 /usr/bin;find_cpp_sources 永远 [] |
|
||
| 8 | `DiagnosticParser.ts:62-67` | semantic_signature 32-bit 哈希冲突率高 |
|
||
| 9 | `CMakeConfigurator.ts:42` | 缺 ninja 优先 make 回退逻辑 |
|
||
| 10 | 整体 6 cpp.* 工具 | 经 CapabilityRegistry 注册(INV-4 通过),但 3 个 build 类有 RCE,权限字段错位使 PermissionEngine 失效 |
|
||
|
||
---
|
||
|
||
## 第七部分:P6 Projection / TUI
|
||
|
||
### 评级:🔴 3 项 P0 — TUI 形同空壳
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `ProjectionStore.ts:11-133` | **不实现 contracts.ProjectionStore**;8 投影只实现 3 个(task/agent/session),缺 tool_runs/command_runs/artifacts/permission_prompts/blockers |
|
||
| 2 | `TuiApp.tsx:24-82` | render 走 console.log;start 不初始化 OpenTUI renderer |
|
||
| 3 | `tui/package.json:18-24` | **完全缺 @opentui/solid @opentui/core @opentui/keymap** 依赖 |
|
||
| 4 | `ProjectionClient.ts:10-38` | 不实现 contracts.ProjectionClient;receive_snapshot 无任何调用者 |
|
||
| 5 | `ProjectionStore.ts:70-98` | apply 只 switch 5 个错误的事件名(task.status.changed 等不存在事件) |
|
||
| 6 | `tui/types.ts:13-37` | 自创 SessionProjection/TaskProjection/AgentProjection,字段名 task_id→id 与 contracts 不一致 |
|
||
| 7 | 8 组件 | 全部返回 string 的 stub,非 Solid/JSX |
|
||
|
||
**正面**:TUI 模块导入方向干净(仅 contracts + 本包),INV-4 通过。
|
||
|
||
---
|
||
|
||
## 第八部分:P7 Agents / Knowledge
|
||
|
||
### 评级:🔴 2 项 P0 (INV-2 + MainAgent)
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `wiring.ts:35-73` | **capture_debug_record / promote_memory_entry 注释说 emit 但完全没 emit** `debug.record.created` / `memory.promoted`——INV-2 根本违反 |
|
||
| 2 | `MainAgent.ts:13` | **状态机只 6/11 态**:缺 CLASSIFYING / SCHEDULING / ARCHITECTURE_DESIGNING / CONFIRMING / EXECUTING / INTERRUPTING / ARCHITECTURE_REVISING |
|
||
| 3 | `MainAgent.ts:64-80` | classify 用正则而非 LLM |
|
||
| 4 | `MainAgent.ts:97-102` | summarize 压成 no-op,未触发 ExperienceMiner 子任务 |
|
||
| 5 | `ArchitectureDesigner.ts:57-62` | `update_architecture_docs` 空函数,不 emit `architecture.plan.updated`,不调 ProviderManager |
|
||
| 6 | `wiring.ts:36-46, 59` | DebugRecord/LearnedMemory 字段名与 contracts §20 不一致 |
|
||
| 7 | `ArchitectureDesigner.ts:64-75` | identify_affected_components 粗粒度 string match |
|
||
| 正面 | `ArchitectureDesigner` 4 结果类型 | silent_continue/requires_user_confirmation/requires_replan/reject_or_escalate ✓ |
|
||
|
||
---
|
||
|
||
## 第九部分:P8 Logging / Doctor / RuntimeApp / CLI
|
||
|
||
### 评级:🔴 5 项 P0(含 1 项设计错配 spec)
|
||
|
||
| # | 文件:行 | 问题 |
|
||
|---|---------|------|
|
||
| 1 | `DeveloperLogEncryptor.ts:22` | **对称 AES-256-GCM + 默认 'dev-key'**——spec baselineV1 §23 要求开发团队**公钥**非对称加密;当前设计性错配,团队无法解 developer log |
|
||
| 2 | `DoctorService.ts:70-73` | `fix` 永远返回 ok:false——spec §11 "First startup always asks before doctor --fix" 完全没实现 |
|
||
| 3 | `cli/commands/init.ts:5-7` | **直接 mkdirSync/writeFileSync 绕过 ToolRegistry+PermissionEngine**——INV-3 根本违反 |
|
||
| 4 | `cli/commands/e2e.ts:6-16` | **hardcoded 全 ✅ 不跑任何测试**——release gate 形同欺骗 |
|
||
| 5 | `cli/commands/init.ts:39-40` | project_id 用 `Date.now().toString(36)` 而非 spec 的 stable UUID(同一秒内重 init 撞 id) |
|
||
| 6 | `RuntimeApp.ts:25-65` | 不通过 ServiceRegistry;start 仅 doctor self_bootstrap + logger,不 hydrate ProjectionStore / 不 rebuild Scheduler / 不 run Recovery |
|
||
| 7 | `Logger.ts:25-37` | 只写 air.log,air.developer.log 一边空;两模块无联动 |
|
||
| 8 | `DoctorService.ts:86,89,106,110,114` | 5 个 check 硬编码 passed:true |
|
||
| 9 | `CLI 7 命令` | compact/restore/resume/history/session/release 全部 stub |
|
||
| 10 | `loadConfig.ts:1-50` | 读 `~/.air/config.json` 而 spec 是 `~/.air/config.yaml` |
|
||
| 正面 | `cli/src/index.ts:35-101` | 11 个命令入口路由齐备 ✓ |
|
||
| 正面 | `provider.ts` | 只读 list/current ✓ |
|
||
|
||
---
|
||
|
||
## 第十部分:三方审计对比
|
||
|
||
### 10.1 评级对比
|
||
|
||
| 维度 | DeepSeek | Opus | **M3** |
|
||
|------|----------|------|--------|
|
||
| 总体评级 | B+ | C+ | **C+** |
|
||
| 阻断级 | 10 | 18 | **18 (P0)** |
|
||
| 侧重 | 问题数量 | 逐字段对照 | **可执行性 + 治理** |
|
||
|
||
### 10.2 独有发现交叉表
|
||
|
||
| 发现 | DeepSeek | Opus | M3 |
|
||
|------|----------|------|---|
|
||
| ToolRegistry 权限旁路 | ❌ | ✅ | ⚠️(部分) |
|
||
| ACTION_BRANCHES this 崩溃 | ❌ | ✅ | ❌ |
|
||
| Workspace 投影非法枚举 | ❌ | ✅ | ✅ |
|
||
| 退出码 4 错配 | ❌ | ❌ | ✅ |
|
||
| 3 个 RCE | ⚠️ | ✅ | ✅ |
|
||
| Worker 握手反转 | ❌ | ❌ | ✅ |
|
||
| agent.start 缺三件套 | ❌ | ❌ | ✅ |
|
||
| **Scheduler 形同空壳** | ❌ | ❌ | ✅ |
|
||
| **TUI 无 OpenTUI 依赖** | ⚠️ | ✅ | ✅ |
|
||
| **MainAgent 缺 7 态** | ⚠️ | ✅ | ✅ |
|
||
| **e2e 假报绿** | ❌ | ❌ | ✅ |
|
||
| **DeveloperLog 对称错配 spec** | ❌ | ❌ | ✅ |
|
||
| ProjectionClient↔Store 断开 | ❌ | ✅ | ✅ |
|
||
| Route_prefix 查询 bug | ❌ | ✅ | ✅ |
|
||
| Project_id Date.now 错 | ❌ | ❌ | ✅ |
|
||
| Toolchain permission 字段错 | ❌ | ✅ | ✅ |
|
||
|
||
### 10.3 共识(三个审计都同意)
|
||
|
||
- **INV-2 outbox 事件不发出**(最关键的系统性问题)
|
||
- **INV-3 多处旁路**(CLI init / CppBuilder / CppProjectDetector 等)
|
||
- **3 个 RCE 漏洞**(CMakeConfigurator / CppBuilder / CppcheckRunner)
|
||
- **合约漂移**:下游包自定类型不 import 契约
|
||
- **存根率高**(~15% 方法是 stub)
|
||
- **测试覆盖 <5%**
|
||
|
||
### 10.4 分歧点
|
||
|
||
- **DeepSeek B+ 偏乐观**:把"文件齐全、骨架完整"等同于"可发布"
|
||
- **Opus C+ 聚焦规范对照**:把"逐字段不符"作为评级核心
|
||
- **M3 C+ 聚焦可执行性**:额外关注"接口在但连接链路断"的执行性阻断
|
||
|
||
---
|
||
|
||
## 第十一部分:M3 独立总评
|
||
|
||
### 核心判断
|
||
|
||
> **V1.0.0 Alpha 不应在当前状态下发布**。
|
||
> 模块边界、合约、依赖方向**架构轮廓合规**;
|
||
> 但**关键路径执行逻辑**(调度 / TUI / Worker IPC / toolchain shell / CLI init / ArchitectureDesigner / outbox 事件 / Doctor fix / E2E)**全部是断的**。
|
||
> 至少 18 项 P0 必须修复,10+ 项 P1 严重缺陷需配套真实 E2E 套件代替 hardcoded ✅。
|
||
|
||
### 实现完成度估算
|
||
|
||
| 维度 | 完成度 |
|
||
|------|--------|
|
||
| Contracts 字段覆盖 | ~98% |
|
||
| Storage 19 表 + 22 索引 + 16 仓储 | ~100% |
|
||
| 事件 schema 注册 54+7 | ~99% |
|
||
| 事件投影 30+ 类型 | ~95% |
|
||
| 6 层 PermissionEngine | ~95% |
|
||
| PathClassifier 8 vs 9 类别 | ~60% |
|
||
| CommandRiskAnalyzer 10 vs 10 类别 | ~70% |
|
||
| 28 MVP 工具(20/28) | ~71% |
|
||
| LLM provider + canonical | ~85% |
|
||
| Toolchain C++ 6 工具 | ~85% |
|
||
| TUI 边界(只 import contracts) | ~100% |
|
||
| Worker 边界(只 import contracts) | ~100% |
|
||
| CLI 边界 | ~100% |
|
||
| Dependency cruiser 规则 | ~100% |
|
||
| **关键路径执行(调度/TUI/Worker/toolchain/CLI init)** | **<30%** |
|
||
| **E2E 测试(e2e 命令假报绿)** | **0%** |
|
||
|
||
### 整改优先级
|
||
|
||
#### P0 — 立即修(阻断 GA)
|
||
|
||
1. **Scheduler**(#5, #6):重写状态机,所有 status 变更走 EventStore.project;接入 WorkspaceManager/WorkerManager/ContextAssembler/EventIngestor
|
||
2. **Worker IPC**(#1-#4):修退出码 4 语义、反转握手顺序、补 agent.start 三件套、消除 find_bun shell 注入
|
||
3. **3 个 RCE**(#7-#9):CMakeConfigurator / CppBuilder / CppcheckRunner 改用 execFileSync + args 数组
|
||
4. **TUI**(#11):添加 @opentui/* 依赖,render 接入 OpenTUI,ProjectionClient↔Store 建立推送链路
|
||
5. **MainAgent**(#12):补 7 个状态 + LLM classify + Scheduler/ProviderManager/ContextAssembler 集成
|
||
6. **INV-2 outbox**(#14):wiring/stores 注入 EventIngestor,真实发出 debug.record.created / memory.promoted
|
||
7. **CLI init**(#17):改为 RuntimeApp→ToolRegistry→PermissionEngine 路径
|
||
8. **e2e 假报绿**(#18):替换为真实测试套件
|
||
9. **DeveloperLogEncryptor**(#15):改用团队公钥(asymmetric)+ 真实 KDF
|
||
10. **Capability manifest / PathClassifier / CommandRiskAnalyzer**(#4, #6, #7):与契约对齐
|
||
|
||
#### P1 — 严重(阻塞 E2E 验证或稳定运行)
|
||
|
||
- 5 个 WorkerRole 真实实现
|
||
- 8 个 TUI 组件改为 Solid/JSX
|
||
- ArchitectureDesigner emit 事件 + LLM 调用
|
||
- DoctorService fix / bundle 实现
|
||
- ProjectionStore 8 投影齐全
|
||
- Recovery 8 步实际工作
|
||
- Logger + DeveloperLogEncryptor 联动
|
||
- RuntimeApp 通过 ServiceRegistry
|
||
- 8 个 MVP 工具补齐
|
||
|
||
#### P2 — 中等
|
||
|
||
- DiagnosticParser MSVC + 改进哈希
|
||
- ClangdClient LSP 真实实现
|
||
- CppProjectDetector PATH 检测 + find_cpp_sources
|
||
- WavePlanner 按 TaskScope.write_area 提取
|
||
|
||
#### P3 — 治理
|
||
|
||
- 删除 hardcoded e2e ✅
|
||
- 删除硬编码 'dev-key'
|
||
- 删除 init 的 Date.now() project_id
|
||
- 实跑 E2E 套件
|
||
|
||
### 治理建议
|
||
|
||
1. **立即冻结新特性开发**,转入"先修 P0"阶段
|
||
2. **建立 CI 强制检查**:
|
||
- `tsc --noEmit` 通过
|
||
- `dependency-cruiser` 7 forbidden 规则零违规
|
||
- 真实 E2E 套件(非 hardcoded)通过
|
||
3. **核心路径连通性专项验证**:
|
||
- 一次完整 dispatch → worker spawn → tool call → result → event projection → projection update → TUI render
|
||
4. **安全问题红线**:
|
||
- 任何 `execSync` 必须改 `execFileSync`
|
||
- 任何 `--dev-key` 默认值必须改为强制环境变量
|
||
- 任何 shell 字符串拼接必须改 args 数组
|
||
|
||
---
|
||
|
||
## 附录
|
||
|
||
### A. 审计方法论
|
||
|
||
派发 2 个独立 general-purpose 子代理(不引用前两份审计结论):
|
||
- **代理 1** (P0-P3): 143K tokens, 88 工具调用
|
||
- **代理 2** (P4-P8): 125K tokens, 108 工具调用
|
||
|
||
每个代理:
|
||
1. 完整阅读对应规范文档(不依赖前审计)
|
||
2. 逐文件对照实现
|
||
3. 输出 ✅/⚠️/❌/🔧 评级 + 精确文件:行
|
||
4. 独立汇总阻断级缺陷
|
||
5. 独立给出 M3 评级
|
||
|
||
### B. 与前两份审计的关系
|
||
|
||
本审计**不参考** DeepSeek 和 Opus 审计的任何结论,但最终发现在很多关键点(INV-2 outbox / 3 个 RCE / capability 字段错位 / 投影事件名错位)上**与 Opus 审计完全独立地得出相同结论**——这增强了对这些缺陷的置信度。
|
||
|
||
同时 M3 的**独有发现**集中在:
|
||
- **执行链路连通性**(Scheduler/TUI/Worker/ProjectionClient 之间的"接口在但连接断")
|
||
- **设计错配 spec**(DeveloperLog 对称加密 vs spec 公钥)
|
||
- **治理失败**(e2e 假报绿、CLI init 绕 INV-3、project_id Date.now 而非 UUID)
|
||
- **可执行性阻断**(退出码 4 错配、握手反转、agent.start 缺三件套)
|
||
|
||
### C. 词汇表
|
||
|
||
| 术语 | 含义 |
|
||
|------|-------|
|
||
| P0 阻断 | 必须修复才能进入 GA 的硬性缺陷 |
|
||
| P1 严重 | 阻塞 E2E 验证或稳定运行的严重缺陷 |
|
||
| P2 中等 | 影响可维护性/可扩展性的中等缺陷 |
|
||
| P3 轻微 | 命名/小 bug/卫生问题 |
|
||
| RCE | 远程代码执行 (Remote Code Execution) |
|
||
| outbox | "外部写入→发出完成事件" 模式保证跨存储一致性 |
|
||
| 投影 (Projection) | 事件→领域状态的派生视图 |
|
||
|
||
---
|
||
|
||
**报告结束** — 共发现 18 项 P0 阻断级 + 20+ 项 P1 严重 + 中等/轻微若干。
|
||
**M3 结论**:V1.0.0 Alpha 在当前状态下**不应发布**。先修 P0,再考虑 GA。
|