Skip to content

fix: pin deferred native context reads to the original capture - #9048

Merged
huangruiteng merged 2 commits into
mainfrom
codex/c1-deferred-context-source-20261119
Nov 19, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/c1-deferred-context-source-20261119

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A native C1 guard can defer large Goal and Todo scope fields into the original capture. The native detail command advertised an outcome-history selector, and the general recovery hint sent field reads to the delivered view. A workspace repair that followed those commands could encounter a missing pointer even with a verified original capture.

The native projection now reuses the original capture's reader. The same digest-bound command accepts each exact deferred pointer and uses the pinned CLI. The recovery hint directs the agent to the delivered view for its fields and to the named source for deferred fields.

Related to #8266, #8942, and #9044. Target main.

Author Declaration

Criterion Disposition Owner and verification
Recover the complete deferred Goal and Todo scope from its pinned source implemented Execute the published selector in File and SQLite workspace-repair guards and on isolated Core
Preserve the original capture, receipt, and repair decision implemented Verify the digest, exact arrays, original receipt and once-only admission across the repair
Keep selection within the requested capture implemented A deferred pointer against the delivered view still returns the existing missing-pointer rejection
Retain historical captures implemented The new Core reads the old metadata and original details byte for byte

Scope And Continuation

The fix covers the native selection command and its guidance. The existing stateless route uses the same original-source command shape. C1 still has separate installed App original-session, active legacy path retirement, and matched single-session outcome and complete-cost acceptance.

Validation

  • Tested revision 4cc3775934a6a6545ce11a0f3454ffe72fcaced5
  • Run state finished
  • Input classes synthetic, public_fixture
Check kind Result Public-safe evidence
real_entrypoint passed Four workspace-repair cases verify the emitted CLI route and run its arguments through the public quota CLI, across File and SQLite and both native and stateless modes. Native cases fail on main at the history-only template. The exact proposal recovers 301 Goal and 300 Todo scope entries, preserves the original receipt, and rejects a deferred pointer against the delivered view.
integration passed Isolated Core 2.4.0 reproduces both archived repair reads through native hook setup and the emitted CLI. The original fixture bytes, scope values and receipts match. Both baseline captures remain readable.
unit passed 307 Python tests passed against the same product code before a test-only portability adjustment. All four affected cases passed again at the final head. TypeScript control-plane suite 6,661 passed with 91 skips.
static passed Changed Python Ruff, configured mypy, control-plane TypeScript typecheck, bilingual and whitespace checks.
integration passed Standard local premerge passed against the declared base with a valid exact-scope receipt, 6 direct and 19 selected checks. One inherited maintainability advisory was retained.
manual not_run Installed App upgrade and matched model outcome and full-cost runs belong to C1 adoption.

The Git composition with #8942 and #9044 is clean at the checked heads.

Frontend / Visual Evidence

UI impact none

Type of Change

  • Bug fix
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)

Direction and acceptance Controller/Executor Unified Contract, C1.

Shared-authority RFC fixture impact N/A.

Boundary Checklist

  • The diff and this description contain public-safe evidence.
  • Validation uses isolated synthetic fixtures.
  • The change is scoped to native deferred-field recovery.
  • The bilingual diff check passes and the reference update covers both languages.
  • UI impact is recorded.
  • The commit includes a DCO sign-off.

3,200 字节导航复测

本次精确提交 fc1c7f91c03a08410edea2a82e8f401bb18e22b1 压缩导航说明,并保留 recovery.command 的交付视图入口和 context_details 的延迟字段入口。

  • 默认 native SessionStart 的真实 CLI 在 File 与 SQLite 上均以 3,200 字节上限返回 2,663 字节的成功导航。沿返回命令读回原捕获及原回执身份。旧头在匹配的 File 条件下于 3,200 字节拒绝,3,300 字节成功。
  • 定向测试 66 项通过。Standard premerge 通过。可维护性扫描将 heartbeat builder 与 interaction contract 的两项主干既有发现列为 advisory。

Review fix verified at the original output ceiling with both local providers.

@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.2-sol · OpenAI (runtime_reported, max)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

[P2] 保留小预算下的正常导航

在相同的原 capture 上执行 quota context-project --max-page-output-bytes 3200。基线返回可用导航,沿返回命令实际读到了字段。当前头因新增提示超过上限而退出 1,仍保留原 capture 恢复。把新增提示压短后,同预算的导航与读取均通过。 相关代码

动机 / Motivation

原生 C1 使用者在 workspace repair 前需要核对原 Goal 与 Todo 的工作范围。基线保存了完整捕获,但 native detail 模板仍只指向 outcome 的 sources。跟随指引的字段读取可能落到已交付视图并报缺少指针。当前模板用同一 pinned CLI 和原摘要选读准确指针,源错误仍被拒绝,普通和历史读回各自保留。评审覆盖原捕获选读、指引和原准入身份。

