zai-org / zai-org/feedback

[Bug] 迁移项目目录后重启仍指向已不存在的旧工作目录,缺少存在性校验与降级

Open
#65 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

文件 / 项目操作 · File / Project ops

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

阻塞使用 · Blocking (无法使用核心功能 / core function unusable)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description
环境
  • OS: Windows 11(10.0.26100 x64)
  • ZCode 版本: 3.2.0.2135
  • 启动方式: Windows 开始菜单快捷方式
问题描述

将项目根目录跨盘符移动(robocopy /MOVE)后从开始菜单重启 ZCode,工具仍把已被删除的旧目录作为工作目录(cwd)。agent 读取到的 cwd 指向一个磁盘上不存在的路径,导致后续所有相对路径的文件读写静默失败,且启动时没有任何提示或回退。

~/.zcode/v2/setting.json 中多个字段独立记录工作路径,变更时互不同步:

  • recentProjects[]
  • lastWorkspaceSession[].workspacePath
  • dataBaseDir

迁移后 dataBaseDir 已更新为新路径,但 lastWorkspaceSession[0].workspacePath 仍为旧值,启动时取到了失效的旧路径。

复现步骤 · Steps to reproduce
  1. C:\Project 启动并使用 ZCode(setting.json 记录该路径为工作目录)。
  2. 执行 robocopy C:\Project D:\New\Project /MOVE /E(源目录被删除)。
  3. 从开始菜单重启 ZCode。
期望表现 · Expected behavior
  1. 启动时校验工作目录是否存在;不存在时给出提示并回退到默认目录或让用户重新选择,而非静默使用失效路径。
  2. 工作路径变更时,相关字段保持一致。
  3. (可选)对失效的 recentProjects 条目自动标记或清理。
实际表现 · Actual behavior
实际行为
  • 工作目录 = 旧路径(已不存在)。
  • 基于相对路径的操作全部失败,启动时无任何提示。
ZCode 版本 · ZCode version

3.2.0.2135

设备 / 系统 / 浏览器 · Device / OS / Browser

OS: Windows 11(10.0.26100 x64)

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing startup workspace selection and the loading of ~/.zcode/v2/setting.json, especially recentProjects[], lastWorkspaceSession[].workspacePath, and dataBaseDir. Reproduce the Windows migration scenario, then verify that missing workspaces are detected, users receive a prompt or fallback, and related path fields remain consistent.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.