Skip to content

Keep managed Chat workspace checker reads portable - #8814

Merged
loopx-agent merged 1 commit into
mainfrom
codex/workspace-checker-posix-portability-20261115
Nov 15, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/workspace-checker-posix-portability-20261115

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal and delivered outcome

The portability check in the Windows job on #8266 exits while formatting the violations. The current main branch has the same two files. The checker used six direct references to POSIX-only flags, which exceeded its per-module ceiling. Windows job

Read the three flags once and require both those flags and descriptor-relative opens before reading any workspace file. Reuse the validated flags for each open. The check now reports the violating file and line. This targets main.

Author declaration

Written by Codex, OpenAI. Implemented against the existing POSIX flag ceiling and workspace checker source safety contract at c5ff8fdc32b6a6b806cf91f4c0154d912a381e8e.

Criterion Disposition Verification
Enforce the existing per-module flag ceiling Implemented tests/architecture/test_posix_flag_portability.py
Require descriptor-relative and no-follow reads Implemented tests/control_plane/test_goal_session_check_preparation.py
Report a usable diagnostic for a violation Implemented Injected one over-ceiling site and checked the file and line in the assertion

Validation

Tested revision 0e6b5c7695ae529cc20ca71b544167000f46c641. Local runs finished using synthetic fixtures.

Check Result Evidence
Regression parity Passed The original #8266 tree fails the portability check during diagnostic rendering. The same test suite passes with this patch applied to that tree.
Integration Passed uv run --extra test python -m pytest -q tests/architecture/test_posix_flag_portability.py tests/control_plane/test_goal_session_check_preparation.py passed 140 tests on macOS.
Negative cases Passed Removing each required flag produces the existing safety refusal. A synthetic violation reports its file and line.
Windows CI Pending The original failing Windows job is linked above. This revision awaits hosted Windows validation.

Scope and continuation

The fix is complete in this branch. After review and integration on main, the C1 branch can pick it up through its normal synchronization. The existing Chat action and visual states use the same preparation route. UI impact is none.

  • Bug fix
  • Test update

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent / gpt-6.1-sol / OpenAI / runtime_reported / reasoning effort max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

维护 Chat 验收流程的人需要从原工作区准备独立检查,并能定位可移植性测试发现的违规。 基线在发现直接引用 POSIX 专用常量时,先在格式化诊断的位置抛出 ValueError,维护者得不到文件和行号。候选移除了当前违规点。把同类直接引用放入隔离模块后,测试给出了具体文件和行号。

File 和 SQLite 上都从原工作区读取了独立检查源的 digest,只保存了一条待审提案。任意一个旗标或 descriptor-relative 能力缺失时,两端均按原错误拒绝。文件打开和提案保存次数都为零。 本次独立核验在 macOS 执行。平台能力缺失由定向故障注入模拟,原生 Windows 运行尚未验证。

改动思路 / Approach

本 PR 修复检查准备的 POSIX 常量访问和现有可移植性测试的错误诊断。 安全文件读取属于现有 Chat 工作区。生产代码读取一次主机能力,测试直接呈现扫描到的源码位置。 原会话先经已有身份核验,再检查三个 flags 和 descriptor-relative 打开支持。目录使用相同的保护。文件仍须是普通文件,源 digest 进入待审提案。测试可以直接从原始 AST 观察结果取位置。原检查和权限约定

具体改动 / Changes

关键代码讲解

  • _workspace_file 在同一局部读取三项能力,同时核对 os.open 支持目录描述符。缺一即在打开前拒绝。目录与最后的源文件保持 no-follow,最后还检查普通文件。checker-source-safety 和 original-workspace-pin 已在实际调用确认。工作区安全读取 · 真源检查与提案读回
  • test_no_module_exceeds_its_bare_posix_flag_ceiling 直接使用已有的违规文件和行号。ratchet-diagnostic-line 已验证。在两个 checkout 给同一真实 scanner 添加裸引用,基线格式器抛 ValueError,候选报出 loopx/probe.py:4 和 os.O_NOFOLLOW。架构测试及诊断

按 docs/guides/personal-workspace-user-guide.md 核对了原会话、本地范围和独立验收。实际测试也覆盖了符号链接、读取时源改变和错误会话。路径与范围负例

对主干的风险 / Risks

以正确激活的源码环境运行同一选集。基线只有可移植性诊断失败,139 项通过。候选 140 项通过。额外在两边的 File 与 SQLite 分别移除四类安全能力,共各八次拒绝检查。没有任何文件打开或新提案。候选实际覆盖在 macOS。原生 Windows 仍待运行。

语义与 CI 对齐

沿用现有 Chat 准备权限、POSIX 文件保护和架构 ceiling。新增的是可定位的测试诊断,没有新状态或协议词汇。

我的整体评价 / Verdict

本 PR 修复检查准备的 POSIX 常量访问和现有可移植性测试的错误诊断。 对维护者,违规诊断能直接定位文件,而原工作区保护经过真实入口与反例对照。检查了原 Chat 工具调用、源文件读取及架构测试。差异没有渲染代码。 此提交的原生 Windows 和已安装宿主未独立运行。 在 0e6b5c7695ae 给出通过结论。

English verdict: APPROVE at 0e6b5c7. The ratchet reports the actual file and line. Real Chat preparation preserves the original workspace and fails closed when safety primitives are missing. Native Windows was not independently run.

@loopx-agent
loopx-agent merged commit 0c00c09 into main Nov 15, 2026
31 of 47 checks passed
@loopx-agent
loopx-agent deleted the codex/workspace-checker-posix-portability-20261115 branch November 15, 2026 15:46
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