Repository navigation
feat(claim): 多根工作区下可选地允许从链接根认领任务 - #62
Merged
Merged
Conversation
A session whose cwd is project A could not claim a task of project B even when B was attached to that session as an extra workspace root: the claim gate only compared callerWsId with task.workspaceId. Add a board setting `allowClaimFromLinkedRoots` (default off). When it is on, the claim gate additionally accepts the task's project if it is one of the workspace roots linked to the calling session; the host passes `ToolDeps.linkedRoots(cwd)`, which resolves the extra roots of the session whose cwd is that directory (multi-root workspace plugin: scopeOf(cwd)). The setting is exposed as "Allow claiming from linked workspace roots" in Settings -> General (EN + ZH), and the claim gate's error message mentions the linked-roots case. A task keeps its own project; nothing else changes.
Owner
|
感谢你提供多根工作区认领的实现和真机验证。在你的版本基础上,已补充以下完善:
另补充澄清原说明中的创建边界:当前 本次 Windows 本地类型检查、host/client 完整构建及全量测试通过(44 个测试文件、583 个测试)。修订提交 |
This was referenced Oct 25, 2026
Author
|
Thank u! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么?
多根工作区(multi-root workspace)下的认领边界:
callerWsId === task.workspaceId,所以当额外的 workspace 根目录(多根插件挂上来的项目 B)里存在任务时,cwd 属于项目 A 的会话无法认领,只能创建/评论。allowClaimFromLinkedRoots(默认关闭,保持原有行为)。打开后,认领门禁额外接受“任务项目属于该会话已链接的 workspace 根目录”的情况;任务本身仍归属它原来的项目,其它逻辑不变。ToolDeps.linkedRoots(cwd),由src/index.ts从可选服务multiRootScope.scopeOf(cwd)取得(即dsh-plugin-multi-root-workspace)。服务不存在、抛错或返回 undefined 时一律降级为「只认主根」——老版本 DSH 行为不变。Allow claiming from linked workspace roots,描述说明只放开认领、不放开创建/移动,并提示需安装多根插件。中英文案均已加。改动文件:
src/shared/protocol.ts—BoardSettings.allowClaimFromLinkedRoots+ 校验 +allowClaimFromLinkedRootsOf()src/shared/api.ts—UpdateSettingsBody增加该字段src/host/tools.ts—ToolDeps.linkedRoots、callerClaimScope()、认领门禁改造src/index.ts— 从multiRootScope取链接根目录src/client/board/SettingsModal.tsx— 开关 UIsrc/client/i18n/en.ts、zh.ts— 文案tests/multiroot-claim.spec.ts— 新增 7 个用例;tests/client.spec.ts— 设置基线期望更新如何验证?
新增用例覆盖:
workspace_mismatch(回归保护)claimedBy是本会话linkedRoots未注入)→ 仅主根可用linkedRoots抛错 → 降级,不 500真实环境核对:
dsh-plugin-multi-root-workspace0.1.10 的公开 APIscopeOf(primaryRoot)返回该 cwd 的追加根目录,本补丁正是用它(ctx.get('multiRootScope'),服务缺失即降级),并在本机 DSH 的@deepseek-ai/dsh-workspace里核对了resolveByPath()的返回形状。端到端(真机安装本补丁后在看板上认领相邻项目任务)尚未执行——需要先由本机安装补丁版本。端到端已在真机验证(2026-10-25)
本补丁安装到本地 DSH 后实测通过:主根
D:\LLM\Nord(会话 cwd),追加根D:\DEV\mqtt_hm(另一项目),多根插件 0.1.10。开关打开后,cwd 属于 Nord 的会话成功认领了归属 mqtt_hm 项目的卡片(todo → in_progress,版本号按 CAS 递增),并继续在同一会话里完成:加评论、勾选验收清单、提交执行报告、in_progress → in_review。开关关闭时同一操作仍被workspace_mismatch拒绝——开关确实起作用,不是旁路。该方法的已知限制
/workspace-folders add挂成本会话的追加根。仅在 DSH 里打开过该文件夹、未注册成 workspace 时,scopeOf()返回空,认领照旧被拒。taskboard_create仍要求 cwd 主根就是目标项目;传相邻项目的 workspaceId 或路径会报unknown workspaceId。相邻项目的卡片只能在“主根就是该项目”的窗口里新建,或改用该项目的会话。multiRootScope是多根插件的约定;插件改名/改接口、或版本与 DSH 不匹配(README 兼容表,插件不启动)时,本补丁不报错,只退化成“只认主根”——表面现象就是“又认领不了”。--read-only挂载不适合作为认领场景(按插件 README 的权限模型推断,未实测)。defaultWorkspaceId与此无关,只影响 GUI 默认显示哪个项目。关联 Issue(可选)
无。需求来自日常使用:多根工作区下想直接认领相邻项目的卡片,而不是必须另开一个 cwd 在该项目里的会话。