Skip to content

Integrate Universal Code access and three-mode permissions - #239

Merged
Qiyuanqiii merged 178 commits into
mainfrom
codex/uc-integration-review-20261003
Oct 4, 2026
Merged

Qiyuanqiii merged 178 commits into
mainfrom
codex/uc-integration-review-20261003

Conversation

@NanaseInori

@NanaseInori NanaseInori commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

概述

本 PR 将 portable Agent Skills、标准 Agent Plugins、MCP 协议适配 以及 ask / auto / full 三档权限体系 正式接入现有的 Run / Thread 运行架构,并全面收敛命令执行、操作审批、后台任务与故障恢复路径。

本轮重点是让接入能力统一复用既有的执行与权限底座,彻底退役被替代的废弃旧入口,并修复跨平台集成缺陷。本次改动属于 Universal Code 的基础底座迁移,并不代表全生态插件兼容及完整产品验收已全部就绪。

主要改动

1. Skills、Plugins 与 MCP 协议接入

  • 受控数据化加载:将 portable Agent Skills 与标准 Agent Plugins 作为受控数据加载,复用现有插件生命周期与原生工具调用路径
  • MCP SDK 深度适配:整合 MCP 协议栈与连接适配层,严密治理调用取消(Cancellation)、连接保活与调用回执(Receipt)状态机
  • 生态差异保留:保留必要的生态原生扩展能力,明确界定不同生态插件的语义边界,不作等价性夸大

2. 收敛三档权限与操作审批机制

  • 全链路对齐三档权限:将运行时权限统一为 ask / auto / full,同步拉齐 CLI、API、Desktop、Run / Thread 以及测试夹具
  • 副作用产生前复核:针对命令执行、Batch、GitHub review 等操作复用公共操作授权(Operation Authority),在实际生效前动态校验执行权限、工作区上下文与调用身份
  • Full 权限调用期隔离(Invocation-Scoped):CLI Full 授权严格限制在本次调用生命周期内,调用结束即行撤销;历史持久化记录绝不作为冷态执行许可
  • 网络访问解耦控制:三档模式下均提供联网工具接入路径,但实际请求严格受制于域名白名单策略与既有审批流
  • 明确 Auto 模式边界:Auto 模式未引入模型自主审批机制,不声明与 Codex 或 Claude Code 同名模式完全等价

3. 统一命令执行与任务生命周期

  • 统一收敛至 Command Runtime:所有命令执行接入 command-runtime.v2 / Job 独占 Lease 机制,通过统一账本管理进程启动、分页输出、异步等待、取消中断与资源回收
  • 消除越权进程启动隐患:已完成启动的调用仅能操作属于自身且处于活跃状态的 Job,杜绝借由历史 Job 擅自拉起新进程
  • 后台任务生命周期治理:修复后台任务跨 turn / lease 的所有权校验、权限撤销感知、工作区漂移防护以及 UI 资源释放逻辑
  • 修复 SQLite 心跳并发竞态:将所有权续期写入与读回取消合并入单事务原子执行,消除心跳 CAS(Compare-And-Swap)版本冲突,同时保留真实竞争与未知状态语义
  • 对齐 Checkpoint 与上下文压缩:纠正上下文压缩与 Checkpoint 恢复时序,避免出现“状态已更新但实际压缩或文件操作未落地”的数据假死

4. 彻底退役旧执行通道,保留历史只读审计(落地 ADR 0165)

  • 清理废弃执行器与路由:全面废弃 Controlled 命令、Once 运行器、Host proposal 以及 Risk 提权相关的创建、审批与执行写入路径,连带移除启动 Flag、执行包装及旧 review POST 路由
  • 清理冗余代码:同步删除已废弃入口对应的专属测试套件、配置接线与过渡期诊断代码
  • 证据链与不可变账本保留:完整保留历史 Schema 迁移、审计表、执行回执与只读查询端点(GET),支持对已有终态结果的精确重放与续接
  • 核心安全原则约束:严格遵守**“副作用未知绝不重发(Uncertain Intent Never Retries)”**原则;读取历史数据不复活旧执行权限,严禁盲目重放历史操作

5. Windows 与跨平台兼容性修复

  • 工作区规范路径与 Junction 解析:工作区首次登记统一采用规范化根路径,保持历史登记身份;Windows 环境下改用目录句柄(Directory Handles)精确解析 Junction / Symlink,根除路径大小写与重定向漏洞
  • 测试夹具同步:同步基于根路径断言的测试用例,完整覆盖目录漂移、历史身份一致性及敏感路径防泄漏断言
  • 优化 Desktop Smoke 测试时序:调整窗口 Ready 侦听、安全退出与临时目录清理顺序,避免清理异常反向掩盖真实的运行期错误
  • 测试预算与生产超时解耦:两项耗时较长的 PowerShell 功能测试显式配置 60 秒测试预算;生产环境严格维持默认 30 秒、上限 120 秒边界,且独立的超时、取消、隔离及进程回收测试均获保留

验证结果

  • 验证基准 Commit:42f1236c79f7e680e9be34f76a7ed747b4261d60
  • CI 流水线执行情况:

