修复: BUG-260620-05 工程内路径弹窗 + G1 多目标累积 + 测试编译债

- BUG-260620-05: reload_allowed_dirs 无条件插入 workspace_root,工程内路径免授权
- G1: pinned_goal → pinned_goals Vec<String>,多目标追加去重 + MAX_GOALS=5
- tool_registry.rs 测试 4 处补 data_dir 形参
- 更新 todo.md / docs/todo.md 状态
This commit is contained in:
2026-06-27 22:02:19 +08:00
parent 9c3f27f4ca
commit 6e1485e4f9
8 changed files with 120 additions and 105 deletions

View File

@@ -436,8 +436,8 @@ pub struct AppState {
///
/// - Phase A:`persistent`(持久化白名单,从 Settings KV `allowed_dirs` 加载,
/// JSON 数组 `["E:/wk-lab/u-abc"]`)。`resolve_workspace_path` 校验时:
/// - workspace_root 始终视为已授权(向后兼容,默认根)
/// - 任一 persistent 目录 starts_with 命中即放行
/// - 任一 persistent 或 session 目录 starts_with 命中即放行
/// - 无任何授权时全部拒绝(引导用户绑定项目或授权目录)
/// - Phase B:`session`(进程级会话临时授权,弹窗"仅本次"写入;切换/新建/删除会话清空)。
/// 单用户桌面应用 active_conversation_id 单全局模型,session 字段随 active 切换清空,
/// 行为等价"当前活跃会话的临时授权"。handler 闭包(read lock 取快照)与
@@ -574,7 +574,7 @@ pub(crate) fn is_in_system_blacklist(path: &Path) -> bool {
/// F-260619-03 Phase B/C: 路径授权预校验(供 process_tool_calls 分类前调)。
///
/// 词法层判定(不 canonicalize,因路径可能不存在 — write_file 新建)。返回三态决策:
/// - 路径规范化(去 .. / 锚定 workspace_root)后,若命中黑名单 → `Denied`
/// - 路径规范化(去 .. / 锚定首个持久授权目录)后,若命中黑名单 → `Denied`
/// - 否则若 `is_authorized(规范化路径)`(persistent + session) → `Authorized`
/// - 否则 → `NeedsAuthorization { dir: 父目录规范化 }`(目录粒度,对齐 session_trust)
///
@@ -843,8 +843,9 @@ impl AppState {
all_dirs.sort();
all_dirs.dedup();
let mut set = HashSet::new();
// 方案①:KV + 项目绑定均空时不再硬塞 workspace_root(分发后该路径无效)。
// 用户首次访问任意目录走弹窗三档授权,授权后落 KV 持久
// 始终插入 workspace_root(工程内路径默认免授权,对齐用户政策 + 注释承诺)。
// BUG-260620-05 修:去掉 all_dirs.is_empty() 条件,无条件插入,不再依赖 KV/project_dirs 是否存在
set.insert(workspace_root_path());
for d in all_dirs {
let d = d.trim();
if d.is_empty() {