改动思路 / Approach

保留现有 source digest 和选读所有权。native 由原捕获 recovery command 生成精确指针模板。通用导航标注交付视图,TS 的延迟字段指引指到同一模板。当前切片改变模板和来源提示,File/SQLite 准入及收据均由原路径持有。运行同一 Goal/Todo scope 的基线与候选,实际执行包含空格路径的完整生成命令。切换隔离 launcher 后再用候选读取旧捕获,检查摘要、数组以及准入和扣额计数。

具体改动 / Changes

精确 head 4cc3775934a6a6545ce11a0f3454ffe72fcaced5,diff base 5110b3afd8fbc33d2da33c28815e9320636244c3,5 个文件 +56/-24。逐项复核 native-exact-source-selection、source-and-admission-parity、saved-capture-compatibility、existing-output-ceiling。验收约定

关键代码讲解

  • 从原 capture 的 recovery command 生成选读模板,沿用首读的 CLI 入口。基线两例 native 都在旧的 sources 模板失败,stateless 两例通过。源码
  • 交付视图的 recovery.command 和 context_details 各指向实际可读来源。对两种 provider 试了错来源和错误摘要,均拒绝读取。源码
  • 共享 TS 指引沿已有模板读取延迟字段。四个实际完整 CLI 用例读回 301 个 Goal 与 300 个 Todo scope,原准入计数始终为一,零扣额。源码
  • 单独在旧版创建 capture,再切换私有 launcher,两个 provider 原摘要与正文均可复读。#8942 加 #9044 的组合也通过八项和四页重启复测。源码

对主干的风险 / Risks

常规预算下的工作范围恢复通过。在原文件、摘要、模式与参数相同且上限为 3,200 字节时,基线返回导航并通过实际命令读到原字段。候选退出 1 并保留同 capture 的恢复入口,操作者须转入错误恢复。3,300 字节通过。只压短新增两句的隔离对照在 3,200 字节也通过。

语义与 CI 对齐

原 digest、CLI 和准入身份保持。小预算显式配置下,增加导航提示使已有调用失去正常投递。现有恢复入口能保留原决策。补短提示时应保留交付视图和延迟字段的来源差异,并继续遵守同一输出预算。

我的整体评价 / Verdict

当前精确提交请求修改。File/SQLite 的原范围、错来源拒绝、旧捕获和兼容组合均通过。建议先压紧导航提示,并将 3,200 字节的真实命令回归一并覆盖。

English verdict: REQUEST_CHANGES. Native recovery restores deferred and historical scopes. A previously usable 3,200-byte context-project call now falls into error recovery, and a compact control preserves navigation at the same ceiling.

@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.2-sol · OpenAI (runtime_reported, max)

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

动机 / Motivation

Codex 做 workspace repair 时,需要先核对保存的 Goal 与 Todo 写入范围。主干的通用读取入口看不到延迟范围,详情模板只适用 outcome 来源。候选让操作者直接沿原捕获读取所需字段。按指引可读回整份范围与原轮次。小预算下也应保留可用导航和两条读取路径。当前复验使用本地原生 CLI 和真实隔离存储,生产 App 采用与完整成本仍是 C1 的验收项。

改动思路 / Approach

现有 reader 分别持有已交付视图和完整原捕获。候选让精确选读沿已有 pinned CLI 与摘要,并压短导航层的重复提示。两条读取使用现有协议和同一原准入。本切片改 native 导航和延迟字段入口。工作准入、历史捕获和权威状态继续由原有 owner 处理。沿原生 CLI 完成打开导航、读交付视图、选读原范围和读回原回执。用相同捕获比对主干、上轮和当前提交。两类来源保留各自的验证,操作者根据要读的字段选择入口。

具体改动 / Changes

精确 head fc1c7f91c03a08410edea2a82e8f401bb18e22b1,diff base 5cfd6ae7d571f2f97da40982db23f76540723c89,6 个文件 +76/-24。逐项复核 native-exact-source-selection、source-and-admission-parity、saved-capture-compatibility、existing-output-ceiling。验收约定

关键代码讲解

  • 对原生导航用短句交代交付视图和延迟字段两条路。源码
  • 详情的命令模板复用原捕获 reader 的完整 argv。源码
  • TS 依据只提供需要的精确指针及原来源读取约束。源码
  • 真实 CLI 反例验证错视图拒绝、原 scopes 和单次准入。源码

对主干的风险 / Risks

File 与 SQLite 的短路径在 3,200 字节上限均返回 2,619 字节。执行生成的命令后,读回原结算身份,再读到 301 条 Goal 与 300 条 Todo scope。上一轮失败的阈值对照在同一输入下恢复。较长路径在三版都触发原有 3,200 字节上限错误,4,000 下当前的两个读入口可用。正常与历史来源保持原摘要,错来源与错摘要均拒绝,原准入一次,新增扣额零。