已通过的检查包括:

  • Go 完整测试套件、8 个 Store 存储分片、关键权限与授权边界的 Race 检查、vet 以及 govulncheck
  • TypeScript、Rust、三平台 LSP、真实 Edge UI 测试,以及 macOS Desktop 双架构打包构建
  • Windows 命令审批流、独立 stdin 授权与撤销、跨 turn / lease 任务、中断取消及精确 Job 资源清理
  • Windows Junction 初始化与导入、Transport、Analyzer 校验步骤、Portable 构建与校验
  • Windows 打包应用 Bootstrap 引导、平滑退出、环境清理及凭证哨兵(Credential Sentinel)未落盘扫描

验证边界声明:Analyzer 检查步骤中的两项原生隔离观测因空输出 0xc0000142 触发既有 CI 跳过分支,未取得实际行为通过证据;此外,签名认证与正式发布 Job 按规跳过,不代表已完成商业发布流程。

代码规模

相对于 main 主线分支,本 PR 共涉及 831 个文件,新增 59,291 行 / 删除 24,172 行(净增 35,119 行)。

  • 收敛阶段数据(e950a41d 至最终提交):实现净减少 11,435 行(其中生产代码删除 10,214 行、新增 2,266 行,生产净减 7,948 行)
  • 该阶段显著移除了旧通道代码,但由于前序引入了大量标准化基建,整个 PR 总体代码量尚未达到全局净削减,后续批次将继续推进精简与去重。

已知限制与后续范围

  • 尚未完成所有外部插件生态兼容或外部 agent 编排
  • 两项 PowerShell 测试调大预算仅用于隔离功能验证与性能耗时考核,不代表底层性能瓶颈已完全优化
  • 打包扫描曾偶现文件持续不可读,本次通过且追加了最小脱敏诊断,但历史根因未彻底确认;没有跳过不可读文件或放宽扫描门禁
  • 尚未取得完整 39 case / 73 backend run 安全矩阵,以及四语言 × Local / Docker 的 8 个真实产品闭环和人工 Windows UX 验收证据;发布状态维持为 needs_full_matrix
  • 原生 analyzer 产品执行入口维持关闭,正式代码签名、应用商店上架流与发布验收仍待后续跟进
  • 两份文档中仍存在旧 40 / 75 矩阵计数遗留,需与当前 39 / 73 同步

本 PR 的验收结论限定为接入适配、执行链与权限模型的重构迁移,以及当前 Commit CI 的闭环收敛

@Qiyuanqiii
Qiyuanqiii marked this pull request as ready for review October 4, 2026 06:33
Qiyuanqiii and others added 10 commits October 4, 2026 20:17
Replace proposal, Once, Host and Risk execution producers with current
command-runtime operation authority while preserving historical evidence and
exact saved-outcome continuation. Remove obsolete execution flags, review
routes, UI controls, writers, wrappers and their exclusive tests.

Keep background ownership independent of completed Supervisor turns without
relaxing native launch or stdin authorization. Fix context compaction ordering,
current Full activation wiring, terminal/UI cleanup and packaged ledger paths.
Add bounded fake-transport regressions and runner-only Windows diagnostics.
Align CLI fixtures with Thread permission and resolved workspace identity;
preserve exact operator confirmation and retired tool boundaries.
Use one start/wait Job for every operator command and retain its
original timeout, output policy, authorization, and receipt identity.
Bind the fixed PowerShell profile through existing normalization.
Model checkpoint undo/redo with a real FileTool mutation boundary.

Co-authored-by: Codex <codex@openai.com>
Require first lease release instead of replay and verify its stored state.
Check retired Host flags against the usage response and unchanged Job ledger.
Run existing fixed operator and native tests serially while retaining
both results and preserving the operator-first launch order.

Co-authored-by: Codex <codex@openai.com>
Remove the three remaining unreferenced Controlled native helpers.
After the original fixed-operator gate fails, derive an isolated Go overlay
for a 400-file raw native phase probe. Preserve the original pipeline,
token, Job limits, timeout and failed gate; never write back to checkout.

Co-authored-by: Codex <codex@openai.com>
Require the existing smoke startup budget to reach a native window, and
accept only a successful close request followed by a natural zero exit.
Preserve startup failures during cleanup and report lifecycle state.
Split the failure-only fixed PowerShell overlay into the three original
cmdlet stages without changing production code, privileges or budgets.

Co-authored-by: Codex <codex@openai.com>
…ostics

Give the two PowerShell correctness fixtures explicit 60-second requests
while preserving the production 30-second default, 120-second cap, and
independent timeout, isolation, output, replay and cleanup checks.
Remove temporary ownership/native trace and phase-overlay wiring, retaining
ownership failure behavior coverage without its diagnostic logger.

Co-authored-by: Codex <codex@openai.com>
…rors

Preserve existing workspace registrations, bind new roots to their canonical
directory, and reuse create-if-absent instead of name-based root upserts.
Correct Windows authority fixtures and propagate approval resume errors.
Retain packaged sentinel scan failures with bounded redacted I/O facts
without changing scan, sharing, retry, timeout or process cleanup behavior.

Co-authored-by: Codex <codex@openai.com>
Keep exact default Workspace identity and location checks while accepting
the canonical root now persisted by initial registration on macOS and Windows.
Check that the closed CLI planning envelope leaks neither the caller root
spelling nor the canonical root used by the planner.

Co-authored-by: Codex <codex@openai.com>
Replace EvalSymlinks for Windows workspace registration with final-path
resolution on a held directory handle, without a fallback or changes to
historical registrations and execution authority. Cover direct-junction
imports and historical alias descendants in the existing Windows gate.

Co-authored-by: Codex <codex@openai.com>
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.

2 participants