Skip to content

fix(agent): preserve grants when permission requests are disabled - #6761

Open
Colafornia wants to merge 4 commits into
apache:rust-previewfrom
Colafornia:fix/agent-preserve-permission-grants
Open

Colafornia wants to merge 4 commits into
apache:rust-previewfrom
Colafornia:fix/agent-preserve-permission-grants

Conversation

@Colafornia

@Colafornia Colafornia commented Nov 10, 2026 •

Copy link
Copy Markdown
Member
English

Summary

Turning off new permission requests should preserve previously approved grants. The Host previously advanced the permission boundary for any settings change, and the UI also requested grant revocation on ordinary settings updates.

Advance the boundary only when base access changes or a caller explicitly sends revokeGrants: true. Remove implicit revocation from the conversation permission control and pending conversation/goal submissions. The Host metadata owner makes the boundary decision for all callers.

Workbench currently has no dedicated revoke-grants action. This PR removes the accidental implicit revocation caused by ordinary settings updates; it does not add a new user-facing revocation control. Callers can still revoke grants through the metadata API; a dedicated Workbench control can be a follow-up if required.

Split from #6727. OpenAI Codex prepared this PR under the contributor's direction.

Verification

  • Base: 83fd321171dbffaad0d77cf1e9a616196da36687 (rust-preview). Verified head: a2119a1f5.
  • node --test products/maka/workbench/tests/*.test.mjs: 118 passed, including the new permission-controller regression. Before the UI correction, that regression failed because the actual controller sent revokeGrants: true when only disabling requests. It checks that disabling requests sends one metadata update without grant revocation, through the real controller and its existing control callback. The simplified test still fails when the old revocation parameter is restored at module load time.
  • Biome formatting checks for both changed UI source files and the new test, plus git diff --check, passed. The test is included by the existing tooling-tests glob.
  • Earlier verification at 951778340: cargo test -p maka-agent-native --lib -- owner::driver::tests::permission_boundary:: passed (1 test); Rust formatting and diff checks passed. No Rust source changed in the follow-up, and this test was not rerun. It checks real Host mutation receipts, cleanup, persisted settings, and boundary preservation for request toggles versus invalidation for access changes and metadata revokeGrants: true.
  • Before rebasing, the Host regression failed with the old full-settings comparison, without access-change detection, and without explicit revocation handling.
  • Not run: the full Rust suites, standalone UI typecheck, full just check, real-window acceptance, or an end-to-end operation that obtains and reuses a grant after the toggle. The controller test observes its outgoing request; it does not execute a Host mutation.

Manual acceptance: approve a session grant, disable new requests in the conversation UI, verify that the approved operation remains executable and a new target cannot request access, then revoke grants through the metadata API and verify that the old grant cannot be reused.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex implemented the corrections, tests, ablation experiments, documentation, review follow-up, and this PR description. Preserve the Generated-by: Codex commit trailers when squashing.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

The focused checks are listed above; the complete checks and manual acceptance have not run.

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
中文

概述

关闭新增权限申请应保留此前批准的授权。原先 Host 会在任意权限设置变更时推进权限边界,UI 也会在普通设置更新时主动请求撤销授权。

改为仅在基础访问权限变化,或调用方明确发送 revokeGrants: true 时推进边界。移除会话权限控件、待创建会话及目标提交中的隐式撤销,由 Host 元数据处理处统一决定所有调用方的权限边界变化。

Workbench 当前没有独立的撤销授权入口。本 PR 移除的是普通设置更新带来的隐式撤销,不新增用户可见的撤销操作。调用方仍可通过 metadata API 显式撤销授权;如产品需要 Workbench 内的撤销按钮,可作为后续工作。

从 #6727 拆出。此 PR 由 OpenAI Codex 在贡献者指导下准备。

验证

  • 基线:83fd321171dbffaad0d77cf1e9a616196da36687(rust-preview)。当前验证提交为 a2119a1f5。
  • node --test products/maka/workbench/tests/*.test.mjs:118 项通过,包含新增的权限控制器回归。修正 UI 前,该回归因真实控制器在仅关闭申请时发送 revokeGrants: true 而失败;现在通过真实控制器及既有控制回调,检查关闭申请时只发送一次元数据更新,且不请求撤销授权。精简后的测试在模块加载时临时恢复旧撤销参数后仍会失败。
  • 两个受影响 UI 源文件及新增测试通过 Biome 格式检查,git diff --check 通过。既有工具测试入口会自动纳入该测试。
  • 此前在 951778340 的验证:cargo test -p maka-agent-native --lib -- owner::driver::tests::permission_boundary:: 通过(1 项),Rust 格式及差异检查通过。后续修复没有修改 Rust 源码,本轮未重跑该测试。它检查真实 Host 变更回执、清理、持久设置,以及申请开关保留边界、基础访问权限变化和 metadata revokeGrants: true 使边界失效的行为。
  • 变基前,Host 回归在恢复完整设置比较、移除基础访问权限变更检测、移除明确撤销处理时均失败。
  • 未运行完整 Rust 套件、独立 UI 类型检查、完整 just check、真实窗口验收,以及取得授权后切换开关再复用授权的端到端操作。控制器测试检查发出的请求,没有执行 Host 变更。

人工验收:批准会话级授权,在会话界面关闭新增申请,确认已批准的操作仍可执行且新目标不能申请权限;再通过元数据 API 撤销授权,确认旧授权无法复用。

AI 使用情况

  • 生成式工具未作出实质贡献
  • 生成式工具作出了实质贡献

工具及范围:OpenAI Codex 完成修复、测试、消融实验、文档、审查后续处理及本 PR 说明。合并压缩提交时请保留 Generated-by: Codex 标记。

检查清单

  • 测试覆盖本次改动,且移除相关实现后会失败
  • 格式、类型检查及受影响套件均已在本地通过

上方列出了聚焦检查;完整检查和人工验收尚未运行。

本 PR 是否改变行为?

  • 是,已在上方概述中说明
  • 否

Only advance the permission boundary for access changes or explicit revocation. Keep the metadata regression with the boundary behavior.

Generated-by: Codex
Keep four Host metadata steps covering request toggles, access changes, and explicit revocation. Compare persisted settings and permission basis without redundant revision assertions or string-based access selection.

Generated-by: Codex
@Colafornia Colafornia self-assigned this Nov 10, 2026
@Colafornia
Colafornia marked this pull request as draft November 10, 2026 16:43
Remove implicit grant revocation from ordinary permission setting updates. Let the Host metadata owner advance the boundary for access changes and explicit revocation, and cover the UI controller request through its existing control seam.

Generated-by: Codex
@Colafornia
Colafornia marked this pull request as ready for review November 10, 2026 16:56
Keep one real-controller request regression for disabling permission requests. Remove the second settings input, simulated session updates, and repeated empty-error assertions; Host coverage retains access-change and explicit-revocation behavior.

Generated-by: Codex

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant