Skip to content

fix(codex): observe threads from relative configured homes - #7227

Merged
huangruiteng merged 2 commits into
mainfrom
codex/codex-relative-home-20261024
Oct 24, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/codex-relative-home-20261024

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

An existing Codex home configured as a relative path can contain a valid thread store, yet activity observation raises ValueError: relative path can't be expressed as a file URI. This affects direct homes input and the existing CODEX_HOME / LOOPX_CODEX_HOMES discovery paths.

Form one absolute, escaped SQLite URI before the existing read-only attempts. Both ordinary and immutable fallback reads reuse it. absolute() preserves existing path-alias interpretation; home selection, grants, WAL handling, rollout containment, cache binding and activity decisions retain their owners.

The real SQLite regressions exercise all three entrypoints using a relative directory with Unicode and #, recover the exact completed timestamp and verify unchanged database/rollout bytes. The existing native Windows lifecycle job now includes the complete host-activity module.

Author Declaration

  • Written by: model_agent (OpenAI Codex), under the author's direction.
  • Specification/revision: existing configured-home discovery and read-only thread observation in loopx/codex_app_thread_activity.py, plus tests/test_host_thread_activity.py, at 7a03792090abb44850109cb6f6d93219c63e555e. Outcome basis: reproduced exception on an otherwise valid synthetic home. Intended base: main.
  • Criteria implemented: each existing relative-home entrance reads the selected store; normal and fallback reads use an absolute escaped URI; existing read-only, scope and state contracts are preserved. No new setting, capability, vocabulary or authority.

Validation

Tested revision: e4a267dde88737c0c5114a9329df00bcec0761f3; finished, synthetic inputs. Native Windows, CPython 3.12.10, actual local SQLite 3.49.1 and rollout files in isolated temporary homes.

  • Before: direct production probe and all three new regression cases raise the URI exception.
  • After: complete host-activity module 72 passed on the final path-conversion implementation. Existing absolute/multiple/missing/WAL homes and activity/readback cases remain in that run. The configured-home public probe also recovers both environment variants.
  • Native Windows lifecycle reference check 1 passed; workflow YAML parsing, Ruff, whitespace, public-boundary scan and staged/committed bilingual RFC diff checks pass.
  • Independent author-side inspection found no actionable issue. Tests use synthetic user_home and explicit synthetic homes; they cannot discover a live Codex store. Source-byte checks cover the main database and rollout, without a separate claim about all possible SQLite sidecars.

Scope And Continuation

Complete within this provider database-URI repair. Sharing the URI between existing attempts is the bounded refactor; no new abstraction or parallel decision owner. Python remains the stable provider IO adapter. No frontend, Lark or CLI operation is added; visual evidence is N/A.

This is independent of #7222: database-path conversion and rollout handle sharing have separate failure causes and disjoint changed sites/tests, with no merge dependency. Local POSIX/UNC execution and installed live-host adoption were not exercised. Hosted CI and maintainer review remain pending. No provider/model Turn, real Goal, benchmark, global upgrade, publication or self-merge was performed.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

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

Exact head: e4a267dde88737c0c5114a9329df00bcec0761f3

动机

通过既有配置目录查看 Codex 会话活动或解析已绑定 peer 路由的用户。 现有配置发现接受相对目录,但把其中数据库直接转为 file URI 会抛出 ValueError,使本来有效的会话无法被观察。 同一份含中文与 # 的相对配置目录,修复前观察抛出 URI 异常,修复后读取只读 SQLite 和 rollout 得到准确的结束时间;原有绝对目录结果保持。 相对目录读取恢复有效活动,完整 CLI 能定位已绑定会话而不投递;绝对目录、越界、忙碌和未授权路径保持原结果,源数据未被改写。 本次不新建会话、不启动模型、不发送消息、不扩大绑定或文件访问范围,也不证明原生 Windows、UNC 或安装采用。

改动思路

URI 转换复用现有 Codex SQLite provider IO;普通只读和 immutable 退路共享一次绝对路径转义,活动状态、WAL 条件、路径范围及权限仍由原 owner 判断,不引入另一套观察或决策协议。 当前 PR 的完整边界是让既有相对配置入口读到已选择的真实本地 store;不更改 home 选择、路径别名解释、线程绑定、投递权限、活动枚举或自动调度。

不修改时会继续保留已复现的观察失败;较小的合法修复应直接落在已有 IO 边界。只捕获异常会把健康源继续伪装成不可用,提前规范化所有 home 会扩张发现和别名语义;在数据库 URI 构造点共享一个派生值更直接。 下游原生结果、权限和失败恢复规则保持,既有意图与授权足够,不增加用户交互轮次。此处用文字解释分支即可,无新增图或渲染服务。

具体改动

