Skip to content

fix(codex): stabilize native auth consumer discovery - #7498

Merged
loopx-agent merged 1 commit into
mainfrom
codex/native-client-snapshot-recovery-20261027
Oct 27, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/native-client-snapshot-recovery-20261027

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

A same-home auth consumer can start between process enumeration and file inspection, causing native handoff to stop with client_changed before its service can be restarted. Retry only that read-only scan up to three times and require a stable new snapshot. Confirmed exits are re-read; PID reuse, unreadable live processes and persistent churn still block effects. Reuse the positive exit check for existing helper and recovery fences, and bump the optional provider to 0.12.10.

Validation: the same synchronized real Darwin child fails discovery on 0.12.9 and is found on this head; the durable client smoke also covers born/exited consumers, bounded churn, PID reuse and unreadable live processes. Native AppKit/HTTP/account tests (81), observer tests (4), client/force/recovery smokes, operator tests (22), policy tests (10), Ruff and standard premerge pass. Standard premerge selected no catalog canaries, so the native suites were run explicitly. The full check retains the same pre-existing canonical-authority error on base and head; the scoped public-boundary scan passes and its one non-literal warning is on unchanged code.

The settings page and CLI keep the existing owner and interaction. These checks do not establish a real-account cutover or permission to restart an unqualified external workload.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@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

已授权原生账号自动交接的使用者会遇到客户端扫描期间的短暂变化。进程表读取后新客户端打开同一目录,旧版立即失败;新版先有界重扫,再按稳定身份继续原服务重启。同一真实进程复现从 client_changed 变为完整识别,新服务合成场景只切换一次并恢复。本次不证明真实账号切换、任意进程强杀或外部 VM 的数据恢复资格。真实额度耗尽后的换号与新认证采用,以及外部工作负载的独立恢复资格仍待核验。

改动思路 / Approach

本 PR 交付同一 provider 的稳定占用发现及退出证明复用,不重试任何凭据事务或接管外部工作负载。Darwin 进程和文件检查仍归既有 native_host IO adapter;TypeScript 继续决定额度与候选,原账号 owner 继续执行事务。相比忽略新 PID 或重试整个切换,先重读快照既保留归属校验,也不会重复已经产生的效果。未知身份、PID 复用及持续变化仍停止;正常稳定路径只读一次。已有设置页和 CLI 继续调用同一实现,没有新状态库、调度器或额外确认步骤。

具体改动 / Changes

精确 head 为 08fb2a6f24ea21c7fa9f438f0e9b0bcb9b0f0dae。基准规范为 packages/loopx-codex-provider-routing/NATIVE.md,spec_revision=24f4768f24512a958f2fa3c362e3ca23dd36b928;按修改前的同一规范判断,没有用新增说明替代验收。

条目 规范要求与当前判断
ND-1 文件占用与缓存 Codex 的 home 环境联合发现;真实 JSON clients 的出生竞态旧版失败、新版识别完整,implemented。
ND-2 服务仍需可信 plist、loaded path、PID、可执行文件与启动身份;更名、多服务、定义变化和 PID 复用场景通过,implemented。
ND-3 未知文件/VM 占用仍是等待,不成为退出目标;相关反例保留,implemented。
ND-4 部分恢复失败保留原 intent,后续恢复不重复切号;原失败与 worker 身份用例通过,implemented。

关键代码讲解

  1. _home_owners 仍先冻结进程身份,再读取文件占用。新出现或已证明退出的 PID 只让整份只读快照重读,最多三次;已知身份变成另一活进程或身份仍未知立即拒绝。稳定后才把清单交给 clients 和 pause_chat_agents,重试没有包住退出或账号事务。
  2. _cached_codex_owners 保留同一 home 的缓存客户端发现。环境读取失败时,不能再把一次空的内核身份当作已经退出;必须同时获得实际不存在的证明,否则保留未知。正常成功读取后也复核启动身份。
  3. process_exited 仅用零信号探测返回的 ProcessLookupError 证明退出,权限错误与仍存活均返回否。原 helper 退出和服务恢复的两处重复探测改用它,现有 live worker 与 unknown worker 保护不变。

六文件增删为 +159/-30:运行时代码 +45/-27,版本三处同步,测试 +99,双语说明 +12。原 service stop/switch/restore smoke 的新增/退出、持续变化和未知身份负例,以及真实内核同步出生场景都与公开合同相连;没有新增仅用于凑覆盖的生产入口。

对主干的风险 / Risks

未发现阻断问题。最重要风险是重扫把 PID 复用或未知活进程变成可退出目标:当前代码对已知身份变化立即停止,新增反例验证零信号、零 bootout、零切号;持续变化第三次仍拒绝。只有实际不存在才可忽略旧占用,外部管理器诊断不授予恢复权限。最坏增加两轮有界进程与文件读取,未增加后台扫描频率。

PASS:81 项账号、HTTP 与真实 AppKit fixture 测试,4 项 observer、22 项 operator、10 项 TS policy,client/force/recovery smokes、Ruff、编译与提交态 RFC 检查。standard premerge 通过,catalog selected=0/executed=0,所以额外显式运行原生相关套件。真实 host JSON clients 在同一隔离配置和真实 Darwin 后端上由 exit1/client_changed 变为 exit0/发现新进程;凭据及服务管理效果由合成 transport 隔离,不能外推真实换号。

默认关闭的 paired CLI 检查使用相同私有 store、TS policy、时钟和合成额度,完整响应与 status/status/observe 轨迹一致且没有切号;既有后台 default-off 用例也通过。全量 check 仍有同一既存 canonical-authority 错误,base/head 的失败对象和内容一致,package public-boundary 均通过,唯一非字面凭据词告警在未改代码。初次 operator 未提供 optional source 导致 import 失败,补正确 source 路径后 22 项通过;临时 /var 别名被 state-untrusted 拒绝的检查保留,不把它当功能通过。

语义与 CI 对齐

无新增共享状态或协议词汇,复用原 HostError、scope 和 effect owner;变更是已明确说明的本地 IO 纠错。当前 Goal 的 wait_for_ci=false,未查询、轮询或等待 CI。change-quality 当前 disabled,未冒称取得该 receipt。

我的整体评价 / Verdict

这是有独立反例和实际调用者的 justified_increment,long_horizon 与 user_experience 在已测范围 improved:稳定新占用能继续原受控路径,用户不增加操作轮次,未知与数据恢复等待仍保留。没有渲染表面变化,因此 visual_review 不适用;未验证范围是真实账号切换与外部工作负载恢复,而非本次已经交付的扫描收敛。三处退出证明复用是同域简化,没有必要引入另一套兼容协议或重启框架。原生 provider 维护继续承担独立恢复与真实认证采用验证;本审查不把局部修复当作完整自动换号成功。

English verdict: APPROVE — 08fb2a6; stable discovery and negative identity fences pass, with real-account cutover and external workload recovery outside this increment.

@loopx-agent
loopx-agent merged commit e74961a into main Oct 27, 2026
11 of 33 checks passed
@loopx-agent
loopx-agent deleted the codex/native-client-snapshot-recovery-20261027 branch October 27, 2026 15:38
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