Skip to content

fix(desktop): preserve policy-less plugin discovery - #4019

Open
dashhuang wants to merge 2 commits into
mainfrom
dash/fix-ios-simulator-routing
Open

fix(desktop): preserve policy-less plugin discovery#4019
dashhuang wants to merge 2 commits into
mainfrom
dash/fix-ios-simulator-routing

Conversation

@dashhuang

@dashhuang dashhuang commented Sep 6, 2026

Copy link
Copy Markdown
Member

这次改了什么

保持普通任务和 provider discovery 在缺少冻结策略时的现有可用性;显式 Bot Profile allowlist / disabled list 继续生效。本 PR 不宣称完成通用 capability snapshot 重构。

怎么验证的

  • desktop policy 定向 Vitest:3 tests passed。
  • GitHub client-ci 已通过。

风险

本 PR 不改变缺少冻结策略时的默认放行语义,避免普通任务和 provider discovery 回归。通用插件能力快照仍需后续专门改动。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang
dashhuang requested a review from a team as a code owner September 6, 2026 23:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T04:39:44.941626Z 1a763a9 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes the shared built-in plugin policy to deny access when no valid frozen allowlist or disabled list is available and updates its focused unit tests.

  • Missing and malformed policies now fail closed.
  • Valid allowlists continue to take precedence over disabled lists.
  • The new fallback also runs during provider discovery, where no frozen policy exists yet, preventing controlled built-ins from being registered.

Confidence Score: 4/5

This PR is not safe to merge until controlled built-ins can still be registered during policy-less provider discovery.

The new fallback correctly denies missing policies at call-time enforcement boundaries, but the same helper is invoked earlier with intentionally empty vendor options, causing provider registration to skip the affected built-ins permanently.

Files Needing Attention: apps/desktop/src/main/mcp-integrations/codexBuiltinToolPolicy.ts

Important Files Changed

Filename Overview
apps/desktop/src/main/mcp-integrations/codexBuiltinToolPolicy.ts Changes missing or malformed frozen policy handling from fail-open to fail-closed, but also denies the policy-less provider-discovery phase.
apps/desktop/src/main/mcp-integrations/tests/codexBuiltinToolPolicy.test.ts Updates focused helper tests for fail-closed behavior, but does not cover provider registration before thread policy injection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Codex or Pi provider discovery] --> B["Context uses vendorOptions: {}"]
  B --> C[Provider isEnabled]
  C --> D[isFrozenBuiltinPluginAllowed]
  D --> E[No allowlist or disabled list]
  E --> F[Return false]
  F --> G[Skip provider registration]
  G --> H[Tool remains unavailable after thread policy is injected]
Loading
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/mcp-integrations/codexBuiltinToolPolicy.ts:41
**Provider registration is blocked**

During Codex and Pi startup, provider discovery calls `isEnabled` with empty `vendorOptions` before a thread-specific capability snapshot exists. This new fallback returns `false`, so discovery skips every controlled built-in before its server is registered. Those tools remain unavailable even after a valid per-thread policy is supplied, contrary to the existing design that registers ordinary plugins first and enforces their policy at call time.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(desktop): fail closed for missing pl..." | Re-trigger Greptile

Comment thread apps/desktop/src/main/mcp-integrations/codexBuiltinToolPolicy.ts Outdated

@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: c8087e664a

ℹ️ 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/mcp-integrations/codexBuiltinToolPolicy.ts Outdated
@dashhuang

Copy link
Copy Markdown
Member Author

感谢 review。该问题成立:当前改动把 discovery 阶段的空 vendorOptions 与调用阶段的缺失快照混为一谈,确实会导致 provider 在策略注入前被永久跳过。我们会改为显式的 capability snapshot/discovery 语义,保留 discovery 注册与调用前 fail-closed,并补 provider 注册回归测试。当前 PR 暂不 resolve 该反馈。

@MagicLizi MagicLizi added the status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) label Sep 6, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

@dashhuang 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/mcp-integrations/codexBuiltinToolPolicy.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

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

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

格式门未通过

Description 缺仓库要求的三段标题(中文段落名需原样出现):

  • 这次改了什么
  • 怎么验证的
  • 风险

当前正文用的是 Problem / Change / Validation / Risk,格式门按标题匹配,不会把英文小标题当成这三段。

请按 .github/PULL_REQUEST_TEMPLATE.md 改成上述三段后再推(或编辑 PR 描述)。本轮不进入代码审查。

另外:CI 当前是红的(Linux/Windows unit tests、verify、client-ci),修描述时一并处理。

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
@dashhuang

Copy link
Copy Markdown
Member Author

已处理该 review:provider discovery 和普通任务在没有冻结策略时继续保持可用;冻结策略仍只在显式 allowlist/disabled list 存在时生效。当前 PR 已收缩为保持既有策略语义,完整 capability snapshot 重构不在本 PR 内。对应提交:1a763a985。

@dashhuang

Copy link
Copy Markdown
Member Author

@codex review 请基于最新提交 1a763a9 重新检查已解决的 discovery policy feedback。

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 1a763a985d

ℹ️ 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".

@MagicLizi MagicLizi removed the status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) label Sep 7, 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.

[P1] apps/desktop/src/main/mcp-integrations/__tests__/codexBuiltinToolPolicy.test.ts:19

标题仍是 fail closed,当前 head 只改了用例名,断言仍是 isFrozenBuiltinPluginAllowed(undefined, 'collab') → true,畸形 disabled 列表 ['collab', 1] 同样 true。共享实现 !readDisabledBuiltinPluginIds(...)?.includes(pluginId) 在缺/畸形 policy 时放行。正文已改口「保持既有策略语义」,与标题不符。

请二选一并改到一致:

  • 若本 PR 仍是 fail-closed:调用期缺 snapshot / 畸形列表应 toBe(false);discovery / 普通任务无冻结策略若要保持注册,应与调用期闸门拆开。
  • 若本 PR 收缩为保持 fail-open:改掉标题和「fail closed」表述,不要把缺 policy 放行伪装成已完成的能力快照重构。

@dashhuang dashhuang changed the title fix(desktop): fail closed for missing plugin capability policy fix(desktop): preserve policy-less plugin discovery Sep 7, 2026
@MagicLizi MagicLizi added the status:awaiting-author 等作者修改(review-pr 自动维护,仅展示) label Sep 7, 2026
@MagicLizi
MagicLizi dismissed stale reviews from themself September 7, 2026 05:50

这些问题已在当前 head 的后续 commit 中修复(格式门/安全门已通过),自动 dismiss 旧的 CHANGES_REQUESTED 以解除合并阻塞。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting-author 等作者修改(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants