Repository navigation
Description
Status
Accepted and ready for implementation. There are no open design questions in this issue.
This issue is delivered as one end-to-end PR. The earlier two-PR split is superseded because it would merge a temporary dual permission/boundary state, require mode synchronization and duplicate prompts, then immediately delete that work. The implementation may use several reviewable green commits, but only the final architecture lands on main.
The issue body is the authoritative behavioral contract. Discussion comments do not reopen settled decisions unless this body is explicitly updated.
Goal
Make the enforceable session execution boundary authoritative:
- ordinary local work inside an Auto workspace runs without generic per-tool approval;
- crossing the active sandbox profile is the only operation that can request additional local authority;
- approval expands the current session boundary instead of granting one tool call;
- an operation that cannot remain sandboxed returns
requires_bypass; - Bypass is entered only through an explicit user action;
- exposed Browser, Computer Use, Office, MCP, connector, and orchestration tools run through their own brokers and hard guards without generic runtime approval;
- the replaced permission matrix, grants, modes, prompts, and CLI flags are deleted in the same PR.
Agreed design
One session execution boundary
Each session owns one authoritative boundary:
type ExecutionBoundary =
| {
kind: "managed";
profile: SandboxProfile;
revision: number;
}
| {
kind: "bypass";
revision: number;
}
| {
kind: "external";
revision: number;
};- A normal Auto session uses a managed workspace-write profile.
- Bypass means Maka provides no sandbox enforcement.
- Deep Research uses an internal managed read-only profile and a restricted tool surface; it is not a third user-selectable mode.
- Headless runners such as Harbor may use an explicit external isolation boundary.
- Desktop and TUI derive Auto or Bypass from this boundary instead of storing a second permission-mode authority.
Auto base profile
- Read and write all selected workspace roots.
- Allow ordinary edits, deletion, shell commands, and local Git operations.
- Do not specially deny writes to
.git,.agents, or.codexinside a selected workspace. - Allow the runtime temporary directories required by sandboxed execution.
- Start with process network egress restricted. The first required network expansion asks once and applies to the rest of the session.
- WebSearch and other brokered web tools remain separate product-tool exposure decisions; they are not controlled by
SandboxProfile.network. - Fail closed when Maka cannot enforce the advertised managed profile. An explicitly supplied external sandbox is valid; otherwise only the user may choose Bypass.
- PTY execution that cannot be sandboxed is unavailable in Auto and returns
requires_bypass.
Authoritative persistence and revision
Boundary state and boundary requests live in one settle-once log table in sessions.sqlite.
- Do not copy the current boundary into
SessionHeader. - Do not store new boundary requests in the legacy file-backed
InteractionStore. - Every session starts with a revision
0genesis row containing the full boundary snapshot. - An expansion request is inserted immutably with its normalized expansion, justification, and base revision.
- A denial settles only the request outcome and does not change the boundary revision.
- An approval runs in one SQLite
BEGIN IMMEDIATEtransaction: lock the pending request, load the current applied boundary, revalidate the immutable expansion, settle the canonical outcome, assign the next revision when the boundary changes, and persist the full resulting snapshot. - User-initiated Auto/Bypass changes are recorded in the same log with a new revision and full snapshot.
- Switching back to Auto restores the session's previously accumulated managed profile.
- The current boundary is the full snapshot with the highest applied revision, not a header copy or in-memory cache.
- The same request ID settles once and retries idempotently.
Concurrent approvals serialize through the same transaction. A stale request may still be approved when its immutable expansion remains valid against the current managed boundary; disjoint expansions merge without losing state. An expansion already present settles as an approved no-op without inventing a revision. A changed boundary kind or explicit-deny conflict settles as a conflict and never overwrites current state.
One boundary-expansion contract
The only expandable local authority is SandboxBoundaryExpansion:
type SandboxBoundaryExpansion = {
filesystem?: {
entries: Array<{
path: string;
access: "read" | "write";
scope: "exact" | "subtree";
}>;
};
network?: {
enabled: true;
};
};- Filesystem paths are normalized absolute paths.
- An expansion contains no deny rules, full profile, tool category, raw arguments, cwd, risk score, hash, TTL, or one-call grant.
- An expansion can only add authority and cannot remove or weaken explicit denies from the base profile.
- The normalized expansion shown to the user must exactly equal the expansion applied on approval.
Agent-requested expansion
Ordinary local tool schemas stay unchanged.
- A local filesystem or process tool that cannot run inside the current managed boundary returns structured
sandbox_boundary_requiredinformation with the smallest enforceable suggested expansion. - The Agent decides whether that authority is necessary.
- The Agent calls the dedicated built-in
request_sandbox_boundarytool with the expansion and an Agent-authored justification. - Runtime normalizes and validates the request before it becomes visible.
- On approval, the boundary transaction applies the expansion.
- The Agent retries the original tool call under the new boundary.
There is no proposal ID, ephemeral registry, TTL, or automatic retry of the original tool call. Bash must declare required path or network capability; command-string parsing is not an authorization mechanism. Sandbox diagnostics may suggest a narrow enforceable expansion but cannot grant authority, automatically open a prompt, or invent a broader request.
request_sandbox_boundary is available only to interactive local sessions. Browser, Computer Use, Office, MCP, connectors, and other broker-owned tools cannot use it.
requires_bypass
There is no one-call unsandboxed grant.
- An operation that cannot be expressed and enforced as a managed profile expansion returns structured
requires_bypassto the current tool invocation. - The failure remains in the same turn so the Agent can try a boundary-safe alternative.
requires_bypassdoes not create an interaction, prompt, transcript card, or automatic mode switch.- Only an existing user-facing Permissions control can enter Bypass.
- Entering Bypass always requires one explicit confirmation because it disables Maka sandbox enforcement.
Tool ownership
| Tool family | Enforcement owner |
|---|---|
| Bash and background shell | Current session sandbox profile |
| Read, Write, Edit, Glob, Grep, and other local filesystem tools | Sandboxed filesystem worker and current session profile |
| PTY | Current session profile when enforceable; otherwise unavailable in Auto |
| Browser, Computer Use, Office, and Rive | Tool exposure plus native broker and hard guards |
| MCP and remote connectors | Tool exposure plus server or connector scopes |
| Child agents and orchestration tools | Inherit the parent boundary or declare an explicit external boundary |
| Headless and Harbor tools | Explicit external isolation supplied by the harness |
The macOS Permission Center remains. Accessibility, screen recording, microphone, notifications, and Apple Events are operating-system prerequisites, not generic tool approvals.
Product surfaces
Desktop boundary prompt
SandboxBoundaryPrompt replaces the additional-permission and sandbox-escalation branches and renders in the stable composer interaction slot. It is not a modal and not an ordinary transcript tool card.
It shows only:
- a concise heading;
- the Agent-authored justification;
- each exact requested scope, humanizing read/write and exact/subtree;
RejectandAllow for this session.
It does not show revision, current profile, tool category, risk labels, raw arguments, technical state, remember controls, Stop, or duplicate lifetime copy.
The visual baseline follows the existing Maka composer system: chat-measure width, compact neutral surface, existing typography/tokens/buttons, no internal divider lines between scope entries, and no large warning wash. After settlement the interactive card leaves the composer slot and the result remains ordinary transcript history.
Desktop Permissions control
The user-facing Permissions selector contains only Auto and Bypass.
Selecting Bypass opens the existing AlertDialog pattern:
- title:
Switch to Bypass?; - state clearly that the current session will run without Maka sandbox enforcement;
- explain that host filesystem and network access become available and that Bypass is intended only for trusted, externally isolated environments;
- default focus and Escape keep Auto;
- actions are
Keep AutoandEnter Bypass.
The dialog uses a small warning icon and a destructive confirmation button, not a large red surface.
TUI boundary prompt
The boundary request remains an unboxed transcript block:
- one attention heading;
- Agent-authored justification;
- one line per exact expansion entry;
yor Enter allows for the session;nor Escape denies;- there is no
aaction and no detail disclosure for tool arguments.
The editor waits while the decision is pending. Narrow terminals wrap labels and values without losing the exact scope.
TUI Permissions control
Keep /permissions as the product entry point, but expose only auto | bypass.
/permissionsopens the existing bottom picker with Auto and Bypass./permissions auto|bypassremains available as a typed command.- Selecting Bypass opens a second bottom picker.
Keep Autois selected by default.- Arrow keys move, Enter selects, and Escape keeps Auto or closes the picker.
- There is no blind mode-cycling shortcut and no single key that immediately disables the sandbox.
- The status line shows
autoorbypass.
Non-interactive and external execution
maka rundefaults to Auto.maka runnever exposesrequest_sandbox_boundary, never prompts, and never expands authority.- A boundary-required tool call returns structured failure; the Agent may choose a boundary-safe approach, otherwise the run exits nonzero.
- Resuming a session restores its persisted boundary but still cannot expand it non-interactively.
--yolois the only explicit startup option for Bypass. There is no-yalias.- Remove
--permission-mode,--allow, and--deny. - Headless and Harbor use an explicitly supplied external boundary and never silently fall back to Auto or Bypass.
Migration and deletion
On first read, legacy sessions receive a genesis boundary:
askandexecutebecome managed Auto workspace-write;explorebecomes the internal managed read-only boundary required by its owning product flow and is no longer user-selectable;bypassbecomes Bypass.
At startup, pending legacy tool_permission, additional_permissions, and sandbox_escalation interactions settle with the existing host_restarted outcome and leave the pending queue. Settled historical events remain readable but never route new execution through a compatibility executor.
Delete the superseded production paths in the same PR:
PermissionEngine;PermissionMode × ToolCategory;- Bash risk classification used for authorization;
- remembered tool scopes and auto reviewers;
- invocation/turn grants, TTL, consumption, intent hashes, and command hashes;
- generic permission responses and
permissionRequired; - authorization uses of
categoryHint; - additional-permission and sandbox-escalation protocols/executors;
- the legacy Desktop
PermissionPrompt, summaries, risk tones, diffs, remember checkbox, styles, copy, stories, and tests; - the generic TUI permission card, remember-for-turn state, and
akey; - Ask/Execute/Explore user-facing controls and old CLI flags.
Preserve protocol-specific hard guards, tool availability, audit history, the OS Permission Center, and native capability onboarding.
Delivery plan
One flat PR from the latest main, implemented with TDD and organized as reviewable green commits:
- Add core contracts and the single authoritative SQLite boundary log, including migration, atomic settlement, and concurrency behavior.
- Make runtime and sandbox execution read the current boundary for every invocation; add
request_sandbox_boundary, structured boundary failures,requires_bypass, and legacy-pending closure. - Wire the Desktop/shared UI and TUI boundary prompts plus Auto/Bypass controls.
- Finish
maka runand external-boundary behavior, then delete the complete generic permission system and legacy modes. - Run focused tests, formatting/lint/typecheck, the full workspace test suite, and one representative Desktop fake-backend E2E journey.
Acceptance
Core and storage
- Expansion validation permits only normalized additive filesystem/network authority.
- Explicit denies cannot be weakened.
- Genesis migration is deterministic for every legacy mode.
- Approval outcome and boundary update are atomic across process failure.
- Concurrent stale approvals cannot lose state or over-grant.
- Duplicate settlement is idempotent.
- No-op and conflict outcomes preserve revision semantics.
- Resume restores the effective session boundary.
- Legacy pending permission interactions close fail-safe after upgrade.
Runtime and sandbox
- Auto runs ordinary workspace reads, writes, edits, deletion, Bash, and local Git without generic approval.
.git,.agents, and.codexinside the workspace are writable under the sandbox.- Filesystem, foreground/background shell, PTY where supported, and process network execution use the current session profile on every invocation.
- Outside-workspace access cannot execute before an approved exact session expansion.
- Process network access cannot execute before an approved session expansion.
- The approved expansion equals the displayed expansion.
- A rejected expansion changes no authority.
- An operation requiring unsandboxed execution cannot run until the user switches the session to Bypass.
- Browser, Computer Use, Office, MCP, connector, and orchestration tools cannot request local boundary expansion.
- Child agents inherit the parent boundary.
- Managed execution fails closed when enforcement is unavailable.
Product and CLI
- Desktop and TUI match the approved prompt, keys, Auto/Bypass controls, and Bypass confirmation.
- Non-interactive Auto cannot register or invoke the request tool and fails closed on unavoidable boundary requirements.
- Only
--yolostarts non-interactive Bypass. - External harness execution remains explicit.
- Deep Research remains internally read-only.
- No live production reference remains to the old permission matrix, grants, modes, prompts, or escalation executors.
Implementation constraints
- Do not split the work by package; code for one behavioral invariant ships together.
- Do not merge a temporary dual permission/boundary state.
- Do not keep old permission execution as a fallback after migration.
- Do not introduce a universal capability language for Browser, Computer Use, Office, MCP, or connectors.
- Do not parse shell commands to infer authority.
- Do not treat user-mentioned paths as implicit authorization.
- Do not automatically switch to Bypass.
- Do not claim that Git, audit logs, or the local process sandbox contain native or remote tools.
- Do not add another cleanup PR unless implementation reveals a concrete, independently fixable executor gap.
展开中文实施方案
当前状态
方案已确认,可以开始实施。这个 issue 没有尚未收口的设计问题。
这个 issue 由一个端到端 PR 完成。此前的两 PR 拆分已经作废,因为它会先把临时的 permission/boundary 双轨状态合入 main,为此增加模式同步和重复 Prompt,然后马上再删除这些过渡代码。实现过程可以拆成多个便于审查、始终保持绿色的 commit,但 main 只接收最终架构。
Issue 正文是行为契约的权威来源。讨论区评论不会重新打开已经确认的决定,除非正文被明确更新。
要做到什么
让会话中可执行的真实边界成为唯一权威:
- Auto workspace 内的普通本地工作不再逐工具审批;
- 只有越过当前 sandbox profile 时,才能请求增加本地权限;
- 用户批准的是当前会话的边界扩张,不是某一次工具调用;
- 无法留在 sandbox 内执行的操作返回
requires_bypass; - 只有用户明确操作才能进入 Bypass;
- 已暴露的 Browser、Computer Use、Office、MCP、connector 和编排工具由各自的 broker 与硬限制负责,不再经过通用 runtime 审批;
- 被替代的权限矩阵、grant、模式、Prompt 和 CLI 参数在同一个 PR 中删除。
已确认设计
每个会话只有一个执行边界
每个会话拥有一份权威边界:
type ExecutionBoundary =
| {
kind: "managed";
profile: SandboxProfile;
revision: number;
}
| {
kind: "bypass";
revision: number;
}
| {
kind: "external";
revision: number;
};- 普通 Auto 会话使用 managed workspace-write profile。
- Bypass 表示 Maka 不再提供 sandbox enforcement。
- Deep Research 使用内部 managed read-only profile 和收窄的工具面,不是第三种用户可选模式。
- Harbor 等 Headless runner 可以声明明确的 external isolation boundary。
- Desktop 和 TUI 从这份 boundary 推导 Auto 或 Bypass,不再保存第二份 permission-mode 权威状态。
Auto 基础 profile
- 所有选中 workspace root 都可读写。
- 普通编辑、删除、Shell 命令和本地 Git 操作直接执行。
- 不再特殊禁止写入 workspace 内的
.git、.agents或.codex。 - 允许 sandbox 执行所需的 runtime 临时目录。
- 进程出网默认受限。第一次确实需要网络 expansion 时询问一次,批准后对本会话持续有效。
- WebSearch 等 broker web 工具仍由独立的产品工具暴露策略控制,不属于
SandboxProfile.network。 - Maka 无法落实 advertised managed profile 时 fail closed。调用方明确提供 external sandbox 时可以使用;否则只有用户可以选择 Bypass。
- PTY 无法 sandbox 时在 Auto 中不可用,并返回
requires_bypass。
权威持久化与 revision
Boundary 状态和 boundary 请求统一写入 sessions.sqlite 中一张 settle-once log 表。
- 不把当前 boundary 复制到
SessionHeader。 - 新 boundary 请求不写入旧的文件型
InteractionStore。 - 每个会话从 revision
0的 genesis 行开始,其中保存完整 boundary snapshot。 - Expansion 请求先以 immutable 形式写入,包括规范化后的 expansion、理由和 base revision。
- 拒绝只结算 request outcome,不改变 boundary revision。
- 批准在一个 SQLite
BEGIN IMMEDIATE事务内完成:锁定 pending request、读取当前 applied boundary、针对当前状态重新验证 immutable expansion、结算 canonical outcome、在 boundary 实际变化时分配下一 revision,并写入完整 resulting snapshot。 - 用户主动切换 Auto/Bypass 也写入同一张 log,产生新 revision 和完整 snapshot。
- 切回 Auto 时恢复本会话此前累积的 managed profile。
- 当前 boundary 取 applied revision 最高的完整 snapshot,不取 SessionHeader 副本或内存缓存。
- 同一个 request ID 只结算一次,重试保持幂等。
并发批准通过同一事务串行化。Stale request 的 immutable expansion 如果对当前 managed boundary 仍然有效,可以继续批准;互不冲突的 expansion 依次合并,不丢状态。已经包含的 expansion 作为 approved no-op 结算,不虚构 revision。Boundary kind 已变化或与 explicit deny 冲突时结算为 conflict,绝不覆盖当前状态。
唯一 boundary expansion 契约
唯一可扩张的本地权限是 SandboxBoundaryExpansion:
type SandboxBoundaryExpansion = {
filesystem?: {
entries: Array<{
path: string;
access: "read" | "write";
scope: "exact" | "subtree";
}>;
};
network?: {
enabled: true;
};
};- 文件系统路径必须是规范化后的绝对路径。
- Expansion 不包含 deny、完整 profile、工具类别、raw arguments、cwd、risk、hash、TTL 或单次 grant。
- Expansion 只能增加权限,不能移除或弱化 base profile 的 explicit deny。
- 用户看到的规范化 expansion 必须与批准后实际应用的 expansion 完全一致。
由 Agent 发起 expansion
普通本地工具的 schema 保持不变。
- 本地文件或进程工具无法在当前 managed boundary 内运行时,返回结构化
sandbox_boundary_required,并给出最小可 enforce 的建议 expansion。 - Agent 判断这份权限是否确实必要。
- Agent 调用专用内置工具
request_sandbox_boundary,传入 expansion 和 Agent 自己撰写的理由。 - Runtime 在请求展示给用户前重新规范化并验证。
- 用户批准后,boundary transaction 应用 expansion。
- Agent 在新 boundary 下重试原工具调用。
不存在 proposal ID、临时 registry、TTL,也不由 runtime 自动重试原工具调用。Bash 必须主动声明需要的路径或网络能力,不能解析 command string 来猜权限。Sandbox diagnostics 可以建议一份窄且可 enforce 的 expansion,但不能授予权限、自动弹出 Prompt 或发明更宽的请求。
request_sandbox_boundary 只提供给交互式本地会话。Browser、Computer Use、Office、MCP、connector 和其他由 broker 负责的工具不能调用它。
requires_bypass
不再有单次 unsandboxed grant。
- 无法表达并落实为 managed profile expansion 的操作,对当前工具调用返回结构化
requires_bypass。 - 失败留在同一轮中,Agent 可以尝试 boundary-safe 替代方案。
requires_bypass不创建 interaction、Prompt、transcript card,也不自动切换模式。- 只有现有用户可见的 Permissions 控件可以进入 Bypass。
- 每次进入 Bypass 都需要一次明确确认,因为它会关闭 Maka sandbox enforcement。
工具职责
| 工具类型 | Enforcement owner |
|---|---|
| Bash 和后台 Shell | 当前会话 sandbox profile |
| Read、Write、Edit、Glob、Grep 等本地文件工具 | Sandboxed filesystem worker 和当前会话 profile |
| PTY | 可 enforce 时使用当前会话 profile;否则 Auto 中不可用 |
| Browser、Computer Use、Office、Rive | 工具暴露状态、原生 broker 和硬限制 |
| MCP 和远程 connector | 工具暴露状态、server 或 connector scope |
| 子 Agent 和编排工具 | 继承父会话 boundary,或声明明确的 external boundary |
| Headless 和 Harbor 工具 | Harness 提供的明确 external isolation |
macOS Permission Center 继续保留。辅助功能、屏幕录制、麦克风、通知和 Apple Events 是操作系统前置条件,不是通用工具审批。
产品界面
Desktop boundary Prompt
SandboxBoundaryPrompt 替代 additional-permission 和 sandbox-escalation 分支,渲染在稳定的 composer interaction slot 中。它不是 modal,也不是普通 transcript tool card。
只显示:
- 简短标题;
- Agent 撰写的理由;
- 每一项精确申请范围,并用人话表达 read/write 与 exact/subtree;
拒绝和本会话允许。
不显示 revision、当前 profile、工具类别、风险标签、raw arguments、技术状态、remember 控件、Stop 或重复的有效期说明。
视觉沿用 Maka 现有 composer 系统:chat-measure 宽度、紧凑中性 surface、既有 typography/token/button、scope entry 之间没有内部横线,也没有大面积 warning 色。结算后交互卡离开 composer slot,结果作为普通 transcript history 留存。
Desktop Permissions 控件
用户可见的 Permissions selector 只包含 Auto 和 Bypass。
选择 Bypass 后打开现有 AlertDialog:
- 标题为
切换到 Bypass?; - 明确当前会话将不再受 Maka sandbox enforcement;
- 说明 host filesystem 和 network 将可访问,Bypass 只适用于可信且已有外部隔离的环境;
- 默认 focus 和 Escape 都保持 Auto;
- 操作为
保持 Auto和进入 Bypass。
Dialog 使用一个小 warning icon 和 destructive 确认按钮,不使用大面积红色 surface。
TUI boundary Prompt
Boundary 请求使用无边框 transcript block:
- 一行 attention heading;
- Agent 撰写的理由;
- 每项精确 expansion 单独一行;
y或 Enter 为本会话允许;n或 Escape 拒绝;- 没有
a,也没有 tool arguments detail disclosure。
Decision pending 时 editor 等待。窄终端可以换行,但不能丢失精确 scope。
TUI Permissions 控件
保留 /permissions 作为产品入口,但只暴露 auto | bypass。
/permissions打开现有 bottom picker,只有 Auto 和 Bypass。/permissions auto|bypass保留 typed command 入口。- 选择 Bypass 后打开第二层 bottom picker。
- 默认选中
Keep Auto。 - 方向键移动、Enter 选择、Escape 保持 Auto 或关闭 picker。
- 不增加盲切模式快捷键,也没有任何单键可以立即关闭 sandbox。
- Status line 显示
auto或bypass。
非交互与 external execution
maka run默认 Auto。maka run不暴露request_sandbox_boundary、不弹 Prompt、也不扩张权限。- 工具撞到 boundary 时返回结构化失败;Agent 可以选择 boundary-safe 方案,否则 run 非零退出。
- Resume 会话恢复其持久化 boundary,但非交互运行仍然不能扩张。
--yolo是唯一显式启动 Bypass 的参数,不提供-yalias。- 删除
--permission-mode、--allow和--deny。 - Headless 和 Harbor 使用调用方明确提供的 external boundary,绝不静默回落到 Auto 或 Bypass。
迁移与删除
首次读取旧会话时写入 genesis boundary:
ask和execute迁移为 managed Auto workspace-write;explore迁移为其 owning product flow 所需的内部 managed read-only boundary,并从用户可选模式中删除;bypass迁移为 Bypass。
启动时,仍 pending 的旧 tool_permission、additional_permissions 和 sandbox_escalation interaction 使用现有 host_restarted outcome 结算,并离开 pending queue。Settled 历史事件保持可读,但新的执行绝不经过 compatibility executor。
同一个 PR 中删除所有被替代的生产路径:
PermissionEngine;PermissionMode × ToolCategory;- 用于授权的 Bash risk classification;
- remembered tool scope 和 auto reviewer;
- invocation/turn grant、TTL、consume、intent hash 和 command hash;
- generic permission response 和
permissionRequired; categoryHint的授权职责;- additional-permission 和 sandbox-escalation protocol/executor;
- 旧 Desktop
PermissionPrompt、summary、risk tone、diff、remember checkbox、style、copy、story 和 test; - generic TUI permission card、remember-for-turn state 和
a键; - Ask/Execute/Explore 用户控件和旧 CLI flags。
保留协议自身的 hard guard、工具可用性、audit history、OS Permission Center 和原生 capability onboarding。
交付计划
从最新 main 创建一个 flat PR,使用 TDD,并按便于审查、始终绿色的完整意图组织 commit:
- 增加 core contract 和单一权威 SQLite boundary log,包括迁移、原子 settlement 和并发语义。
- 让 runtime 和 sandbox 每次执行都读取当前 boundary;增加
request_sandbox_boundary、结构化 boundary failure、requires_bypass和 legacy pending 收尾。 - 接通 Desktop/shared UI、TUI boundary Prompt 和 Auto/Bypass 控件。
- 完成
maka run与 external-boundary 行为,然后删除完整 generic permission 系统和旧模式。 - 运行聚焦测试、format/lint/typecheck、完整 workspace test suite,以及一条代表性的 Desktop fake-backend E2E journey。
验收标准
Core 与 storage
- Expansion validation 只允许规范化、只增不减的 filesystem/network 权限。
- Explicit deny 不能被弱化。
- 每一种旧模式都能确定性迁移为 genesis。
- Approval outcome 和 boundary update 在进程故障下仍保持原子性。
- 并发 stale approval 不会丢状态或过度授权。
- 重复 settlement 保持幂等。
- No-op 和 conflict outcome 保持正确 revision 语义。
- Resume 恢复有效会话 boundary。
- 升级后 legacy pending permission interaction fail-safe 关闭。
Runtime 与 sandbox
- Auto 下普通 workspace read/write/edit/delete、Bash 和本地 Git 不再通用审批。
- Workspace 内
.git、.agents和.codex在 sandbox 内可写。 - Filesystem、前后台 Shell、受支持的 PTY 和进程网络在每次调用时使用当前会话 profile。
- Workspace 外访问在批准精确 session expansion 前不能执行。
- 进程网络在批准 session expansion 前不能执行。
- 实际批准的 expansion 与界面展示完全一致。
- 拒绝 expansion 不改变任何权限。
- 需要 unsandboxed execution 的操作在用户切换整个会话到 Bypass 前不能运行。
- Browser、Computer Use、Office、MCP、connector 和编排工具不能请求本地 boundary expansion。
- 子 Agent 继承父会话 boundary。
- Enforcement 不可用时 managed execution fail closed。
产品与 CLI
- Desktop 和 TUI 符合确认过的 Prompt、按键、Auto/Bypass 控件和 Bypass confirmation。
- 非交互 Auto 无法注册或调用 request tool,遇到不可避免的 boundary requirement 时 fail closed。
- 只有
--yolo可以启动非交互 Bypass。 - External harness execution 保持显式。
- Deep Research 保持内部只读。
- 生产代码不再引用旧 permission matrix、grant、mode、Prompt 或 escalation executor。
实施约束
- 不按 package 横向拆分;属于同一行为不变量的代码一起交付。
- 不合入临时的 permission/boundary 双轨状态。
- 迁移后不保留旧 permission execution 作为 fallback。
- 不为 Browser、Computer Use、Office、MCP 或 connector 引入万能 capability language。
- 不解析 Shell command 来推断权限。
- 不把用户提到的路径当成隐式授权。
- 不自动切换到 Bypass。
- 不声称 Git、audit log 或本地 process sandbox 能约束原生或远程工具。
- 除非实施中发现一个具体、可独立修复的 executor gap,否则不增加 cleanup PR。
Activity
[-]design(runtime): replace per-tool permissions with sandbox boundaries[/-][+]feat: replace per-tool approvals with sandbox boundaries[/+]sunheyi6 commentedon Jul 28, 2026
Discussion notes: open questions + product invariant
Sharing a product-oriented reading of the open questions, grounded in how we want Auto to feel day to day. Not an implementation plan.
Product invariant (north star)
Inside a selected workspace under real Auto (managed sandbox):
Process egress vs WebSearch must stay distinct:
npm,git,curl, …) may use the networkprofile.networkSandbox
networkin the profile is about process egress, not about whether WebSearch is in the tool list.Q1 — Auto base network
Proposal: process egress enabled by default in Auto.
Rationale:
npm install,git pull/push, registries, etc.If Auto starts with
network: restricted, the common path fights the product invariant above. Prefer Auto base = workspace FS full + network enabled; keep WebSearch on a separate exposure switch.Q2 — Platform cannot enforce the advertised sandbox
Proposal: no fake Auto — fall through to Bypass and still work automatically.
Fail closed only when the user is already on a sandboxed path and enforcement fails mid-flight (refuse silent downgrade). Do not make the whole product unusable on platforms without a backend (e.g. Windows today). Optional external isolation (Docker/WSL/remote) can upgrade boundary later; it should not be the default onboarding gate.
From a “can I get work done?” perspective Auto-with-sandbox and Bypass are similar; the difference is honest containment labeling, not a second permission ladder.
Q3 — What still hits the boundary, and recovery
Under the invariant, routine in-workspace work should not hit permission prompts.
Typical remaining cases:
User-provided out-of-workspace paths (session-scoped):
Optional parallel for user-supplied URLs (WebFetch/broker): session-scoped allow via exposure + hard guards (SSRF, etc.), not via OS sandbox path grants. Local paths stay on the FS profile path.
Recovery:
sandbox_boundary_requestUI; never auto-approve; never auto-switch to Bypass.Q4 — What must sit behind the sandbox before removing the old matrix
Reading of current ownership (runtime builtins, filesystem worker, desktop tool assembly):
Must enforce session sandbox / same profile (delete old permission only after this)
SandboxManagerunder Auto; if not enforceable → session is BypassAuto-available without OS-sandbox wrapping; side effects still use A
Not OS workspace sandbox; exposure + native broker
officecliunless we deliberately go thereDelete criterion sketch: under Auto, Bash and FS tools always honor the session profile; platforms without enforcement only offer Bypass/External; WebSearch off unless enabled; no
PermissionMode × ToolCategoryfallback.Suggested closure language for the open questions
Happy to adjust any row if product wants a stricter out-of-workspace default (always prompt when the agent initiates, even with a clear path) — the invariant above optimizes for “workspace enclosure, minimal interrupts.”
展开中文讨论
讨论纪要:开放问题 + 产品不变量
下面是对 RFC 开放问题的产品向读法,核心是 Auto 日常应有的手感,不是实现排期。
产品不变量(北极星)
在真实 Auto(managed sandbox)且已选定工作区时:
进程出网 vs WebSearch 必须分开:
npm/git/curl…)能否上网profile.networkProfile 里的 sandbox
network管的是 进程出网,不是工具列表里有没有 WebSearch。Q1 — Auto 默认网络
建议:Auto 下进程出网默认开启。
若 Auto base 仍是
network: restricted,会和上面的不变量打架。更贴产品的是:工作区 FS 全开 + network enabled;WebSearch 单独用暴露开关。Q2 — 平台 enforce 不了 advertised sandbox
建议:禁止假 Auto;直接 Bypass,照样自动干活。
Fail closed 只用于:已在沙箱路径上、执行中 enforce 失败 → 拒绝静默降级。不要让无 backend 的平台(如当前 Windows)整站不能用。Docker/WSL/远端等 External 可作为以后升级边界的选项,不必当默认上手门槛。
「能不能干活」上 Auto 与 Bypass 接近;差别是 隔离是否诚实标注,不是再叠一层审批。
Q3 — 还会撞边界的场景与恢复
在不变量下,工作区内日常工作不应再弹权限。
仍可能遇到的:
用户指定的区外路径(仅当前会话):
用户给出的 URL(若走 WebFetch/broker):可按本会话允许 + SSRF 等硬限制处理,不走 OS 路径 grant。本地路径仍走 FS profile。
恢复:
sandbox_boundary_request;绝不自动批准;绝不自动切 Bypass。Q4 — 删旧矩阵前,谁必须进沙箱/同 profile
结合当前 runtime builtins、filesystem worker、desktop 组装:
必须先落实(否则删旧 permission 会裸奔)
SandboxManager;不能 enforce → 会话为 BypassAuto 下直接可用,不必 OS 包一层;副作用仍走上面
不进 OS workspace sandbox:暴露 + 原生 broker
删除旧路径的门槛草案: Auto 下 Bash 与 FS 始终遵守会话 profile;无 enforce 能力的平台只提供 Bypass/External;WebSearch 未开启则不在工具面;不再用
PermissionMode × ToolCategory兜底。开放问题收敛表述(建议)
若产品希望「Agent 主动出区外即使路径明确也一律弹窗」,可以再收紧;上面不变量优先的是:工作区围栏清晰,围栏内少打断。
Astro-Han commentedon Jul 28, 2026
I’m claiming this issue.
After shaping the implementation against the current
main, I plan to deliver the final state in one end-to-end PR rather than merge a temporary dual permission/boundary state first. The PR will make the session-scopedExecutionBoundarythe single sandbox authority across core/storage/runtime, Desktop/shared UI, TUI, and non-interactive CLI; replace additional-permission and sandbox-escalation flows with explicit session boundary expansion; and remove the superseded generictool_permission/PermissionEngine, Ask/Execute modes, legacy prompt, and old CLI flags in the same change.I’ll implement it with TDD, keep the work organized as reviewable green commits, preserve fail-closed non-interactive behavior, and include migration/restart/concurrency coverage.
Astro-Han commentedon Jul 28, 2026
Thanks for writing this up. Clarifying the implementation scope before work starts: #1564 has no open design questions at this point; the issue body is the accepted behavioral contract.
This implementation will not adopt the alternative proposals in this comment:
request_sandbox_boundarywith an Agent-authored justification. Sandbox stderr alone cannot grant authority or invent a broader request.The aligned ownership points—Bash/filesystem enforcement through the session profile, child-agent inheritance, and broker-owned non-local tools—are already part of the accepted design.
A proposal to change any of the invariants above should be handled as a separate issue/RFC rather than folded into this implementation. The claim comment supersedes only the old two-PR delivery split; I will update the issue body accordingly so the accepted contract remains unambiguous.