Repository navigation
fix: isolate agent settlement from peer semantic receipts - #8853
Conversation
Signed-off-by: huangruiteng <huangrt01@163.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
评审提交 98d640577b2101d0ee8ad872d9d77afb66e4b149,对照实际主干 59e68906d4082f43fae52e4219e374c5e97539a9。
动机 / Motivation
在同一个 Goal 中并行工作、需要结算自己已准入 Turn 的 Agent。
主干会先解释同 Goal 下各 Agent 的语义回执,再挑当前 Agent。另一 Agent 的回执缺少 review stop condition 时,正常 Agent 的状态和结算也会失败。
让 A 在 File 或 SQLite 上按原身份准入,再加入同一个 Goal 中 B 的语义字段不完整回执。分别读取 A、B 和全 Goal 的状态,然后用 A 的原 Turn 结算及重放。
主干的 A 状态和结算均拒绝。候选允许 A 完成一次写回和一次扣额,重放读回同一准入。B 和全 Goal 都仍拒绝原语义错误,共用事件日志的非法 JSON 也仍被拒绝。
验证使用隔离的真实 CLI 与 File/SQLite、合成回执。现场安装和远程运行未验证。
改动思路 / Approach
继续用原 TypeScript 结算和有效 Turn 的计数 owner。当前 Agent 的过滤位置从计数结束前移到解释回执前,状态采集也传同一个 Agent。只改 TypeScript 分支会留下 status 对其他 Agent 的重复解释。
先绑定 Goal 和 Agent 再解释能计数的结算,原 scoped 刷新、扣额和历史诊断继续经现有 owner。
具体改动 / Changes
8 个文件新增 129 行、删除 7 行。按主干 59e68906d4082f43fae52e4219e374c5e97539a9 的 docs/quota-allocation.md 复核 same-agent-settled-count、receipt-replay 和 peer-isolation。 调度和计数协议
关键代码讲解
- projectSettledReplanHistory。保持 Goal instance 与事件日志读取,在领取结算 snapshot 的候选中只保留当前 Agent 的原回执。无 Agent 的读仍核对全部已匹配的候选。 回执聚合
- attach_active_state_project_asset_fields。在已有 status 构建链传入 Agent,限制为当前 lane 解释重规划义务。全 Goal 读取仍从原工作历史发现所有 Agent。 状态投影
对主干的风险 / Risks
- 同一个 fixture 走实际
refresh-state --settle-turn。主干在两个 backend 都拒绝 A,扣额为零。新提交中 A 成功一次,重放为已结算且仅有原准入回执。B 的原行字节保留,B 和无 scope 的 status 仍精确报告原错误。把共用 JSON 写坏仍使 A 的 scoped status 拒绝。 - 新增 File/SQLite 回归在主干各失败一次,在候选通过。两份 TypeScript history/settlement 测试共 192 项通过,实际 CLI 测试文件 30 项通过。Quick premerge 六个直接与四个选定检查通过。
我的整体评价 / Verdict
批准当前提交。把已有 lane scope 送到回执解释前,能隔离故障,同时保留错误回执和共有日志的检查。调用方沿原 scoped CLI 路径完成结算。
English verdict: APPROVE. Agent-scoped settlement now isolates peer semantic errors and preserves original receipts, exactly-once accounting, and strict shared log validation.
* Prioritize new Lark replies over already attempted cards Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Isolate unreadable Lark reply scheduling hints Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix: isolate agent settlement from peer semantic receipts (#8853) Signed-off-by: huangruiteng <huangrt01@163.com> * docs: add Japanese README (#8839) * docs: add Japanese README Signed-off-by: Ikko Eltociear Ashimine <eltociear@gmail.com> * docs: sync Japanese README with Goal lifecycle and route it through README checks Signed-off-by: Ikko Eltociear Ashimine <eltociear@gmail.com> --------- Signed-off-by: Ikko Eltociear Ashimine <eltociear@gmail.com> * Retain unreadable Lark recovery hints until the next scan 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> Signed-off-by: Ikko Eltociear Ashimine <eltociear@gmail.com> Co-authored-by: huangruiteng <huangrt01@163.com> Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
An Agent could fail to refresh or settle a valid Turn because another Agent on the same Goal had a malformed semantic-review receipt. Settlement qualified every Agent’s receipts before selecting the requested Agent, and status collection independently repeated that cross-Agent read.
Apply the explicit Agent scope before semantic receipt qualification and carry it through status obligation collection. Shared Goal history, instance ownership and log-integrity checks remain intact. The affected Agent and unscoped readers still reject the malformed receipt; no receipt is repaired or discarded. The existing CLI/status journey is preserved without new configuration. Also remove two duplicate imports from the touched status wrapper.
Validation:
npm ci --ignore-scripts.The source repair also completed an existing-runtime recovery using its original Turn identity; readback confirmed exactly one writeback and one spend. Installed releases and historical receipts were not modified. Scheduling and Goal policy are unchanged.