Repository navigation
fix(context): keep native reader commands on their selected runtime - #7983
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
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)
精确 reviewed head:0711d8bc073425cd40489089bf269bc0c3578f01;比较基线:cbc1eeabd740ac557c3a4fb7bf67050ad063b629。当前完整范围已按 capability-owned 19项证据重新判断。
动机 / Motivation
通过原生工具读取长任务上下文、需要保留已选 CLI 或解释器的 Agent。 首读后的续页、恢复及结算详情可能改用 PATH 中另一份 loopx;现在它们携带原调用程序,避免读回不同安装。 独立真实 CLI 续读反例从旧版退出 97 变为当前 head 退出 0,连续字节及原捕获不变;当前真实 Codex 普通工具和 CodeMode 两条路径均通过。 没有新准入、扣额、任务执行、合并或安装权限;不证明模型保留、token节省、Windows或持续长程收益。 原有三项 Python fixture 失败仍保留;Windows 原生路径、未来安装版本固定、生产模型采用及持续完整成本尚未验证。
改动思路 / Approach
现有 reader 的可独立交付修复;没有安装或模型收益资格化。
复用 command_invocation 的程序选择、TypeScript 的选择语义与既有 Python 文件呈现层;新增 argv 仅穿过 IO 适配器,没有第二份决策 owner。 正向链路为 _emit_quota_result / handle_native_context_command → current_loopx_cli_argv → native_context_capture_view / model_context_reference / read_context_capture → context_capture_read_command → unchanged child command。原捕获和摘要仍是读取依据,argv只是选择执行这条已有命令的实现;有结果输出不意味着新准入、来源保留或执行权限。当前 head 的 saved-context 模块38通过/10 opt-in跳过,显式本地确定性 Codex 两项2通过;原九路径生产字节与独立已测d1f86df5相同,其7模块234通过/3失败完整保留。 这是一项现有旅程的完整、有界修复,长期模型采用与完整成本属于未验证边界。
具体改动 / Changes
依据不可变规范/owner docs/reference/required-work-context.md@cbc1eeabd740ac557c3a4fb7bf67050ad063b629,逐项映射:Selected capture details / 按需读取捕获详情:implemented,所有页面完整摘要校验;选择拒绝与恢复不重做准入、结算或更换原捕获。;Native context delivery:implemented,已选程序贯穿初始、完整、分页、拒绝及有界详情;完整成本包含命令元数据。。检查了所有变更路径、实际调用者和现有owner,未增加重复决策、配置或存储。普通显式选择、固定引用、原捕获恢复和关闭路径仍沿用既有约束;原始字节、必要来源及停止条件不能被导航成功替代。组合检查仅使用独立未提交源码树,重叠文档同时保留两项含义,不是安装、主干合并或运行中实验更新。
关键代码讲解
- _emit_quota_result:在实际 producer 取一次当前 argv,交给导航和结算详情。
- read_context_capture:分页及 selector 拒绝恢复沿用当前 reader;摘要与 UTF-8 游标不变。
- context_capture_read_command:既有 builder 接受显式 argv,未提供的 in-process 调用仍用原默认。
对主干的风险 / Risks
旧续读真实调用 competing CLI 退出97,当前原样执行返回0且字节连续;非法 selector 批次无值交付,恢复保持同一程序、原摘要和零额外准入/扣额。7000-byte 独立分页3页完整恢复,1600不足元数据时280-byte明确拒绝并要求提高同一捕获的限额。 历史 d1f86df 的7模块为 234 PASS / 3 FAIL:两个1600-byte fixture现不足以容纳完整命令元数据,一个仍断言三词 ambient launcher。它们未被记为既有无关故障或通过。本次当前 head 独立长路径检查明确拒绝1600并保持原捕获,280-byte错误提示要求提高同一捕获限额;7000实际分3页完整重建、每页不超限。规范要求不溢出及有效恢复,并未保证任意路径在1600仍有载荷。原始 fixture维护缺口保留;当前8/64KiB路由、实际工具及连续字节覆盖单独成立。
当前三项组合候选的实际路由、首读、command及staged检查为 94 PASS / 1 SKIP;16个相关TS模块为 263 PASS / 1 SKIP。该组合树不代表任一独立PR的资格,也不证明已安装产品。单项标准premerge通过,保留一项原始 FAIL 的既有maintainability advisory:完整base/head输出及formatter blob相同,magnitude_regressions=0;未把它改记为单项通过。
语义与 CI 对齐
复用现有程序选择、捕获、JSON pointer和状态owner,未新增共享词表。行为变化明确披露并通过真实调用反例校验;文档是读取/恢复义务,不能视为额外授权。未查询、轮询或等待CI,远端状态为 UNVERIFIED;CI未知不构成独立review阻塞,真实回归、必要覆盖、readiness与合并授权仍分别判断。
我的整体评价 / Verdict
当前head的可观察读取/恢复得到改善,原要求、状态及权限语义保持;long_horizon取preserved,user_experience取improved。原有三项 Python fixture 失败仍保留;Windows 原生路径、未来安装版本固定、生产模型采用及持续完整成本尚未验证。 有界重构结论为applied:复用既有owner及合并/argv逻辑,没有引入更大框架或无关迁移。当前没有已验证的阻塞发现;批准结论仅覆盖该head及上述证据,后续单独读取approval closeout与merge readiness,不执行合并或安装。
English verdict: APPROVE this exact head; CI was not consulted. Merge readiness and authority remain separate.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
0711d8b to
3176bc6
Compare
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ult details Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Signed-off-by: huangruiteng <huangrt01@163.com>
3176bc6 to
810ac2a
Compare
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
通过原生工具读取长任务上下文的 Agent 和操作者。
旧实现生成的 recovery、continuation 与 bounded result 读取命令可能回到 ambient loopx;当 PATH 指向另一安装时,首读或续页以 97 退出,当前 Turn 无法继续读取原 capture。
本 head 让 native quota、saved-context projection、bounded settlement result 和实际 context-read 都把当前选择的 CLI/interpreter 带到初始、完整、分页和拒绝恢复命令中;读取字节、摘要、游标与 authority 保持不变。
不新增准入、扣额、执行、安装或 provider 权限;不证明模型保留、Windows、production Host/model adoption 或持续完整成本。
改动思路 / Approach
入口仍是现有 native quota/saved-context 导航与 quota context-read。canonical capture、Goal/Todo、acceptance 和 settlement receipt 继续是事实来源;本次只增加“使用哪个程序执行既有 reader”这一条 presentation 信息。_emit_quota_result 在 producer 边界读取一次 current_loopx_cli_argv(),沿 native_context_capture_view、model_context_reference、budgeted_settlement_result 和 reader continuation 传递。所有 command 仍由既有 context_capture_read_command 做 shell-safe 渲染,不新增第二套读取器或授权判断。
复用 point 是 loopx/command_invocation.py:显式 --cli-bin 保持 executable 与自身路径,未显式选择时固定当前 Python entrypoint,installed release root 可用时固定其 launcher。单独传 reader argv 只影响命令选择,不改变 capture/digest/cursor、selection、receipt、spend 或 claim。这是现有 IO adapter 的局部参数贯通,不是新 runtime policy;本 PR 的边界是修正 reader command 路由并覆盖真实消费路径,不扩展安装版本固定或 Host adoption。该判断要求现在保留这条链路,不再让 presentation 层回退 generic loopx。
具体改动 / Changes
相对 ffe84a693b464ef228596aef94722e9b6c35a7b8,本 PR 修改 10 个文件(+369/-58):四个生产/文档路径增加 reader program 贯通与 byte-cost 计算,六个测试路径分别覆盖真实 File/SQLite、CLI paging、cost oracle、saved-context 与 native Codex tool/CodeMode。没有新增 schema、字段、CLI 选项或持久状态。
规范依据为 docs/reference/required-work-context.md,spec_revision=ffe84a693b464ef228596aef94722e9b6c35a7b8。Native context delivery 要求启用 native full/delta 时通过 reader 恢复完整 capture,并保持 disabled/历史路径;Selected capture details / 按需读取捕获详情 要求 continuation 与 selection recovery 每次校验同一 capture/selection digest。两项均由现有 reader 与新增真实调用测试实现;本 PR 新增的文档段落只说明所选 program 不得在这些既有读取边界中丢失。
关键代码讲解
loopx/cli_commands/quota.py:311的_emit_quota_result在生产 payload 时取一次current_loopx_cli_argv(),避免导航、settlement detail 与 capture 在不同 presentation 阶段各取不同默认值。loopx/control_plane/turn_driver/decision_capture.py:214的context_capture_read_command接受可选reader_argv;未提供时继续调用既有loopx_cli_argv(),因此 in-process 旧调用者保持原行为。loopx/cli_commands/quota_capture.py:184的read_context_capture把同一 argv 传给 page、next_command和 rejected-selectionrecovery_command,并使 continuation 仍校验原 capture/selection digest。loopx/cli_commands/quota_capture.py:518的native_context_capture_view将 argv 传遍 full/delta、recovery、index/select 和 first-read 命令;_native_context_read_bytes用同一 argv 计算实际 reader 成本。loopx/cli_commands/quota_capture.py:611的project_saved_context_capture在 projection producer 捕获当前程序,覆盖 cold guard、saved-context、native full/delta 和失败后的 full recovery。
对主干的风险 / Risks
最强回归场景是:首读通过选定 alias 成功,但返回命令仍是裸 loopx;Poisoned PATH 让续页启动竞争安装并退出 97,而调用者误以为原 capture 丢失。新测试原样执行返回 command,要求每页前缀等于初始 program、完整字节可重建、ambient marker 不存在;File/SQLite 的 guard 与 context-project 路径、raw/selected/index/rejected、8192/64000 预算均覆盖。
base/head 对照明确:把新增 test_cli_program_route.py 应用到不可变 ffe84a69 后,首个 8192/guard/module/File 用例生成的 recovery command 以裸 loopx 执行并退出 97;同一测试在当前 810ac2af57 的 41 项全通过。完整受影响模块另为 141 PASS / 10 opt-in skip;本机真实 Codex tool 与 CodeMode 两条 program-route 用例为 2 PASS,均未触碰 poisoned ambient executable。
预算语义也保持诚实:完整 reader command metadata 使原先 1600-byte 成功假设不再成立。现在 1600-byte 测试明确要求无 content 的 fail-closed 响应、提示提高同一 capture 预算且不写 receipt/spend;4096/7000-byte 才验证连续分页和完整字节。这样没有把 metadata 压力静默忽略,也没有扩大生产 hard limit。
标准 premerge 通过:6 direct、10 catalog canary(含一个继承 maintainability advisory)、8 risk smoke、1 public-boundary scan,manual holds 为 0。TypeScript typecheck、semantic-vocabulary scan、bilingual RFC check 均通过。按 managed policy 的 wait_for_ci=false 未查询、轮询或等待 GitHub CI;未执行原生 Windows,也不声称未来安装版本固定或生产模型采用。
语义与 CI 对齐
复用现有 context-delivery、capture/digest、reader 与 command vocabulary,没有新增共享状态或权限词表。行为变化是有意且公开的:只把已选 program 带入既有命令,disabled native delivery、in-process default 与原始读取义务保持不变。
我的整体评价 / Verdict
APPROVE。 当前精确 head 没有阻塞发现。长期任务维度改善:续页、恢复和有界结算详情不再跨安装丢失读取上下文,减少同一 Turn 反复修复命令或重建 capture 的无价值回合。用户体验维度改善:Agent 可直接执行返回命令,无需知道 PATH 中同时存在多少安装;未增加确认、设置或人工选择。
视觉评审不适用:变更只涉及 Python CLI command rendering、context projection 与测试;没有渲染组件或首屏布局。代码体量主要由真实路径回归驱动,最大生产热点仍是既有 quota_capture.py。最合适的未来简化是继续复用单一 context_capture_read_command,不要为每种页面再建命令 builder;没有需要在本 PR 立即拆分或删除的重复 owner。
English verdict: APPROVE — head 810ac2af573fd14f8e9facc5464ad5cc0c8b988e keeps every generated context-reader command on the selected CLI/interpreter while preserving capture digests, state and authority. The same regression exits 97 on base, while 41 route tests, 141 affected-module tests, two real Codex routes and standard premerge pass on head. No blocking finding remains.
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
通过原生工具读取长任务上下文的 Agent 和操作者。
旧实现生成的 recovery、continuation 与 bounded result 读取命令可能回到 ambient loopx;当 PATH 指向另一安装时,首读或续页以 97 退出,当前 Turn 无法继续读取原 capture。
本 head 让 native quota、saved-context projection、bounded settlement result 和实际 context-read 都把当前选择的 CLI/interpreter 带到初始、完整、分页和拒绝恢复命令中;读取字节、摘要、游标与 authority 保持不变。
不新增准入、扣额、执行、安装或 provider 权限;不证明模型保留、Windows、production Host/model adoption 或持续完整成本。
改动思路 / Approach
入口仍是现有 native quota/saved-context 导航与 quota context-read。canonical capture、Goal/Todo、acceptance 和 settlement receipt 继续是事实来源;本次只增加“使用哪个程序执行既有 reader”这一条 presentation 信息。_emit_quota_result 在 producer 边界读取一次 current_loopx_cli_argv(),沿 native_context_capture_view、model_context_reference、budgeted_settlement_result 和 reader continuation 传递。所有 command 仍由既有 context_capture_read_command 做 shell-safe 渲染,不新增第二套读取器或授权判断。
复用 point 是 loopx/command_invocation.py:显式 --cli-bin 保持 executable 与自身路径,未显式选择时固定当前 Python entrypoint,installed release root 可用时固定其 launcher。单独传 reader argv 只影响命令选择,不改变 capture/digest/cursor、selection、receipt、spend 或 claim。这是现有 IO adapter 的局部参数贯通,不是新 runtime policy;本 PR 的边界是修正 reader command 路由并覆盖真实消费路径,不扩展安装版本固定或 Host adoption。该判断要求现在保留这条链路,不再让 presentation 层回退 generic loopx。
具体改动 / Changes
相对 ffe84a693b464ef228596aef94722e9b6c35a7b8,本 PR 修改 10 个文件(+369/-58):四个生产/文档路径增加 reader program 贯通与 byte-cost 计算,六个测试路径分别覆盖真实 File/SQLite、CLI paging、cost oracle、saved-context 与 native Codex tool/CodeMode。没有新增 schema、字段、CLI 选项或持久状态。
规范依据为 docs/reference/required-work-context.md,spec_revision=ffe84a693b464ef228596aef94722e9b6c35a7b8。Native context delivery 要求启用 native full/delta 时通过 reader 恢复完整 capture,并保持 disabled/历史路径;Selected capture details / 按需读取捕获详情 要求 continuation 与 selection recovery 每次校验同一 capture/selection digest。两项均由现有 reader 与新增真实调用测试实现;本 PR 新增的文档段落只说明所选 program 不得在这些既有读取边界中丢失。
关键代码讲解
loopx/cli_commands/quota.py:311的_emit_quota_result在生产 payload 时取一次current_loopx_cli_argv(),避免导航、settlement detail 与 capture 在不同 presentation 阶段各取不同默认值。loopx/control_plane/turn_driver/decision_capture.py:214的context_capture_read_command接受可选reader_argv;未提供时继续调用既有loopx_cli_argv(),因此 in-process 旧调用者保持原行为。loopx/cli_commands/quota_capture.py:184的read_context_capture把同一 argv 传给 page、next_command和 rejected-selectionrecovery_command,并使 continuation 仍校验原 capture/selection digest。loopx/cli_commands/quota_capture.py:518的native_context_capture_view将 argv 传遍 full/delta、recovery、index/select 和 first-read 命令;_native_context_read_bytes用同一 argv 计算实际 reader 成本。loopx/cli_commands/quota_capture.py:611的project_saved_context_capture在 projection producer 捕获当前程序,覆盖 cold guard、saved-context、native full/delta 和失败后的 full recovery。
对主干的风险 / Risks
最强回归场景是:首读通过选定 alias 成功,但返回命令仍是裸 loopx;Poisoned PATH 让续页启动竞争安装并退出 97,而调用者误以为原 capture 丢失。新测试原样执行返回 command,要求每页前缀等于初始 program、完整字节可重建、ambient marker 不存在;File/SQLite 的 guard 与 context-project 路径、raw/selected/index/rejected、8192/64000 预算均覆盖。
base/head 对照明确:把新增 test_cli_program_route.py 应用到不可变 ffe84a69 后,首个 8192/guard/module/File 用例生成的 recovery command 以裸 loopx 执行并退出 97;同一测试在当前 810ac2af57 的 41 项全通过。完整受影响模块另为 141 PASS / 10 opt-in skip;本机真实 Codex tool 与 CodeMode 两条 program-route 用例为 2 PASS,均未触碰 poisoned ambient executable。
预算语义也保持诚实:完整 reader command metadata 使原先 1600-byte 成功假设不再成立。现在 1600-byte 测试明确要求无 content 的 fail-closed 响应、提示提高同一 capture 预算且不写 receipt/spend;4096/7000-byte 才验证连续分页和完整字节。这样没有把 metadata 压力静默忽略,也没有扩大生产 hard limit。
标准 premerge 通过:6 direct、10 catalog canary(含一个继承 maintainability advisory)、8 risk smoke、1 public-boundary scan,manual holds 为 0。TypeScript typecheck、semantic-vocabulary scan、bilingual RFC check 均通过。按 managed policy 的 wait_for_ci=false 未查询、轮询或等待 GitHub CI;未执行原生 Windows,也不声称未来安装版本固定或生产模型采用。
语义与 CI 对齐
复用现有 context-delivery、capture/digest、reader 与 command vocabulary,没有新增共享状态或权限词表。行为变化是有意且公开的:只把已选 program 带入既有命令,disabled native delivery、in-process default 与原始读取义务保持不变。
我的整体评价 / Verdict
APPROVE。 当前精确 head 没有阻塞发现。长期任务维度改善:续页、恢复和有界结算详情不再跨安装丢失读取上下文,减少同一 Turn 反复修复命令或重建 capture 的无价值回合。用户体验维度改善:Agent 可直接执行返回命令,无需知道 PATH 中同时存在多少安装;未增加确认、设置或人工选择。
视觉评审不适用:变更只涉及 Python CLI command rendering、context projection 与测试;没有渲染组件或首屏布局。代码体量主要由真实路径回归驱动,最大生产热点仍是既有 quota_capture.py。最合适的未来简化是继续复用单一 context_capture_read_command,不要为每种页面再建命令 builder;没有需要在本 PR 立即拆分或删除的重复 owner。
English verdict: APPROVE — head 810ac2af573fd14f8e9facc5464ad5cc0c8b988e keeps every generated context-reader command on the selected CLI/interpreter while preserving capture digests, state and authority. The same regression exits 97 on base, while 41 route tests, 141 affected-module tests, two real Codex routes and standard premerge pass on head. No blocking finding remains.
Goal And Delivered Outcome
Native context-reader commands can escape the program that produced them. A selected interpreter or
--cli-bincan emit an initial navigation, continuation or recovery command beginning with ambientloopx, sending the next read to another installation. Bounded settlement-result detail links have the same presentation boundary.This fix carries the existing current program argv through native quota navigation, saved-context projection, bounded result details and the running reader. Initial, complete, paginated and rejected-selection recovery reads retain that program. Native full/delta byte estimates include its command metadata. Existing in-process reference constructors keep their default command route; capture content, digests, cursors, selection rules and authority remain unchanged.
The reproduced negative case executes the returned command unchanged with an isolated competing CLI. On immutable
cbc1eeabd, an actual native SQLite guard's first read invokes that program and exits 97. Saved-context projection on the earlier proposal also reproduced exit 97. The final implementation completes the native read/recovery journeys without invoking it.main.Author Declaration
docs/reference/required-work-context.mdand the existingloopx/command_invocation.pyowner atffe84a693b464ef228596aef94722e9b6c35a7b8.Scope And Continuation
Complete as an author proposal for this reader-program defect. The existing invocation owner and renderer remain authoritative; optional argv plumbing stays in the Python CLI/IO adapters. No schema, configuration, permission, execution owner or TypeScript decision owner is added. The tests reuse one program fixture and update the affected existing consumers to parse the complete native argv prefix.
The native follow-through reuses the existing saved-context lifecycle fixture. It adds real ordinary-tool and CodeMode consumers, an isolated competing executable, and complete cold initial/full reads followed by warm delta. Tool arguments are shared between the two transports. The existing fixture remains responsible for full source reconstruction, lifecycle hooks and unchanged receipt/spend counts; there is no new runner.
The current-main integration is included in the branch; the review diff contains ten paths. C1 #7430 retains its producer/cutover ownership. #7985 owns first-read selection priority; this repair carries the caller's program through that existing presentation boundary.
Routing preserves the selected executable/interpreter; it does not pin an installation's future version. Independent exact-head review, required remote CI and maintainer merge authority remain separate. Installed Host/model adoption and sustained outcome/full-cost benefits remain unqualified. The proposal awaits maintainer merge; packaging qualification used an isolated wheel.
Validation
810ac2af573fd14f8e9facc5464ad5cc0c8b988e.ffe84a693b464ef228596aef94722e9b6c35a7b8.main; the self-repair pattern-table conflict retained both the current-main saved-projection row and this PR's native-reader row.regression_parityffe84a69fails the first module/File guard case: the returned recovery command starts ambientloopxand exits 97. The same test passes on the current head.real_entrypointtest_cli_program_route.py: 41 passed across File/SQLite, module/quoted CLI, guard/PostCompact projection and 8/64 KiB ceilings. Initial/full/continuation reads and bounded refused-spend details preserve program, source/session and original receipt/spend counts.integrationreal_entrypointintegrationstaticintegrationmanualwait_for_ci=falsepolicy.The maintainability ratchet retains raw exit 1 for the existing oversized
render_canonical_todo_sectionsfinding inloopx/control_plane/todos/machine_section_projection.py. Premerge classifies itadvisory_inherited_failure, with zero magnitude regressions and no changed path in the finding. It is not reported as a passing smoke or waived required check.Real native CLI and isolated-package checks cover the affected production entrypoints, File/SQLite state, quoting, negative recovery and immutable readback. No authority-store implementation or provider qualification was changed; a new PostgreSQL qualification is outside this repair.
Frontend / Visual Evidence
UI impact: none. This repairs the existing context-reader journey; it adds no screen, layout or separate caller-facing capability. Screenshots and preview are not applicable.
Type And Area
Shared-authority RFC fixture impact: N/A; no provider promotion or compatibility-projection change.
Boundary Checklist