Skip to content

fix(desktop): classify incompatible market manifests - #1978

Open
yuaiccc wants to merge 14 commits into
makecindy:mainfrom
yuaiccc:agent/plugin-market-manifest-incompatibility
Open

fix(desktop): classify incompatible market manifests#1978
yuaiccc wants to merge 14 commits into
makecindy:mainfrom
yuaiccc:agent/plugin-market-manifest-incompatibility

Conversation

@yuaiccc

@yuaiccc yuaiccc commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

这次改了什么

摘要

修复 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 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:Related to GitHub 插件详情页因 Manifest secrets source 校验失败而无法安装 #1968
  • 本 PR 包含:
    • 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」本地化文案。
    • 配套 parser-backed 回归测试。
  • 明确不包含:服务端改动、UI 视觉/交互改版、新文案 key。
  • 用户可见变化:未来 manifest / 未知能力 slot 触发升级提示,普通清单错误触发「包无效」提示,其它协议/网络故障保持通用「请重试」。
  • 是否存在 breaking change:无。

UI 变化

不涉及:本次仅在已有错误码到已有 i18n key 的映射表上新增 GHOST_HOST_UNSUPPORTED 分支(复用 settings.ghosts.errors.hostUnsupported),没有新增组件、视觉、动效或文案 key;Light / Dark 两种模式均无新增样式。

  • 引用的设计规范:不涉及——命中 src/renderer/features/plugin/lib/ 路径的改动只是错误码到既有本地化 key 的纯数据映射,不渲染任何新界面,也不修改颜色/间距/排版/动效。

怎么验证的

自动验证

pnpm --filter desktop exec vitest run src/main/plugin-market/__tests__/ipcErrorBoundary.test.ts --reporter=dot
结果:23 tests passed

pnpm --filter desktop exec vitest run src/main/plugin-market --reporter=dot
结果:16 files / 368 tests passed

pnpm --filter desktop exec vitest run src/renderer/features/plugin --reporter=dot
结果:24 files / 241 tests passed

pnpm --filter desktop run --if-present typecheck
结果:通过,无错误

pnpm --filter @cindy/plugin-protocol run --if-present test
结果:通过

pnpm check:dco
结果:通过

手工验证

不涉及——错误分类为纯逻辑分支,已由 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 上跑全量。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:

影响与回滚

  • 影响面:Desktop 插件市场详情接口失败时的用户可见错误文案;不影响数据、协议、安装路径。
  • 回滚:revert 单 PR 即可,无 schema / 存储迁移。
  • 兼容性:GHOST_HOST_UNSUPPORTED / GHOST_FILE_INVALID 是已有稳定 IPC 错误码,renderer 已有对应本地化文案;不引入新错误码或新 i18n key。

Copilot AI lite review requested due to automatic review settings August 6, 2026 16:17
@yuaiccc
yuaiccc requested a review from a team as a code owner August 6, 2026 16:17
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 收窄 Desktop 插件市场清单错误分类边界,并将兼容性错误映射到稳定 IPC 错误码和既有本地化提示。

  • 使用协议解析器生成真实错误,覆盖未来 schema、未知 slot、畸形字段及信封层错误。
  • 将未来 manifest 能力映射为宿主不支持,将其他 manifest 校验错误映射为包无效。
  • 调整 manifest 校验顺序,避免未知字符串 slot 掩盖其他字段错误。

Confidence Score: 5/5

当前变更看起来可以安全合并。

未发现仍然存在的阻塞性故障,上一轮指出的测试绕过生产解析器问题已修复。

Important Files Changed

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

Comment thread apps/desktop/src/main/plugin-market/__tests__/ipcErrorBoundary.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_INVALID in 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.

Comment thread apps/desktop/src/main/plugin-market/protocolErrors.ts Outdated
Comment thread apps/desktop/src/main/plugin-market/registerIpc.ts
Copilot AI review requested due to automatic review settings August 6, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');
    }

@MagicLizi

Copy link
Copy Markdown
Contributor

⏸ 本 PR 改到了插件基座(plugin-base),需要维护者确认后才能合并。

触发:pluginBase — 改到插件市场 manifest 兼容性分类

已开启讨论 issue,维护者请在 PR 上 Approve 或 Request Changes。

讨论 issue:#1986

@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) labels Aug 6, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@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。

@MagicLizi

Copy link
Copy Markdown
Contributor

@yuaiccc 👋 这个 PR 目前与 main 有合并冲突,auto-review 因此暂时跳过、没法继续审查 / 合并。