没有找到单独定义这个 URI 修复的已接受 RFC、契约文档或 issue,因此规格判定为 no_spec。验收来自不可变基线 7a03792090abb44850109cb6f6d93219c63e555e 的既有 codex_homes 配置发现、只读 adapter 说明与原测试;这不把作者的完成声明升级为额外规范。

关键代码讲解

  • codex_homes:配置仍以原顺序发现存在的 home,不在发现阶段重写路径。新增一句说明相对路径在实际读取时采用进程工作目录;没有新增用户选择或确认。
  • _thread_rows:用 db.absolute().as_uri() 一次生成绝对且转义的 URI;普通 mode=ro 与 immutable=1 退路共用它。前一次发生 OperationalError 后,只有不存在 WAL 才尝试 immutable;这个安全条件未变。使用 absolute() 保留既有别名解释,没有把发现改成全局 resolve()。
  • observe_codex_threads:原有 exact thread id 查询、schema 检查、归档处理、受界限和路径约束的 rollout 读取及 typed unknown 结果继续生效。真实 native_chat.codex_attached.activity 和完整 resolve-peer-route 都消费这条路径。

全 diff 为三路径 +25/-2:局部 URI/说明、三个真实 SQLite 回归和既有 Windows lifecycle 命令一行;无数据迁移、新设置或第二套状态 owner。

对主干的风险

独立复核在 macOS / CPython 3.12.15 的真实 SQLite 与隔离 rollout 上进行。host-activity 72 通过、peer-route 23 通过、原生会话 HTTP/SQLite/隔离 Desktop 协议 57 通过,Windows lifecycle 引用检查另 1 通过,没有失败或跳过。本地 quick premerge 6 个直接检查与 4 个选中检查通过;没有查询、轮询或等待 CI。

同一套真实源数据做了 base/head 共 28 次读取,九组完整结果不变,五组相对路径从 URI 异常恢复为有效结果;普通只读与 immutable 退路、WAL 拒绝、软链接别名、越界 rollout、空 store、运行中及归档线程均有控制,全部合成源文件字节不变。另十次完整 CLI 调用里,绝对目录、未授权 peer、忙碌及越界路径的完整输出逐字段一致,未做语义归一化;相对目录从 host_observation_failed 恢复为准确的 idle 路由,仍为 locator_only、host_delivery=not_attempted。

敏感性检查将不可变 base 的原 _thread_rows 接回同一调用链:三个原始回归全部以相同 ValueError 失败,固定 head 通过。最强风险是误改路径别名或让 immutable 隐藏 WAL,当前 URI 局部修复没有这样做。本轮未执行原生 Windows、UNC 或真实已安装 App,也不以合成 HTTP/协议 peer 代表真实桌面采用。

我的整体评价

未发现阻塞问题,APPROVE。本次交付判定为 goal_achieved,只关闭上述有界观察故障。长程影响判定为 preserved:现有工作、结果与权限 owner 保持,不新增循环重试、持久状态或模型调用;不从测试数推断长期净收益。用户体验判定为 improved:相对目录读取恢复有效活动,完整 CLI 能定位已绑定会话而不投递;绝对目录、越界、忙碌和未授权路径保持原结果,源数据未被改写。 URI 转换复用现有 Codex SQLite provider IO;普通只读和 immutable 退路共享一次绝对路径转义,活动状态、WAL 条件、路径范围及权限仍由原 owner 判断,不引入另一套观察或决策协议。 当前 PR 的完整边界是让既有相对配置入口读到已选择的真实本地 store;不更改 home 选择、路径别名解释、线程绑定、投递权限、活动枚举或自动调度。

完整基线对照证明的是当前修复的有意变化及相关不变边界,没有另建共享语义词汇;局部测试参数不构成新公共协议。代码量判断为必要,兼容路径保留有真实调用依据;不需要为了本次修复抽象新框架。检查了活动 adapter、chat status、peer-route 和原生会话消费者;没有页面布局或渲染字段改动,视觉评审不适用。 未重新验收安装包、实际 App 使用或原生 Windows;本轮明确验证源码及本机真实 IO 边界。 作者的原生平台结果、本机独立结果和未验证范围分别陈述。合入、已安装采用及其他 PR 的检查仍由各自 owner 判断,本评审不执行合并。

English verdict: APPROVE. The exact head fixes the reproduced relative-home SQLite URI failure within the existing IO owner, with independent baseline/head real-path and negative controls. No blocking finding. Native Windows and installed-host adoption were not independently exercised; these are explicit limits of this review.

@huangruiteng
huangruiteng merged commit cd1e511 into main Oct 24, 2026
28 of 37 checks passed
@huangruiteng
huangruiteng deleted the codex/codex-relative-home-20261024 branch October 24, 2026 12:18
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.

3 participants