fix(desktop): classify incompatible market manifests - #1978
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/plugin-market/tests/ipcErrorBoundary.test.ts | 已改为通过生产协议解析器生成错误,修复了上一轮指出的解析器契约重复问题。 |
| apps/desktop/src/main/plugin-market/protocolErrors.ts | 新增窄范围分类器,区分未来宿主能力与普通清单不合法错误。 |
| apps/desktop/src/main/plugin-market/registerIpc.ts | 在 IPC 边界将两类清单协议错误映射到稳定错误码,并保留原始诊断日志。 |
| apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts | 将宿主不支持错误映射到已有的升级提示文案。 |
| packages/plugin-protocol/src/manifest.ts | 延迟报告未知字符串 slot,使其他清单字段错误优先得到准确分类。 |
Reviews (14): Last reviewed commit: "chore: retrigger CI after repeated flaky..." | Re-trigger Greptile
There was a problem hiding this comment.
Pull request overview
This PR improves Desktop plugin-market IPC error handling by detecting marketplace “current release manifest” incompatibilities during detail parsing and surfacing them as the existing stable GHOST_FILE_INVALID IPC error (instead of generic INTERNAL), aligning behavior with the desired user-facing compatibility guidance (Issue #1968).
Changes:
- Add a narrow classifier for protocol parse failures that indicate an unsupported
currentRelease.manifest. - Map those classified failures to
GHOST_FILE_INVALIDin the plugin-market IPC error boundary. - Extend main-process tests to lock in the new error-boundary behavior and classifier semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/desktop/src/main/plugin-market/registerIpc.ts | Maps detected manifest-incompatibility protocol failures to GHOST_FILE_INVALID at the IPC boundary. |
| apps/desktop/src/main/plugin-market/protocolErrors.ts | Introduces a helper to detect manifest incompatibility errors coming from the market protocol parser. |
| apps/desktop/src/main/plugin-market/tests/ipcErrorBoundary.test.ts | Adds assertions for the new classification + mapping behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
apps/desktop/src/main/plugin-market/protocolErrors.ts:12
- 注释里强调要“仅”识别 current release manifest 的不兼容,但当前条件只要错误消息包含“.manifest”就会命中,范围比注释描述更宽,可能把其它 manifest 相关的协议错误也归类为兼容性问题。建议把匹配串收窄到 currentRelease.manifest,对齐意图并减少误分类。
export function isPluginManifestIncompatibilityError(error: unknown): boolean {
return (
error instanceof Error &&
error.name === 'PluginProtocolError' &&
error.message.includes('.manifest')
);
apps/desktop/src/main/plugin-market/registerIpc.ts:74
- 这里把 manifest 不兼容错误转换成 GHOST_FILE_INVALID 时直接抛出了新的 IPC Error,但没有记录原始协议解析失败信息;这样会让 main 进程日志丢失根因,后续排查/统计会更困难。建议在映射前补一条 warn(沿用现有的 message-only 记录方式)再抛出稳定错误码。
if (isIpcError(error)) throw error;
if (isPluginManifestIncompatibilityError(error)) {
throwIpcError('GHOST_FILE_INVALID', 'This Plugin manifest is not supported');
}
|
⏸ 本 PR 改到了插件基座(plugin-base),需要维护者确认后才能合并。 触发:pluginBase — 改到插件市场 manifest 兼容性分类 已开启讨论 issue,维护者请在 PR 上 Approve 或 Request Changes。 讨论 issue:#1986 |
|
@yuaiccc 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/plugin-market/protocolErrors.ts / apps/desktop/src/main/plugin-market/registerIpc.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@yuaiccc 👋 这个 PR 目前与 请在本地 merge 最新的 |
9e4bfce to
bf0fe75
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf0fe75c82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@yuaiccc 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/plugin-market/protocolErrors.ts / apps/desktop/src/main/plugin-market/registerIpc.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
bf0fe75 to
4e6eae7
Compare
|
已处理这轮 review:
另外已基于官方 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e6eae780c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@yuaiccc 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/plugin-market/protocolErrors.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
4e6eae7 to
c83cb67
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c83cb671a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c83cb67 to
6d1f0fc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d1f0fcf91
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
6d1f0fc to
14b54b4
Compare
|
@yuaiccc 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/plugin-market/protocolErrors.ts / apps/desktop/src/main/plugin-market/registerIpc.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
MagicLizi
left a comment
There was a problem hiding this comment.
格式门未通过
PR 描述缺少必要段落,请补充以下内容后重新提交:
- 这次改了什么:简要说明改动内容与动机
- 怎么验证的:如何确认改动是正确的(测试、手动验证等)
- 风险:这个改动可能影响什么,有没有向后不兼容
参考仓库 PR 模板 .github/PULL_REQUEST_TEMPLATE.md。
- Only classify future schema versions and shape-valid unknown slots as host-unsupported - Validate remaining manifest fields before reporting upgrade needed - Map GHOST_HOST_UNSUPPORTED to localized marketplace error copy Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b25da1d7ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…lassification The previous isPluginManifestIncompatibilityError matched any PluginProtocolError whose message mentioned currentRelease.manifest. parseVisiblePluginDetail also emits envelope errors containing that path (oidc-token scope mismatch, name/description/author consistency, manifest.id vs ghostId) which are server/protocol failures, not bad packages, so they must stay on the generic INTERNAL path. Require the exact 'currentRelease.manifest 不合法: <reason>' marker emitted by the manifest validator (via currentReleaseManifestReason) so only genuine manifest parse/validation failures map to GHOST_FILE_INVALID. Add parser-free regression coverage for the envelope-level error shapes. Signed-off-by: yuaiccc <yuaiccc@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38c6d1f2ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
已按上轮 review 处理完毕,麻烦 @MagicLizi 复审: 代码修复 (commit 38c6d1f)
PR 正文
Threads
验证
|
When slots contains the same unknown string twice (e.g. ['future-capability', 'future-capability']) with an otherwise valid manifest, the defer-and-continue loop recorded the first occurrence and skipped the duplicate. The IPC boundary then mapped the package to GHOST_HOST_UNSUPPORTED, but a newer host that recognizes the slot would reject it for the duplicate declaration, so the upgrade guidance does not hold. Track unknown string slots in a Set as they are encountered; a repeat returns the same 'slots 含重复卡槽' reason as a duplicate known slot, which maps to GHOST_FILE_INVALID (the package itself is malformed). Add parser-backed regression coverage. Signed-off-by: yuaiccc <yuaiccc@users.noreply.github.com>
|
@MagicLizi 再次 ping:所有 review threads 已 resolve(含 Codex 最新那条 P2,commit 72e93aa 已修复并 push),CI 全部绿。请重新 review。 |
Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
…ndows Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
…indows Windows unit tests (2/2) failed on packages/maker-core agents/codex/app-server/host.test.ts > re-probes MCP readiness after app-server respawns (expected false to be true), an unrelated process/ timing flake. Plugin-market manifest path is unaffected. Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
… on Windows Signed-off-by: yuaiccc <yuaiccc@aliyun.com>
这次改了什么
摘要
修复 Desktop 插件市场详情解析里「当前版本清单不兼容」的错误分类边界:把服务端校验
currentRelease.manifest失败的协议错误,映射到已有的稳定 IPC 错误码(GHOST_FILE_INVALID/GHOST_HOST_UNSUPPORTED),而不是落到通用INTERNAL,使用户能看到已本地化的「包无效」或「请升级 Cindy」指引。本轮在上一轮基础上收窄分类器:只有 manifest 校验器产生的
currentRelease.manifest 不合法: <reason>格式才会被识别为清单不兼容;信封层错误(oidc-token scope、name/description/author 不一致、manifest.id 与 ghostId 不一致)虽然消息里也提到currentRelease.manifest,但仍属于服务端/协议故障,保持 INTERNAL。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
packages/plugin-protocol/src/manifest.ts:把未知字符串 slot 的上报推迟到清单其余字段全部校验通过之后(避免 tools 等字段畸形时被升级提示掩盖)。apps/desktop/src/main/plugin-market/protocolErrors.ts:新增窄分类器,只识别 manifest 校验器产生的不合法原因;未来schemaVersion、形状合法的未知字符串 slot 映射为「宿主不支持」,其余清单错误映射为「包无效」。apps/desktop/src/main/plugin-market/registerIpc.ts:在 IPC 边界把两类协议错误映射到稳定 IPC 错误码,并保留 main 日志里的原始诊断。apps/desktop/src/renderer/features/plugin/lib/pluginMarketErrorKey.ts:GHOST_HOST_UNSUPPORTED复用已有的「请升级 Cindy」本地化文案。UI 变化
不涉及:本次仅在已有错误码到已有 i18n key 的映射表上新增
GHOST_HOST_UNSUPPORTED分支(复用settings.ghosts.errors.hostUnsupported),没有新增组件、视觉、动效或文案 key;Light / Dark 两种模式均无新增样式。src/renderer/features/plugin/lib/路径的改动只是错误码到既有本地化 key 的纯数据映射,不渲染任何新界面,也不修改颜色/间距/排版/动效。怎么验证的
自动验证
手工验证
不涉及——错误分类为纯逻辑分支,已由 parser-backed 单测覆盖未来 schema、旧 schema、缺失 schema、非数字 schema、未知字符串 slot、未知字符串 slot 叠加 tools 畸形、数字 slot、null slot、信封层不匹配等场景。
未执行的验证
pnpm test:unit:desktop 全量 vitest 在本机遇到 worker SIGSEGV(并行 worker 的已知环境问题,与本次改动无关);已跑与改动直接相关的 plugin-market main + renderer 全量测试(共 609 tests)以及 plugin-protocol 测试,全部通过。CI 上跑全量。风险
风险分类
影响与回滚
GHOST_HOST_UNSUPPORTED/GHOST_FILE_INVALID是已有稳定 IPC 错误码,renderer 已有对应本地化文案;不引入新错误码或新 i18n key。