Fix bugs - #926
Merged
Merged
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
# Conflicts: # ms_agent/agent_hub/_commands.py
alcholiclg
approved these changes
Jul 28, 2026
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.
Bug 1(P1 数据错配):从
-n all仓库下载单个命名 agent,拿到的是 default 的文件现象:对一个用
-n all上传的 root-per-agent 仓库(如 hermes:default 在裸路径、命名 agent 在profiles/<name>/下),执行agent download -f hermes -n coder时:~/.hermes/profiles/coder/),但写入的是 default 的全部文件(SOUL/config/memories/skills/hooks);profiles/coder/**文件一个都没写入,全程无告警、退出码 0;根因:下载逻辑假设"仓库里所有文件都属于所请求的 agent"。对 all 布局仓库,default 的裸路径文件恰好命中单 agent 的样式过滤(
SOUL.md、memories/*.md...)被写进命名 agent 目录;而命名 agent 自己的文件带profiles/<name>/前缀,匹配不上样式,被静默丢弃。修复(
_commands.py):新增纯函数_remote_paths_for_agent,在下载的增量/全量两条分支统一接入:profiles/coder/**等)→ 只取这些并剥掉前缀;其它 agent 的文件列入Excluded清单明确展示(不再静默);repository has no agent named 'coder' (agents in repo: default, writer);-n all/__global__/ 非 root-per-agent 框架 → 不走此逻辑,行为不变;实现完全复用
WorkspaceSpec既有的join_all_path/split_all_path/matches抽象,无任何框架前缀硬编码;qwenpaw 前缀即普通目录名的歧义(skills/x/SKILL.md切分后形似 agent 前缀)通过"须不匹配裸布局样式才算 all 布局证据"规则消除。已知边角(无法消除的歧义,保持旧行为):all 仓库若只含 default(无任何命名 agent),与单 agent 仓库在布局上不可区分,
-n <名>下载仍会取得裸路径内容。Bug 2(P2 备份不可见):restore 前自动备份缺框架名前缀,
backups -f查不到现象:
agent restore覆盖本地前的自动备份名为paw_qa_01_20260727_190757.zip(缺qwenpaw_前缀),而backups -f <fw>按文件名前缀解析框架,该备份被误判为框架paw,在-f qwenpaw下完全不可见,无法用于回滚一次误 restore;[LAST]标记在带/不带-f时指向不同备份。根因:三处自动备份中,convert(
{target_fw}_{agent})与 watch({framework}_{agent})均带框架前缀,唯独cmd_recover传的是裸 agent 名。修复(
_commands.py::cmd_recover):备份标签对齐共用约定——单 agent 为{framework}_{restore_name},all 范围为{framework}(与 all 备份不含 name 段的既有文件名约定一致);同时移除仅为旧标签服务的name重赋值死代码。Bug 3(P0 安全):qwenpaw
agent.json顶层model.api_key明文上传到公开仓库现象:上传 qwenpaw agent 时,脱敏只遍历
channels.*与mcp.clients.*.env两个子树,顶层model.api_key(DashScope/OpenAI 等 LLM 主凭据)未被清除,明文进入远端仓库(默认 public)及其 git 历史;download 入站同样漏,watch 每 120s 自动 push 会持续泄露。is_secret_key('api_key')本就返回 True——属遍历路径遗漏,非设计取舍。修复(两处,口径统一):
qwenpaw.py::_strip_agent_json_secrets:改为全 JSON 树递归——任何层级命中is_secret_key的字段整值清空(密钥名优先于下钻:"credentials": {...}整包抹掉,不因内层字段名无害而幸存);保留两条结构性规则(channel 的db_path等本地字段照清;mcp.clients.*.env整块清空)。非密钥字段(client_id、模型名等)原值保留。upload / download / watch 三条路共用此函数,一处修复三路生效;_workspace.py::scrub_json_secrets(ms-agent 框架settings.json所用的共享清洗器):修掉同款缺口——原实现仅当值为标量时清空,"api_key": {...}会漏;现改为命中即整值清空。