请在本地 merge 最新的 origin/main 解决冲突后推送;冲突解除后,下一轮 auto-review 会自动重新处理这个 PR。

@MagicLizi MagicLizi added the touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) label Aug 10, 2026
@yuaiccc
yuaiccc force-pushed the agent/plugin-market-manifest-incompatibility branch from 9e4bfce to bf0fe75 Compare August 11, 2026 04:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/desktop/src/main/plugin-market/protocolErrors.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@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。

@yuaiccc
yuaiccc force-pushed the agent/plugin-market-manifest-incompatibility branch from bf0fe75 to 4e6eae7 Compare August 13, 2026 13:47
@yuaiccc

yuaiccc commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

已处理这轮 review:

  • 仅识别 currentRelease.manifest,不再把任意 .manifest 文本误判为清单不兼容。
  • 未来 manifest schemaVersion 与未知 capability slot 映射为 GHOST_HOST_UNSUPPORTED,保留升级提示;普通清单错误仍为 GHOST_FILE_INVALID
  • 两类 protocol error 在转成稳定 IPC 错误前都会写入 main 日志,保留原始诊断。
  • 新增 parser-backed regression coverage,targeted boundary test 8/8 通过。

另外已基于官方 origin/main rebase,避免使用 fork 上过期的 main。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/desktop/src/main/plugin-market/protocolErrors.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@yuaiccc 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/plugin-market/protocolErrors.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@yuaiccc
yuaiccc force-pushed the agent/plugin-market-manifest-incompatibility branch from 4e6eae7 to c83cb67 Compare August 16, 2026 13:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/desktop/src/main/plugin-market/protocolErrors.ts
@yuaiccc
yuaiccc force-pushed the agent/plugin-market-manifest-incompatibility branch from c83cb67 to 6d1f0fc Compare August 17, 2026 04:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/desktop/src/main/plugin-market/registerIpc.ts
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>
@yuaiccc
yuaiccc force-pushed the agent/plugin-market-manifest-incompatibility branch from 6d1f0fc to 14b54b4 Compare August 17, 2026 05:04
@MagicLizi

Copy link
Copy Markdown
Contributor

@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 MagicLizi added the touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) label Aug 18, 2026

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式门未通过

PR 描述缺少必要段落,请补充以下内容后重新提交:

  • 这次改了什么:简要说明改动内容与动机
  • 怎么验证的:如何确认改动是正确的(测试、手动验证等)
  • 风险:这个改动可能影响什么,有没有向后不兼容

参考仓库 PR 模板 .github/PULL_REQUEST_TEMPLATE.md

@MagicLizi MagicLizi added status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) and removed awaiting-discussion 等待维护者讨论(review-pr) labels Aug 18, 2026
- 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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/desktop/src/main/plugin-market/protocolErrors.ts Outdated
yuaiccc and others added 3 commits August 19, 2026 13:00
…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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/plugin-protocol/src/manifest.ts
@yuaiccc

yuaiccc commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

已按上轮 review 处理完毕,麻烦 @MagicLizi 复审:

代码修复 (commit 38c6d1f)

  • 收窄 isPluginManifestIncompatibilityError:只在错误消息严格匹配 manifest 校验器产生的 currentRelease.manifest 不合法: <reason> 格式时才映射到 GHOST_FILE_INVALID;信封层错误(oidc-token scope、name/description/author 不一致、manifest.idghostId 不一致)虽然消息里也提到 currentRelease.manifest,但仍属于协议/服务端故障,保持 INTERNAL(解决 P1 review comment)。
  • 新增 5 条 parser-free 回归测试,锁定上述信封错误不被误分类。

PR 正文

  • .github/PULL_REQUEST_TEMPLATE.md 重写为中文三段式(这次改了什么 / 怎么验证的 / 风险),补齐「UI 变化 · 引用的设计规范」字段(命中 renderer 路径但纯数据映射,不涉及视觉/交互/文案变化)。

Threads

  • 4 条 unresolved threads 均已处理后 resolve:schemaVersion 收窄、未知 slot 延后上报、renderer GHOST_HOST_UNSUPPORTED 映射、envelope 误分类。

验证

  • plugin-market 相关测试全绿(main 16 files / 368 tests,renderer 24 files / 241 tests);plugin-protocol 测试通过;desktop typecheck 通过;DCO 通过;CI 全绿。

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>
@yuaiccc

yuaiccc commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants