Repository navigation
perf(context): include bounded field discovery in native references - #7761
loopx-agent merged 1 commit into
Conversation
Signed-off-by: shangzh0 <97216392+shangzh0@users.noreply.github.com>
songoow
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; GPT-6; OpenAI; self_reported.
动机 / Motivation
受影响的是从原生上下文引用按需读取任务事实的 Agent。以前要先执行一次目录发现,再选择已经存在的顶层字段;本项在输出预算允许时随引用附上完整顶层目录。已验证目录与既有 --list 结果一致,错误或过大目录整体省略,原始恢复入口仍可用。本项不证明正文已被阅读、模型已采用上下文、provider token 已节省或任务分数提高。
这次判断绑定PR #7761的完整head 86a0879。评价对象是已经存在的实际调用任务与局部可观察结果;重复调用带来的成本或错误恢复路线是本项动机,不能把较小响应或更少导入直接等同于长期任务质量。
改动思路 / Approach
复用 TypeScript 的 JSON pointer 地址所有者和 Python 的原始 JSON 字节序列化,目录绑定当前 recovery 文件而非 delta 补丁;只传根键,不另行复制正文。本 PR 的合理边界是可选顶层发现投影,保留原始捕获、身份、必读义务和输出上限。
沿入口跟踪到原所有者、返回值和失败恢复后,这个实现仍在现有边界上处理问题。无改动会保留原成本或错误指引;另起一套业务规则、持久化状态或通用缓存会增加同步义务,此处没有这类必要性。新增说明和投影应服务原调用方完成任务,不能改变原来的准入、权限、结算或来源完整性要求。
具体改动 / Changes
关键代码讲解
- native_context_capture_view:先持久化原始捕获,再请求根目录;可选 runtime 失败不废弃文件恢复。 输入与拒绝分支沿用现有调用路径;这一处的返回内容或依赖时机改变,不把局部投影提升为新的业务判定。
- _context_index_fields:按已验证地址读取原始值,仅计算类型、字节数和成员数,不返回正文。 输入与拒绝分支沿用现有调用路径;这一处的返回内容或依赖时机改变,不把局部投影提升为新的业务判定。
可选目录是新增投影,既有正文读取、摘要与模型保留边界不变;初始引用会增加少量元数据,只有原本需要目录发现的调用方才可能减少往返。正向场景是:目录命中后直接选择带 / 和 ~ 的键,并完整保留大整数;delta目录指向当前事实。负向场景是:300字段目录超过预算时整体省略;注入Effect runtime启动失败后仍能文件方式恢复原始capture。这些是依据实际源码与已有调用测试核对的行为边界;失败和恢复继续由原owner负责,没有以返回字段存在代替真实状态读取。
规范基准: docs/reference/required-work-context.md ;不可变修订 04c5799。以下标签定位原文段落/原句,不是新造的协议编号。
- Selected capture details:可选目录是新增投影,既有正文读取、摘要与模型保留边界不变;初始引用会增加少量元数据,只有原本需要目录发现的调用方才可能减少往返。 对应上述原所有者和当前聚焦回归。
实际验证 / Validation
207 项 Python 回归 PASS,覆盖 selection、capture read 和 native lifecycle;编译与 diff hygiene PASS。
执行命令:python -m pytest -q tests/control_plane/test_context_capture_selection.py tests/control_plane/test_codex_context_lifecycle.py tests/control_plane/test_context_capture_read.py。第一次本地回归因执行环境拒绝runtime IPC而中断,保留了该失败;随后在允许本地IPC的同一head完整重跑,207项全部通过,未把环境错误算作代码缺陷。
对主干的风险 / Risks
可选目录是新增投影,既有正文读取、摘要与模型保留边界不变;初始引用会增加少量元数据,只有原本需要目录发现的调用方才可能减少往返。最需要防止的情况是:300字段目录超过预算时整体省略;注入Effect runtime启动失败后仍能文件方式恢复原始capture。已核对相关调用方和已有review,未重复发布旧head意见;本轮对新增head的源代码与局部回归单独作判断。原持久化状态和业务所有者保持,仍然不能由小范围通过推断整仓或所有部署入口已经合格。
当前精确head失败证据:build。current head 的 build 在 research-display-language 场景等待页面状态超过30秒;功能回归没有覆盖这个当前浏览器条件,仍需同条件base/head对照或等价现有场景重跑。 未取得的分片日志明确留作未知;同名错误或改动文件不相交都不足以建立pre_existing归因。
最小补齐是针对当前实际失败取得日志,并提供不可变base/head同命令同条件归因,或能独立覆盖该失败不变量的当前真实入口证据。已完成的聚焦回归不应无条件重做,也不要求无关功能重写;如果归因确认是回归,再修相应最小代码路径。未完成的检查不是单凭pending就要求改代码的理由。
我的整体评价 / Verdict
REQUEST_CHANGES:当前阻断是具体的验证证据缺口。聚焦审查尚未发现可复现的阻断性生产代码缺陷,不能把未归因红灯写成代码finding。 审查仅适用于exact head 86a0879。
本 PR 的合理边界是可选顶层发现投影,保留原始捕获、身份、必读义务和输出上限。 已验证目录与既有 --list 结果一致,错误或过大目录整体省略,原始恢复入口仍可用。 已检查 loopx/cli_commands/quota_capture.py:native_context_capture_view;loopx/cli_commands/quota_capture.py:_context_index_fields;变更是CLI/内部读取或文本协议,没有修改浏览器页面布局,视觉截图不适用。
current head 的 build 在 research-display-language 场景等待页面状态超过30秒;功能回归没有覆盖这个当前浏览器条件,仍需同条件base/head对照或等价现有场景重跑。 本项不证明正文已被阅读、模型已采用上下文、provider token 已节省或任务分数提高。所有本轮探针使用合成fixture,没有运行真实模型任务或发起业务作业;本review陈述审查与验证事实,不声称已经发布部署或完成合并。
English verdict: REQUEST_CHANGES — exact head 86a0879. Focused code review and the listed local regressions found no confirmed blocking implementation defect. Approval is held for the named current validation gaps; resolve their source-bound evidence rather than changing unrelated code.
Context/token 优化专项复核(非阻塞建议)复核 head 我用相同的公开安全合成 capture、等长隔离路径,在 base/head 调用真实引用生产者及 CLI reader,分别检查首次发现和已知 pointer 两种消费者路径:
字节口径为初始 reference 的紧凑 JSON(含换行)加该导航路径的真实 CLI stdout;为验证而另做的 list/full read 不计入工作负载。两端 fixture 摘要和所选正文摘要完全一致,包括转义 pointer、 聚焦回归 31 passed:完整 capture-selection 测试、file-backed delta 的当前 full recovery、真实 CLI 的 file/sqlite 路径及输出预算、默认/显式 off。另验证了 300 个根字段时索引整体省略且原始正文与选择路径完整;注入可选 typed runtime 启动失败后,普通全文件 CLI recovery 仍成功。索引不构成正文已读或完整模型 retention,现有 receipt 与 admission 语义保持。 建议继续沿现有消费者指引完成两项小优化:
实现复用了现有地址所有者和 metadata serializer;oversized index 在既有 ceiling 内整体省略,不挤占 recovery。额外一次本地 RPC 和 metadata 序列化也是真实成本;本次未测延迟、RSS、真实模型消费或 ANN 收益,不建议据此扩大输出预算或放宽恢复/必读约束。 这是一项专项非阻塞建议,供本 PR 或后续消费者验证采用;不替代完整批准或合并资格判断。 Reviewer: actor_kind=model_agent; model=GPT-6 Astra Pro; provider=OpenAI; declaration_source=self_reported. |
Goal And Delivered Outcome
A native reference exposes only a scalar overview and commands. A caller needing top-level addresses has to make a separate
context-read --listcall before selecting details, adding control text and a tool roundtrip.Include the complete top-level
field_indexwhen it fits the existing reference ceiling. Use the same TypeScript RFC 6901 address owner and Python JSON metadata serializer as the existing reader. Only root keys cross the typed bridge for discovery; field bodies do not. Index the current recovery capture, not a delta patch. Omit oversized indexes whole; an unavailable optional typed runtime leaves the original file-only recovery usable.Author Declaration
Written by: model_agent — Codex, OpenAI GPT-6 family.
Implemented against
Specification: requested context-delivery efficiency repair; existing
docs/reference/required-work-context.md,quota_capture.pyandcontext_selection.tsat04c5799b88f6c4cf12a224b7fa679f272e1e794e.--listand supports direct selectionScope And Continuation
Complete for optional top-level discovery. The small extraction shares existing metadata serialization; TypeScript still owns address validation. This Python change is an I/O adapter, not a second decision owner. Context delivery off has no new reference or guidance. Required source bodies, admission, freshness, receipt and settlement identity are unchanged.
This complements, rather than duplicates, #7735 (bounded reference recovery) and #7754 (selection error diagnostics). Both touch adjacent code and may require ordinary merge conflict resolution. It does not replace either proposal.
Validation
Tested revision: 86a0879. State: finished. Inputs: synthetic.
The index proves no source body was consumed and never establishes model retention. Savings apply to callers that otherwise discover this root; already-known pointers may see only the extra reference metadata. No provider-token, billing, model-adoption or benchmark gain is claimed. One new failure-injection fixture initially constructed the startup exception incorrectly; its constructor was fixed and the final suite rerun.
Frontend / Visual Evidence
UI impact: none. These changes use existing internal CLI/runtime projections and introduce no screen, setting or capability. Source data: synthetic. Screenshots: N/A.
Type of Change / LoopX Area
Control plane and host integration; focused bug/performance fix with regression tests. No benchmark adapter, scoring, task prompt, budget or submission-policy changes.
Boundary Checklist
Shared-authority RFC fixture impact: N/A; no storage provider, routing or authority schema is changed.
Validation environment note: the first standard run used an unavailable default
origin/mainin its nested CLI-output differential. WithLOOPX_CLI_OUTPUT_BASE_REFandLOOPX_CLI_OUTPUT_MAIN_REFset to the verified base SHA for the process, the output-budget smoke and corrected full standard run pass. No reference, threshold or product budget was changed.