Repository navigation
fix(chat): compare bound context by JSON content - #7176
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 52de7eb93e57ccda97f9a492a54bfba3237924d4。没有阻塞性发现;已审阅全部三个文件。
动机
继续已有项目或管家 Chat 的用户。
过去仅由另一个 JSON 写入器重排字段,就会被误判为身份改变,发现接口返回 409,原会话无法续聊;现在相同字段和值保留原 Session 与 native thread,并能继续原请求。
原会话可重新发现并完成排队输入,同一请求重放只留下一个用户输入和一次执行;来源、权限或会话身份真正改变时仍拒绝,撤销后不能创建新 Turn。
不增加 grant、队列或执行器,不迁移工作区,不把项目无 Goal 会话的 peer 接收、独立采用及原请求返回宣称完成。
改动思路
完整上下文身份属于现有 TypeScript binding owner;复用标准深比较即可修复,不需要新状态、迁移或第二套准入。
本 PR 只修复已有绑定会话的发现和续聊;peer 接收、独立采用与原请求返回仍归原工作。
原有 provider 验证、binding publication fence、canonical Session 再读取与队列去重分别保留。比较仍覆盖完整对象;没有通过挑选少数字段或删除未知字段来绕过身份检查。管家原本允许的 Goal 范围扩展仍由原 subset 条件决定,不被深比较代替。
具体改动
关键代码讲解
resolveBoundConversation的三处比较复用isDeepStrictEqual:已存项目/管家上下文,以及 canonical Session 与入站快照。完整字段和值仍参与比较,只有对象成员顺序不再制造身份变化。listLocalBoundSessions继续调用同一 owner;发现目标不执行工作,且仍独立拒绝重复、已关闭、角色/执行器/来源不符的 canonical Session。- 现有 Python
ChatConversationBindings.input_context在入队前保留 binding fence 并重新加载 canonical Session;本 PR 没有改写这条权限路径。新增 HTTP 回归只在隔离且空闲的测试 store 中重排字段,不开放生产 Session 修改接口。
此缺陷没有单独书面规范。验收依据是 JSON 对象内容相同不改变身份,以及修复前已存在的来源、权限、canonical Session 与原请求去重约束;没有据此发明新协议。完整差异为生产 +6/-3、两个聚焦测试 +56,没有新增模块、字段、schema 或配置。
对主干的风险
最强风险是把顺序修复做成部分字段匹配,从而接受另一来源、权限或 canonical Session。独立的同输入比较覆盖 40 个项目/管家场景:36 个完整结果或完整错误(name/message/code/kind)逐值相同,只有四个字段顺序场景按预期由拒绝变为原上下文。未归一化任何字段。另四个后建 Session 场景确认既有授权范围对新目标仍成立;无关 binding 被排除,重复身份仍拒绝。
同一回归 oracle 在不可变目标 f20838e5e078a2b7ad0441dffd46b05291658a2a 的产品源码上实际出现两项 Core 拒绝和 HTTP409;在本 head,三个 HTTP/Chat 模块 92 passed,三个 TS 模块 39 passed,均零失败或跳过。实际 HTTP 路径完成发现、排队、执行、独立磁盘读回与同请求重放,保留原 Session/native thread,撤销后400且不生成新 Turn。模型和 IM/native-host transport 为合成 fixture,不能代替真实 provider 采用。
控制面 typecheck、标准 premerge 的 5 项直接检查与10项选中检查全部通过,无 warning/manual hold。DCO 和完整改动文本的公开/私有边界已检查。未查询 CI,未运行模型或修改活跃 Goal 数据。
我的整体评价
APPROVE。long_horizon 在该有界恢复路径 improved:原承诺和 thread 得以继续,请求重放不重复工作;不宣称长期模型净收益。user_experience improved:既有发现与续聊无需用户重新配置、复制身份或再次确认。已检查现有 Chat 发现与续聊 HTTP 路径;无前端文件、布局或设置变更。未验证安装后 App 或真实外部模型/IM provider;实际 HTTP、磁盘 store 与 typed owner 使用合成宿主验证。
兼容性保留既有持久 Session、上下文和回执格式;bounded refactoring 已应用于三处统一比较,其他具有独立归一化规则的 binding 配置比较继续留在原边界。复用现有语义,没有新增 actor lifecycle、执行义务或权限;readiness、合并与安装仍各有原 owner。
English verdict: APPROVE at 52de7eb93e57ccda97f9a492a54bfba3237924d4. Full-content comparison restores original-session discovery and continuation after JSON key reordering while preserving source, grant, canonical identity and revocation checks. Independent base failures, complete result/error counterfactuals,92 HTTP/Chat tests,39 TS tests,typecheck and selected premerge pass. Installed/live-provider adoption and peer receiving/return remain outside this fix.
Goal And Delivered Outcome
Bound project/steward Chat compared context snapshots with
JSON.stringify. Re-serializing the same JSON object with a different property order therefore looked like an identity change: original-session discovery returned HTTP 409, and continuation could not proceed.Use the existing TypeScript binding owner to compare complete context content, including the canonical Session check. Source, operator, grant, unexpected fields and revocation still receive the same checks. The HTTP regression discovers and continues the original Goal-null Session, retains its native thread, replays the original receipt once and refuses further input after revocation.
loopx-project/loopx:main.Author Declaration
resolveBoundConversationScope And Continuation
Complete within this bug-fix scope. This does not complete Goal-null project peer receiving, independent adoption or original-request return; that existing collaboration work remains open. The independently reversible slice fixes existing discovery and continuation without adding a recipient schema, grant, queue or executor.
Bounded refactoring applied: the saved-context and canonical-context comparisons now use the same existing Node equality primitive. Wider binding configuration comparisons were left outside this reproduced defect.
Validation
conversation_binding.test.ts,conversation_scope.test.ts,project_conversation.test.tstest_chat_conversation_bindings.py,test_chat_ordinary_project.py,test_chat_queue_preparation.py; actual HTTP, disk Chat store, typed owner and queue, with synthetic provider/native-host transportsnpm run typecheck:control-plane;git diff --checkCoverage limits: source-checkout validation, not installed App/provider adoption. No Goal authority-store routing or schema change. Remote CI and independent review remain pending.
Visual Evidence
Type of Change
LoopX Area
Technical Direction
Existing native Chat source identity and recovery. No new capability or protocol vocabulary.
Shared-authority RFC fixture impact
N/A: this PR makes no shared Goal Authority migration/promotion claim.
Boundary Checklist
中文:修复绑定项目/管家会话因 JSON 字段顺序不同而被误判为身份变化的问题。保持完整字段、来源和权限核验,覆盖原 Session 发现、续聊、幂等回读及撤销后的拒绝;peer 接收与回传仍是未完成的独立工作。