214 项源码检查、4 项真实命令回读和 24 项配对预算观察完成。保留较长路径的既有局限及独立生产 App 验收范围。

语义与 CI 对齐

当前位于相同的读回 owner。简短指引保留交付视图与原捕获两条路线,摘要与读取约束保持。取短、长路径分别运行 native context-project,执行生成的原回执与延迟字段命令,把错误来源和摘要一起作为对照。

我的整体评价 / Verdict

批准当前精确提交。原范围恢复与上一轮的小预算失败均有配对复验。保留较长路径的小预算限制,当前主干相同。此结论覆盖同轮原生 CLI 续接。

English verdict: APPROVE. At fc1c7f9, the matched 3,200-byte regression is resolved and both pinned readers recover the original scopes on File and SQLite.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@huangruiteng
huangruiteng force-pushed the codex/c1-deferred-context-source-20261119 branch from fc1c7f9 to 27e62d8 Compare November 19, 2026 06:59

@huangruiteng huangruiteng 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-5 · OpenAI · self_reported

Approval conclusion

动机 / Motivation

原生 Codex session 中需要恢复 workspace repair 写入范围的 Agent 曾在同一份已保存上下文里找不到明确存在的 Goal/Todo 延迟字段。旧模板只指向 outcome sources,而实际 fields 保存在完整原 capture;Agent 因此可能重复尝试或凭记忆重建写入范围。当前命令模板从原 capture 读取任意延迟 pointer,并在指引里说明交付视图与原来源的差异。

affected_caller_or_operator 是原生 Codex session 中需要恢复 workspace repair 写入范围的 Agent;before_after_scenario 是旧模板只指向 outcome sources,当前命令模板从原 capture 读取任意延迟 pointer。observable_outcome 是 Goal 与 Todo scopes 从原摘要选读,错视图仍拒绝,历史和准入身份不变;non_goals 是不新增路由、后端接口、权限、准入或第二份来源缓存。

改动思路 / Approach

现有 context reader 分别拥有交付视图和原 capture,模板复用原 reader 即可修复,不需要第二套来源。Delivered view 的 generic fields 继续走 recovery.command,延迟字段则把精确 pointer 填入 context_details.command_template;digest、CLI route、receipt 与 provider validation 都不变。只修复 native 延迟字段的精确 pointer 模板和读取指引,保留原 digest、CLI route、receipt 与 provider validation。这是改动思路中的 current_pr_boundary。

具体改动 / Changes

精确 head 27e62d8a08b65cf8a60cf2d7a195af6e99ae58ce,diff base 036a95fb1a,6 个文件 +76/-24。规范引用 docs/reference/required-work-context.md @ 036a95fb1aac866526dc2409e0468c25bc656a3d;deferred-exact-source 和 saved-identity-parity 均实现。

关键代码讲解

  • prepare_codex_context 的 context_details 模板改为 recovery.command + --select <pointer>,复用原 capture digest 与选中 CLI。
  • _native_context_reference 用短句区分 delivered view 和 deferred source,并继续在小输出预算内保留 recovery。
  • requiredNativeContext 指引 Agent 替换 context_details 中的 pointer,而不是重新准入或猜测来源。

对主干的风险 / Risks

最强风险是模板看似修正却仍指向另一视图,或新增指引挤掉小预算恢复。当前测试在 File/SQLite、native/stateless 和 301/300 条 scope 下执行真实生成命令,错视图与错 digest 仍拒绝;原始 receipt 与零额外 spend 保持。PASS:214 项目标测试通过;quick premerge 正在最终核验。安装态采用仍属 C1 后续范围。

语义与 CI 对齐

capture digest 只证明来源完整,pointer 才选择具体事实;两者都不授予 freshness。当前修复只是让延迟字段沿正确 reader 读取,不新增权限或执行入口。

我的整体评价 / Verdict

批准当前精确提交。长期任务上,workspace repair 能从原证据恢复精确写入范围并保持单次准入;用户体验上,导航明确告诉 Agent 当前字段与延迟字段各自从哪里读。改动复用现有 reader 与 digest,缺少的只是一个正确的模板来源。

English verdict: APPROVE at 27e62d8. Deferred Goal and Todo fields are recovered from the original capture, wrong views remain rejected, 214 focused tests pass, and quick premerge passes.

@huangruiteng
huangruiteng merged commit 1e3c88b into main Nov 19, 2026
24 of 48 checks passed
@huangruiteng
huangruiteng deleted the codex/c1-deferred-context-source-20261119 branch November 19, 2026 07:34
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