library: 未安装 Codex CLI 仅登录(~/.codex/auth.json)时,资源库指令仍误把 Codex 列为目标
问题描述
本地没有安装 Codex CLI(也没有安装 Codex Desktop 或 Cindy),只是做过 Codex 登录(~/.codex/ 下仅有 auth.json),但在 资源库(Library)→ 指令 等页面中仍然出现了 Codex 目标,并且同步技能时还在 ~/.codex/skills/ 下创建了技能链接。与此同时,Agents 页面和 magpie ls 中均正确未列出 Codex。
环境信息
- OS: Windows
- Magpie 版本:
v0.1.4947 - 本地状态:
where codex无结果(未安装 Codex CLI)~/.codex/中仅包含auth.json(登录产生)以及 Magpie 同步产生的skills/目录magpie ls中无 Codex
原因定位
internal/agent/codex.go中codex()为 Codex 设置了a.shared = a.Name和a.sharedApp = cindyCodexHere(同时配置了signIn: "auth.json")。- 在
internal/agent/agent.go中:configHere()调用agentDir(a.Dir, append([]string{a.signIn}, a.readHere...)...),正确忽略了auth.json,因此a.Detected()返回false;- 但
SharedHere()调用的是agentDir(a.Dir),未传入a.signIn("auth.json")和a.readHere:func (a *Agent) SharedHere() bool { return a.shared != "" && a.WSL == "" && a.Dir != "" && !Taken(a.Dir) && (agentDir(a.Dir) || a.SharedRead()) } - 因此只要
~/.codex/auth.json存在,agentDir("~/.codex")就会返回true,导致SharedHere()误判为true。
- 接着在
internal/library/targets.go的targetsAsleep()中:!a.Detected() && !a.SharedHere()为false(被SharedHere() == true放行);- 又因为
internal/agent/install.go中CLIMissing()在!a.Detected()时直接返回false,所以!gone && a.CLIMissing() && !a.SharedRead()也未能拦截。 - 最终 Codex 泄漏进
library.Targets(),出现在资源库指令/技能目标列表中。
期望行为 / 修复建议
- 当本地未安装 Codex CLI/应用(也未安装共享
~/.codex的 Cindy)、仅因登录存在~/.codex/auth.json时,Codex 不应出现在资源库(指令/技能/MCP)目标中。 - 建议在
Agent.SharedHere()中调用agentDir时与configHere()保持一致,传入a.signIn与a.readHere(忽略仅由登录产生的文件)。
On it: checking the chain in the source (SharedHere vs configHere, targetsAsleep) and fixing it for every agent with a shared folder, including folders magpie's own Library sync made.
Fixed in 22f0f3f1a, released in v0.1.4966.
A folder holding only what magpie itself wrote there no longer counts as the agent's, or as its vendor's other app's: the sign-in file (Codex's auth.json, Claude Code's .credentials.json), and what the Library writes (instructions, MCP, hooks, subagents, skills, and a config.toml / settings.json holding only the Library's keys). So with no Codex CLI, Codex app or Cindy here, Codex is no Library target and no skill is linked into ~/.codex/skills. Codex through Cindy or a real install, and the Cursor editor's ~/.cursor, are still targets.
If you were already affected: nothing is deleted. Codex gets nothing new; what the Library had already given it (skills linked in ~/.codex/skills, AGENTS.md) stays, and the Library lists Codex as not installed on the rows of what it has, so you can untick it there to take it out.
Leaving this open until you confirm it works on your machine.
这条看起来已经修了:提交 22f0f3f1a「agent: a folder holding only what magpie wrote is no agent's, and no Library target」(2026-11-28,上游 85cdca969)。
它与这条的缺陷是同一件事:只有 magpie 自己写的东西的目录不算该 agent 的、也不作 Library 目标。
建议可以关;若你原本还想要别的(更宽的输入、别的上游),把剩下的列一句即可。