Repository navigation
Conversation
Keep dedicated user subagents out of unrelated session catalogs while preserving global defaults and portable Markdown definitions. Persist project visibility locally and filter before runtime catalog assembly. Expose project selection in the editor independently of enablement, using the project archive sources so recent folders remain selectable. Cover persistence, catalog isolation, and the settings save flow. Refs vastsa#1431
muzimu217
left a comment
There was a problem hiding this comment.
Checked out the branch and reproduced the CI failure locally — full review below.
The JS failure is a stale source assertion, one line to fix
apps/desktop/test/agent-capability-settings.test.mjs:42 ("skills and MCP filter one list by level...") asserts the SubagentEditorSheet source still contains settings\.globalOnly. This PR intentionally replaces that "global-only" label with the real scope control, so the assertion no longer matches. Reproduced locally on head 758764a09:
✖ skills and MCP filter one list by level instead of stacking two sections
AssertionError: The input did not match the regular expression /settings\.globalOnly/
Updating that assertion to the new shape is the only thing between this PR and a green JS job — the new subagent-project-scope.test.mjs suite itself passes its non-Electron tests, and the Electron E2E check is green on CI.
Host-side implementation verified against #1431's facts
This is exactly the "wiring" the issue's verification pointed at, done right:
user_subagents.rs:302active_for(project_path)now consumes the project path (was an unused_project_pathstub that only filteredenabled), andset_scope(:518) persists instead of discarding — both matching the MCP-side reference implementation.project_scope.rsis the right shape: app-localagent-capabilities/subagent-scopes.json(atomic tmp+rename write), missing file defaults to all-global, corrupt file fails closed (returns an error instead of degrading to "everything visible") — that fail-closed choice matches the body's promise and is the safer default for a visibility control.- Keeping definitions in
~/.agents/subagentsand not adding a project-level directory preserves ADR 0112's frozen decision; the scope living app-local (not in the shareable Markdown) is a reasonable split since scope lists carry machine-local absolute paths. - The A/B/no-project isolation tests (
user_subagents.rs:844-851) cover the delegation-catalog filter, and the author's cross-projectUnknown subagentruntime rejection check closes the "model forces the name" hole the issue's soft-isolation workaround couldn't.
Two non-blocking notes
- Policy: this is a
featduring the fix/perf contribution window — the body already flags this honestly, so that call belongs to the maintainer; the implementation itself is ready for that decision to go either way. - The scope file is keyed by subagent id; the rename-preserves-scope behavior is tested, which is the right place to have pinned it.
Once the stale assertion is updated this should be mergeable from a correctness standpoint.
The settings list now labels each subagent with its activation scope.\nReplace the obsolete global-only expectation with both supported labels.
Resolve the ADR from the shared documentation directory so the Chinese marketplace page no longer blocks documentation and workspace builds.
|
Confirmed on our side: the new |
Keep the upstream canonical ADR link when combining both dead-link fixes. Preserve the project scope implementation while incorporating current main.
关联 #1431。
目前用户创建的子智能体会出现在所有会话的
Task工具中,项目专用的子智能体也会被其他项目看到。本 PR 增加“全局 / 指定项目”设置,让模型只看到并调用当前项目适用的子智能体。改动
Task中的可用子智能体。例如 A 专用的子智能体只在 A 及其子目录的会话中可用,在 B 或无项目会话中不可见;即使模型指定它的名字,也会被拒绝执行。scope字段和子智能体加载流程,由 Host 在agents.active(projectPath)中筛选。范围设置单独保存在应用本地,不改动子智能体 Markdown;重命名保留设置,删除时清理。验证
Unknown subagent,未启动子任务。真实模型验证在同步主线前完成,同步后重跑了上述自动化检查与 Host 端到端测试。范围修改在下一次加载工具目录时生效,不中断正在运行的子智能体。旧版本不识别新增的范围设置,降级后会恢复原来的全局可用行为。