Skip to content

docs(self-repair): retain command completion metadata before stdout - #7850

Merged
huangruiteng merged 1 commit into
mainfrom
codex/c1-command-completion-recovery
Nov 1, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/c1-command-completion-recovery

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

A code cell that forwards only a command's stdout can hide whether its child is still running, exited silently or failed silently. Add targeted recovery guidance and a searchable self-repair pattern: retain completion metadata, collect a running command through its existing handle, and recover the original receipt/capture if that handle was lost before considering another execution.

The guidance preserves existing timeouts, cancellation, admission and settlement boundaries. It distinguishes a completed wrapper from its child and retains uncertainty when a historical trace lacks the inner tool result. This is an on-demand skill reference update; it changes no runtime, tool adapter, packet, default or experiment.

Validation at bfd63ba69:

  • Actual command-tool controls distinguished a pending result from terminal empty success and terminal empty failure. Collecting the pending command returned its final JSON with one execution; no command replay was used.
  • Existing pattern lookup and isolated installed-skill tests: 15 passed. The new symptom query ranks the new pattern first.
  • loopx check on both changed references: six checks, zero errors or warnings. Public-boundary and diff checks passed.
  • Exact-head quick premerge: four direct and three selected local checks passed. The overall gate is quality_receipt_missing for this new scope; no merge readiness is claimed.

This is a focused caller-recovery increment alongside #7430. The broader C1 migration and outcome/full-cost qualification remain open. Fewer recovery operations or bytes are not established benchmark benefit.

Written by: model_agent; Codex.

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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; reasoning_effort=max; declaration_source=runtime_reported

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

动机 / Motivation

通过 code cell 调用命令、再只转发 stdout 的 Agent,可能看到外层已完成却不知道子命令仍在运行。 同样的空输出,既可能是 pending,也可能是成功或失败退出;旧入口没有这一专门症状指引,新引用先区分工具完成状态,再收集原执行或恢复原回执。 独立真实工具对照区分了三种状态,原 pending session 只执行一次即收集到结果;相同症状查询在新 head 首位找到完整恢复指导。

子命令完成状态来自工具 result envelope(含 session handle、exit code 等),不能从 stdout 内容反推。原有通用指导已经要求保留 handle/错误;这里补的是可检索的具体症状和恢复顺序。本次不修改工具适配器、超时、取消、admission、lease、quota 或实验,不把受控复现当作历史轨迹根因证明,也不宣称整个 C1 已交付。 已验证可发现的指导和工具层反例;真实模型是否采用、历史两臂异常的实际根因、完整 C1 迁移与长期净收益仍未验证。

改动思路 / Approach

复用现有 self-repair owner:SKILL 的诊断步骤指向 targeted-diagnostics,症状查询走现有 find_pattern.py --query / --id。没有新增 collector、permission owner、缓存或必跑 preflight。先读完整工具结果,再选择原 session continuation;已终态则区分成功与失败;handle 丢失时先恢复原 operation receipt 或 digest-bound capture,而不是重发命令。

这个边界是按需调用方指导。它能让现有工具状态更容易被正确使用,不能自动修复每个宿主适配器,也不能证明模型已经遵守。新段落明确保留 timeout、cancel、stop、上下文 reader 和原身份限制;外层 code cell 完成与子命令完成分开,child 输出预算也不被当作外层预算。

具体改动 / Changes

完整 diff 只有两份引用 +28/-0:27 行状态表/恢复说明及一行 searchable pattern。现有 SKILL、lookup script 和 scorer 没有改变。修复前后同一症状查询 fixture(SHA-256 4d9b3bcd2f1782f06fe74c699d3c3512d166ce81632ebc1cba5ae333efeed5fa)通过隔离的真实 packaged-layout lookup 执行:base 前五项没有该具体症状,head 首项为新 pattern,完整 --id 读回保留各安全条件。

关键内容讲解

  • Completion-state 表:pending 只能收集原执行,terminal empty success 仍不能证明领域结果,terminal empty failure 仍是失败。
  • 原 receipt/capture 恢复边界:handle 丢失不能由目录列表、wrapper completed 或后续文件存在替代 outcome/authority 检查;保留原 Goal/Agent/Turn/operation 身份及内容读取契约。
  • 新症状行:保留“受控复现”和“历史根因”的区别,历史 inner result 不可用时不能因为空输出就断言丢了 metadata。

规格依据:skills/loopx-self-repair/references/targeted-diagnostics.md,不可变修订 07b555494550c12ff6e3dc4b139cdf7cd1bdae32。Read one response more than once, not one command — implemented:原结果、handle、错误、receipt/capture 和身份优先,反例由真实工具控制覆盖。Measure the right latency — implemented:把 yield/poll 与命令时长分开,未增加超时或改变历史实验归因。新文字依据旧契约评估,不用自身新增内容当独立规格。

对主干的风险 / Risks

主要风险是把指导误报为 runtime 修复或历史因果证明。这里没有这两项结论。PASS:15 项 pattern lookup / disposable skill 安装测试;独立真实工具对照分别获得 pending(初次没有 exit code)、terminal0 空输出和 terminal7 空输出。收集原 pending session 得到 terminal0 与 JSON 结果,三个控制各只有一次执行;保留原 synthetic operation/capture/effect 后继续产生并验证后续结果,没有重放原命令。cancel/timeout 与 handle-lost 路线按完整文本检查,没有宣称新机器执行器或真实模型采用。

PASS:显式 registry/runtime 路由的两文件 loopx check 为 6 checks、0 errors/warnings;quick premerge 的 4 direct +3 selected 全通过,0 command failures。首次 public-check 没有明确路由,被两个默认 runtime roots 检查在进入扫描前拒绝;原失败保留,随后同文件显式路由扫描通过。整体 premerge 仍 exit1 / stale CQR,这是独立合并质量门禁,没有记成总 gate 通过或补造 receipt。

语义与 CI 对齐

新 pattern id 留在既有本地 catalog,未创建共享状态词汇。新正文是有既定 fences 的调用方指导,不是新增 machine enforcement;无症状工作不增加 startup import、配置、确认或工具执行。查询排名会因新候选变化,不宣称全部 BM25 分数不变。wait_for_ci=false,CI 保留为 UNVERIFIED/unknown 诊断项,未查询、轮询或等待,也未猜测原因。

我的整体评价 / Verdict

APPROVE,作为 justified increment:按需发现和恢复操作已能独立走通,长期 continuation 边界 preserved、相关诊断路径 improved;不把一次工具控制、文件存在或通过数当作整个 C1、模型采用和净收益。复用现有 owner 的局部整理相称,无需扩建框架;既有仓库“技术可用不等于实际收益”的经验在此保留为明确边界。

检查的是按需 self-repair 文本、pattern lookup CLI 和命令工具结果,没有渲染页面或首屏布局改动。 未运行真实模型或安装宿主会话,未证明自动采用与长期收益。 精确 head bfd63ba69f7e97aeca9bcfa3732bcb80ba56f37a 无当前阻塞 finding;当前质量回执、原生 readiness 与合并授权各自保留,review 不替代它们。

English verdict: APPROVE — the on-demand guidance preserves original execution and recovery boundaries; real tool controls and lookup readback pass. Runtime adoption and broader C1 qualification remain separate.

@huangruiteng
huangruiteng merged commit a4872ea into main Nov 1, 2026
28 of 34 checks passed
@huangruiteng
huangruiteng deleted the codex/c1-command-completion-recovery branch November 1, 2026 21:33
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