Repository navigation
fix(botmux): read a dispatch back by its own trigger id, never the session latest - #8684
Conversation
On a reused botmux session the status read asked the provider for the session's trigger-result whenever the session held an active dispatch key, even when that dispatch's local receipt was still `attempting` (crash before the provider replied) or `rejected`. The session result then describes the previous, completed turn, so status reported the never-accepted dispatch as `completed` with `readback_verified: true`, and `--execute` crashed with "invalid botmux dispatch transition: rejected->completed" (or attempting->completed), leaving the receipt unresolved forever. Resolve ATTEMPTING and REJECTED receipts from the local receipt alone, the same path used when no session exists: attempting is promoted to unknown and rejected is reported as rejected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.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
评审提交 6681ca1ad179e20a16bf3599ba9f41a9576e3969,PR 目标基线 7bb1b01687c5ecb36971b19fc432d6019d3e5492,本轮主干 5890cecd436e7d76b0bb5a033aca175c3a2650d9。两版主干在受影响的生产文件一致。
[P2] 第二次查询把未被接收的 dispatch 标成完成。 同一 BotMux session 已完成第一笔。第二次 trigger 在 provider 接收前中断,留下 attempting。对该 Goal 连续运行两次 status --execute。 第一次返回并保存 unknown。第二次读取整个 session 的上一笔结果,用第二笔 dispatch key 返回 completed 和 readback_verified=true,并将它持久化。HTTP 对照确认 provider 只接收了第一笔。 问题位置
动机 / Motivation
通过 LoopX Goal Channel 触发 BotMux 的用户,需要确认最近一次请求是否完成。 先完成一笔,再向同一会话发第二笔。用户希望查询当前请求,即使会话仍保留上一笔结果。 候选修复了明确拒绝路径。两次执行均返回 rejected,未查询 provider。正常接收的请求仍可读回完成,已接收后的查询故障也能恢复。 验证使用公开 CLI、真实本地 HTTP 客户端和隔离文件状态。HTTP 服务为 BotMux 协议夹具,线上 BotMux 与 Lark 未验证。
改动思路 / Approach
BotMux 负责实际接收和执行,LoopX 的 dispatch receipt 绑定本次触发。status 只能把匹配的观察写回当前 receipt。 复用现有触发接收凭据可区分两类 unknown,继续沿现有状态机恢复已接收的请求。 触发先写 attempting,provider 接收时再写 queued 和对应会话。当前修复让 attempting 和 rejected 走本地路径;原先已经接收的请求仍用现有 provider 读取。 已接收凭据
具体改动 / Changes
关键代码讲解
两个文件分别修改 _status_botmux_runtime 和定向测试。分支先检查 attempting/rejected,只有执行查询才把 attempting 写成 unknown。随后同一 session 的下一次查询走旧 provider 分支,把上一笔完成写到当前 dispatch。 当前分支 第一次状态转换 验证标记
基线 docs/integrations/botmux-goal-channel-runtime.md 在 7bb1b01687c5ecb36971b19fc432d6019d3e5492 的 preserve-unknown-dispatch 保留中断后不确定性。 observe-current-accepted-result 已经在正常接收和已接收后的故障恢复中通过。 原有失败语义
对主干的风险 / Risks
同输入在 PR 目标和当前 main 上,预览均错误返回 completed,执行查询随后被 attempting→completed 状态机拒绝,未把第二笔写成完成。 候选第一次正确记录 unknown,第二次却写 completed。隔离对照只给未确认接收的 unknown 保留本地分支,两次都读到 unknown,provider 查询为零。已接收后 status 传输失败的对照仍能在第二次读回完成。
沿同一份本地 receipt 判断当前 dispatch 是否有 provider 接收凭据。未确认的 unknown 继续报告 unknown,直到有与该笔匹配的观察。已经确认接收、只是 status 读取失败的 unknown 保留现有恢复。 在现有真实 CLI/HTTP 对照连续查询两次,分别核对未接收中断、明确拒绝、正常接收、已接收后的查询故障与恢复。核对当前 receipt、此前 receipt 和 provider 请求次数。
语义与 CI 对齐
原生 CLI 入口和迁移定向 27 项通过。Standard premerge 六项直接和十项自动检查通过。HTTP 矩阵在目标、当前主干、候选及隔离对照各运行四种场景。 托管 CI 未查询。
我的整体评价 / Verdict
请求修改。请把同一条保护延续到重复查询,并保留已接收请求的恢复。测试需核对第二次执行及落盘状态,才能覆盖这次状态转换。HTTP 对照应确认这笔请求从未进入已接收记录。
English verdict: REQUEST_CHANGES. At 6681ca1, the first status stores an interrupted dispatch as unknown, then the next status falsely persists completion using the preceding accepted turn's result.
| ) | ||
| unaccepted_dispatch = bool(dispatch_key) and _dispatch_state( | ||
| local_receipt.get("state") if isinstance(local_receipt, Mapping) else None | ||
| ) in {BotmuxDispatchState.ATTEMPTING, BotmuxDispatchState.REJECTED} |
There was a problem hiding this comment.
[P2] 第二次查询把未被接收的 dispatch 标成完成。 同一 BotMux session 已完成第一笔。第二次 trigger 在 provider 接收前中断,留下 attempting。对该 Goal 连续运行两次 status --execute。 第一次返回并保存 unknown。第二次读取整个 session 的上一笔结果,用第二笔 dispatch key 返回 completed 和 readback_verified=true,并将它持久化。HTTP 对照确认 provider 只接收了第一笔。 沿同一份本地 receipt 判断当前 dispatch 是否有 provider 接收凭据。未确认的 unknown 继续报告 unknown,直到有与该笔匹配的观察。已经确认接收、只是 status 读取失败的 unknown 保留现有恢复。 在现有真实 CLI/HTTP 对照连续查询两次,分别核对未接收中断、明确拒绝、正常接收、已接收后的查询故障与恢复。核对当前 receipt、此前 receipt 和 provider 请求次数。
There was a problem hiding this comment.
已在 4dbe7bf 修复:除 ATTEMPTING、REJECTED 外,从未进入 QUEUED 的 UNKNOWN 也只用本地 receipt 判断,不再读取整个 session 的上一笔结果。判断依据是 receipt 是否有 queued_at(QUEUED 时写入,后续状态转换会保留)。因此中断的 attempt、transport_failure、invalid_provider_receipt 产生的 unknown 重复查询仍是 unknown;接收之后只是 status 读取失败(status_transport_failure,带 queued_at)的 unknown 仍通过 provider 恢复。
新增两个测试:
test_repeated_status_never_adopts_previous_result_for_interrupted_dispatch:复用 session,第二次 trigger 在 provider 接收前传输中断,连续三次status --execute都返回 unknown、readback_verified=False、落盘仍为 unknown,且没有任何 provider 读取。旧实现下失败,复现你描述的第二次变 completed。test_status_recovers_accepted_dispatch_after_a_status_read_failure:接收后 status 读取失败再恢复为 completed。新旧实现都通过,用来保证这条恢复路径没被误伤。
本地 test_botmux_goal_channel_runtime.py 27 项通过(需用桩 loopx.cli 并排除 test_runtime_cli_parses_setup_doctor_trigger_and_status,因为我的本地树缺 chat_event_cache),ruff 干净。
没有覆盖:没有走真实 HTTP 协议夹具,provider 用的是 requester 替身,也没有核对 provider 请求次数以外的对照矩阵。托管 CI 尚未在新 head 上跑完。
… status The first status turned an interrupted attempt into an unknown receipt, but the next status took the provider path again and, on a reused session, adopted the previous accepted turn's trigger-result for the new dispatch key: completed and readback_verified, persisted. Treat an UNKNOWN receipt that was never QUEUED (an interrupted attempt, a transport failure or an unverifiable receipt) like ATTEMPTING and REJECTED and resolve it from the local receipt alone. An UNKNOWN that was QUEUED and only lost its status read still recovers through the provider. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.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
Reviewed commit: 4dbe7bf7a1d98c616e054aa99009499bc9401476 · merge base 7bb1b01687c5ecb36971b19fc432d6019d3e5492.
[P2] 已接收的请求仍会采纳另一笔的完成结果。 同一 Botmux 会话中,LoopX 的当前请求已得到接收凭据;它失败后,另一客户端发起并完成新请求。 状态 GET 查的是会话最后一笔,会把新请求的完成结果确认为当前请求的结果;预览谎报完成,--execute 会持久化错误回执。这个问题基线已有,属于本次 status 修复同一个请求归属边界。 有接收凭据时按已存的 trigger_id 查 ?triggerId=…,并核验返回身份。缺 ID、身份不匹配或无法确认时,保留原回执或明确返回未验证,不能用会话最新结果晋升状态。 代码位置
动机 / Motivation
调用 goal-channel runtime status 的操作者用回执判断某笔 Botmux 请求是否完成。 复用会话时,旧版会把上一次完成写给这次未确认接收的请求;已接收分支也一直按会话取最新结果。 当前头修复本地未确认接收路径;已接收的本次请求仍可能拿到另一笔请求的结果。 这次审查覆盖现有状态读写路径;无需新增重试协议、接入切换或 Goal 更新。
改动思路 / Approach
本地回执决定是否有资格查询;Botmux 的逐请求结果负责说明请求进度;LoopX status 负责把二者关联。 新的分支根据已有状态和 queued_at 判断是否读取 provider,并保留已接收请求的中断恢复。 --execute 只把观察保存到当前本地回执;是否验证完成依赖同一请求身份,不能依据同一会话或据此改变 Goal。 Botmux 已支持按 triggerId 查询,不带 ID 会选会话最新记录,完成响应带回 triggerId。
具体改动 / Changes
按 docs/integrations/botmux-goal-channel-runtime.md 在 614ce03d36d36adb2a9f0d83fee2c2d7798c9c99 的条款评估。Typed lifecycle result 仍不满足。Failure Semantics 相关路径保持:不确定时不盲目重试或推断;可确认的 provider 观察只更新本地回执,不推动 Goal 转移。
关键代码讲解
- _persist_dispatch_receipt:记录当前已排队请求的 queued_at、会话与私有 trigger_id。
- unaccepted_dispatch:阻止缺少本地接收凭据的相关状态继续读取会话最新结果。
- runtime status: GET trigger-result:已接收分支的 GET 仍只发送会话 ID。
- runtime status: receipt update:把 provider 状态写至当前 dispatch_key,未检查返回的 triggerId。
- runtime status: readback_verified:仅凭得出的状态为 completed 就标记已验证完成。
生产代码 24 增 1 删,定向测试新增 183 行;本次加的是一个使用已有回执字段的判定分支。 上一轮评审 的反例在当前提交重新验证。旧头误读上一笔完成的原反例已修复;以下反例属于同一路径中已取得接收凭据后的另一分支。
对主干的风险 / Risks
PASS:已有成功请求作对照时,后续拒绝仍是 rejected,尝试中断、传输失败和无效接收回执在预览和两次执行查询中仍是 unknown,不再发 GET。已有接收凭据时,状态读取断开后仍能再次读取并完成。 分支基线 25 个、当前头 29 个定向测试通过;另用真实 LoopX CLI、隔离的本地 binding 和回环 HTTP 夹具对照基线、旧头和当前头。 夹具也覆盖 provider 实际接收、但 POST 响应丢失:没有确认身份时继续返回 unknown,这比读最新结果安全;这与已取得接收凭据后状态 GET 中断的可恢复场景不同。
FAIL:让当前已接收的第二笔先失败、尚未写回,然后从另一客户端在同会话提交并完成第三笔。按第二笔 triggerId 查得 failed;当前 LoopX 预览和 --execute 都返回 completed、readback_verified=true,执行还把第二笔回执存成 completed。分支基线同样复现,无需并发。 建议用同会话两个 triggerId(当前 failed、较新 completed)回归预览和写回,并继续检查已接收请求的状态读取中断恢复。
语义与 CI 对齐
保留已接收与未确认接收两条状态路径,复用回执里已有 trigger_id 做逐笔读回即可。 Git 差异检查与提交签署通过;与检查时的主干模拟合并有实质差异且无冲突。可重跑 uv run --extra test pytest -q tests/control_plane/test_botmux_goal_channel_runtime.py tests/test_state_migration.py 并加入上述对照。验证了真实 LoopX CLI;provider 使用与公开路由一致的回环 HTTP 夹具,未连部署中的 Botmux/Lark,也未检查 hosted CI 或完整 premerge。
我的整体评价 / Verdict
一笔已失败的请求能被写成已验证完成,后续消费者可能跳过重查或补做;错误回执不会因为本轮修好了未确认接收的分支而消失。 已确认接收的单一请求仍能恢复。多客户端复用会话时,调用者仍不能用这个完成标志确认自己那一笔。 没有新增 UI 或首屏变化。 已有私有 trigger_id 足以关联;无需公开 ID、扩展状态集合或改变 Goal 权限。
English verdict: REQUEST_CHANGES — the unaccepted-dispatch fix works, but the same status path still marks an accepted dispatch complete from a different session turn. This is a reproduced pre-existing gap, not a new regression.
…n's latest An accepted dispatch was read back with the session's trigger-result, which is the latest turn of the session. When another client started and finished a newer turn after this one failed, status reported that turn's completion for this dispatch: the preview said completed and --execute persisted it. Ask for the trigger id stored on the receipt and promote a provider state only when the response names that same id. A response for another turn, one that names no turn, or a receipt with no stored trigger id is reported as unknown with unknown_reason trigger_identity_unverified, never as a completion; a terminal local state is still not overwritten by it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.com>
|
已在 改动:
新增三个测试,都在上一版实现下失败:
另外两个既有测试的假 provider 没带回 本地 没有覆盖:没有连真实 Botmux/Lark,provider 是回环替身;没有测多客户端的真实并发; |
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
Reviewed commit: 08c59e71034ad2619ecadd855df3103285f5df27 · merge base 7bb1b01687c5ecb36971b19fc432d6019d3e5492.
[P2] 错请求的 not_found 能永久封死本轮回执。 同会话已经确认接收第二笔。GET 明确发送第二笔 ID,provider 回包却给第三笔 ID、not_found 与其 output。 回环服务收到第二次的 triggerId 后返回第三次 ID、not_found 及其 output。两次真实 CLI 状态均报告 not_found、output_available=true。--execute 保存不可再晋升的 not_found。随后同一请求的真实 completed 响应到达,执行仍留在 not_found。 保留明确的旧式会话级缺失分支。对于已确认 trigger 的响应,任何显式不匹配的 ID 都应留在 unknown 并撤掉其输出标志。仅接受明确归属于本次请求的缺失结果。 代码位置
动机 / Motivation
复用 Botmux 会话的操作者用 Goal Channel 状态确认本轮的进展,执行模式需要把该笔结果持久化。 状态只能按当前 dispatch 的身份接受 provider 的生命周期结果;缺 ID 或错误 ID 不能写入该回执。
分支基线和旧头按会话读取最近一次请求。同一会话复用时,预览和 --execute 都能把第三次完成写给尚在运行的第二次。 回环服务收到第二次的 triggerId 后返回第三次 ID、not_found 及其 output。两次真实 CLI 状态均报告 not_found、output_available=true。--execute 保存不可再晋升的 not_found。随后同一请求的真实 completed 响应到达,执行仍留在 not_found。
真实 LoopX CLI 在回环 HTTP 夹具中使用第二次的 triggerId。第三次已完成时,第二次仍准确显示并保存 running。协议形状的真实会话缺失仍返回 not_found 且不显示输出。查询未知 trigger 得到 HTTP 400,未改变已排队回执。 真实 LoopX CLI 使用按公开协议构造的回环 HTTP 夹具。错 ID 是对代答或陈旧响应的故障注入。未连部署中的 Botmux/Lark,未检查托管 CI。
改动思路 / Approach
已接收回执中的 trigger_id 决定 provider 查询范围。回包身份校验在本地状态转换前。特判 not_found 无条件经过校验,写入后由已有终态规则拒绝任何晋升。 真实 LoopX CLI 使用按公开协议构造的回环 HTTP 夹具。错 ID 是对代答或陈旧响应的故障注入。未连部署中的 Botmux/Lark,未检查托管 CI。 预览只读。执行仅更新当前本地回执,两个状态分支都不会改变 Goal。
具体改动 / Changes
依据 docs/integrations/botmux-goal-channel-runtime.md 在 af9b668ff7fb6ddfd0b78022bf22563bd5891378 的条款。上游当前正常的缺失回包也带回所查询的 triggerId。协议形状的匹配 ID 和不匹配 ID 已各自复验。 Botmux 路由 · 上游缺失结果 规范
- typed_lifecycle_attribution · 未满足。所有会改变本轮回执终态的 provider 响应都需有本轮范围。
- dispatch_id_query · 通过。已确认接收的回执按自己的 triggerId 查询。
关键代码讲解
- 未确认接收的回执在本地处理。 unaccepted_dispatch
- 读已存 trigger 的状态,缺 ID 时没有网络请求。 pinned status query
- 除 not_found 以外校验响应的 triggerId。 identity_unverified
- 防止已保存终态被后续观察改写。 terminal-state preservation
- 错误 ID 的 not_found 可以携带一个未验证输出标志。 output_available
上一轮的直接反例已在同源命令中复验。 上一轮评审
对主干的风险 / Risks
Botmux CLI 与 state migration 本地套件当前提交 32 项通过,分支基线 25 项通过。 Git 差异检查、分支签署与检查时主干的模拟合并均通过。真实 LoopX CLI 使用按公开协议构造的回环 HTTP 夹具。错 ID 是对代答或陈旧响应的故障注入。未连部署中的 Botmux/Lark,未检查托管 CI。
语义与 CI 对齐
回环服务收到第二次的 triggerId 后返回第三次 ID、not_found 及其 output。两次真实 CLI 状态均报告 not_found、output_available=true。--execute 保存不可再晋升的 not_found。随后同一请求的真实 completed 响应到达,执行仍留在 not_found。 可重跑 uv run --extra test python -m pytest -q tests/control_plane/test_botmux_goal_channel_runtime.py tests/test_state_migration.py,并加入上面的对照。
我的整体评价 / Verdict
保留明确的旧式会话级缺失分支。对于已确认 trigger 的响应,任何显式不匹配的 ID 都应留在 unknown 并撤掉其输出标志。仅接受明确归属于本次请求的缺失结果。 status 只允许当前回执写入其本地观察。Botmux 结果无 Goal 转换权。
English verdict: REQUEST_CHANGES. Exact trigger lookup fixes the previous counterexample. A not_found response carrying a different trigger ID still persists a terminal state, advertises foreign output, and prevents later valid completion.
The identity check skipped not_found, on the reasoning that a missing result echoes the id it was asked for. A response that names another turn as not_found was therefore accepted: status reported not_found with that turn's output attached and --execute persisted a terminal not_found that no later state may replace, so this request's real completion could never be recorded. Verify the triggerId of every response for a pinned turn, not_found included. The bare session-level missing branch (404 unknown_session naming no turn) is kept as it was; a 404 that does name a turn is checked like any other. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.com>
|
已在 现在对固定了 trigger 的请求,所有响应(包括 测试:
本地 |
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
Reviewed commit: 8365adc837bc7863b706203c48c7ea49af8ef0b6 · merge base 7bb1b01687c5ecb36971b19fc432d6019d3e5492.
[P2] 无身份的通用 404 仍能把派发永久写成未找到。 以同一会话成功派发两笔,让第二笔已有 triggerId;状态查询返回无 ID 的通用 404,随后让同一 ID 正常完成。 服务返回 HTTP 404 和 {"state":"not_found"},没有 triggerId,也没有 unknown_session。预览报告 not_found,--execute 将其持久化。随后同一 ID 返回 completed,状态仍停在 not_found,readback_verified=false。 只让明确写明 unknown_session 且没有 triggerId 的旧式 404 走会话缺失分支;通用 not_found 必须核对本次 ID。无 ID 时保留可恢复的 unknown,再用同一次派发的 completed 验证恢复。 代码位置
动机 / Motivation
操作者复用同一个 Botmux 会话派发多笔任务,再用 LoopX 状态命令确认其中一笔是否已完成。 已接收的派发应只接受能够归到本次请求的观察;保留已有的明确会话缺失兼容分支。
基线只查询会话的最近一笔;第二笔仍运行时,第三笔已完成就会把第二笔误标完成。当前提交按第二笔请求 ID 查询,能在第三笔完成后仍正确返回第二笔在运行。 当前提交已拒绝带其他 ID 的 HTTP 200 和 404 缺失响应,也拒绝不带 ID 的 200;它仍把不带 ID、也未标明会话缺失的 404 写成终态,之后收不到本次真实完成。 此改动限于 Botmux 状态查询及本地回执,不修改 Goal 进度、重新派发规则、外部消息或界面。
改动思路 / Approach
派发回执已有 trigger_id;复用现有 Botmux 适配器、同一把绑定锁和既有状态转换。只有响应身份已验证或明确属于旧式会话缺失时才进入终态。分开判断会话缺失与普通的无身份 404,可以在适配器内修完。 此改动限于 Botmux 状态查询及本地回执,不修改 Goal 进度、重新派发规则、外部消息或界面。
老的明确会话缺失仍有兼容测试。普通 404 没有提供同样的身份依据;当后续结果可能恢复时,要让已有的状态命令继续查这一笔。现有状态机可保留,不需要迁移回执。
具体改动 / Changes
依据 docs/integrations/botmux-goal-channel-runtime.md 在 af9b668ff7fb6ddfd0b78022bf22563bd5891378 的约定复验。集成规范 · Botmux 状态路由 · 上游缺失响应
-
dispatch_id_query:通过。后续轮次沿用已有会话;状态读取本次已接收的派发。
-
typed_lifecycle_attribution:未满足。只将本次派发的类型化提供方观察写进它自己的回执。 当前上游的状态型缺失用 HTTP 200 并回送查询 ID;当前 404 兼容分支把没有身份的通用缺失也当成了会话缺失。
-
local_receipt_only:通过。状态命令只在显式执行时持久保存观察,不据此改变 Goal。
-
从未排队的未知派发留在本地,不能借用已接收的先前结果。 unaccepted_dispatch
-
已接收的派发用持久化 ID 调用 Botmux 的逐笔查询。 pinned_trigger_id
-
404 错误处理将通用 not_found 与明确会话缺失一并归类。 session_level_missing
-
除会话级例外外比对响应 ID;外来 ID 不再提供输出。 identity_unverified
-
执行模式保存类型化状态,随后只允许保留终态,不能晋升错误的 not_found。 _persist_dispatch_receipt
上一次的错 ID 问题 已复验。带外来 ID 的 200 和 404 现在都保留可恢复状态;真实完成抵达后可以正常写入回执。
对主干的风险 / Risks
Botmux 和迁移测试:分支基线 25 项、当前提交 34 项通过;Git 差异、签署和针对当时主干的模拟合并通过。 用实际 LoopX CLI 和回环 HTTP 夹具模拟 Botmux 响应,核对落盘;未连接真实 Botmux/Lark,未读取托管 CI。
真实 CLI 核对了按当前 ID 查询、拒绝外来 ID(200 和 404)、无 ID 的 200 后恢复、匹配的会话缺失及旧式 unknown_session;预览只读,执行只改当前回执,正式禁用后无 HTTP 请求。 分支基线和早先的补丁都能复现通用 404 的误终结;这是本次身份修复仍覆盖不到的入口。仅在临时副本收窄旧式例外后,通用 404 仍保持可恢复,同一笔的后续完成可落盘,其余对照和 34 项测试仍通过。重跑 uv run --extra test python -m pytest -q tests/control_plane/test_botmux_goal_channel_runtime.py tests/test_state_migration.py,并补上 HTTP 404 两个分支及同一笔完成的对照。
我的整体评价 / Verdict
只让明确写明 unknown_session 且没有 triggerId 的旧式 404 走会话缺失分支;通用 not_found 必须核对本次 ID。无 ID 时保留可恢复的 unknown,再用同一次派发的 completed 验证恢复。 提供方响应是本地派发回执的观察;仅 --execute 持久化,不能据此完成 Goal 或再派发。 建议把这一步一起修在现有 Botmux 适配器中,再复验预览和写入;不需要改变终态规则。
English verdict: REQUEST_CHANGES on 8365adc. The new code correctly rejects mismatched trigger IDs and preserves explicit legacy session misses. A generic HTTP 404 with no trigger identity is still treated as a confirmed session miss and seals the local receipt before its later valid completion can be recorded.
| # A bare "this session is gone" names no turn, so it cannot be | ||
| # attributed to another one; a missing result that does name a turn | ||
| # is checked like any other response. | ||
| session_level_missing = not echoed_trigger_id |
There was a problem hiding this comment.
[P2] 仅凭通用 404 就把回执写成终态。 回环 HTTP 对第二笔已接收的请求返回 404、state=not_found,未带 triggerId 或明确的 unknown_session。CLI 执行后保存 not_found;下一次匹配的 completed 也无法更新回执。将无 ID 例外限为明确的旧式会话缺失,并用同一请求回包序列复验。
…issing The exception for a not_found that names no turn accepted any 404 with state not_found, so a generic 404 with no triggerId could still seal an accepted receipt as a terminal not_found that no later state may replace. Treat a response as session-level missing only when it is an explicit unknown_session naming no turn. A generic 404 not_found, or one naming a turn, is verified against the request's trigger id like every other response. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.com>
|
已在新提交修复:无 id 的例外现在只保留明确的 我上一版保留旧式分支时写宽了:条件是 测试:
本地 35 项通过,ruff 干净。没有覆盖:仍是 requester 替身层面的测试,没有走真实 CLI 对回环 HTTP 夹具;托管 CI 在新 head 上尚未跑完。 |
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
Reviewed commit: 176e817b768c3cc7cd7509d6d3493e305bad16fc · merge base 7bb1b01687c5ecb36971b19fc432d6019d3e5492.
无阻塞发现。 通用 404 后同一笔任务的有效完成可写入回执,明确旧式会话缺失仍能读回。
动机 / Motivation
操作者复用一个 Botmux 会话派发多笔任务,通过 LoopX 确认其中一笔是否完成。 已接收的派发只读取本次请求的状态,并保留旧式明确会话缺失的兼容行为。
基线按会话读最近一笔。第二笔仍在运行时,第三笔的完成可能被写到第二笔回执。 现在状态查询携带第二笔的请求 ID,并先核对响应身份,因此第二笔仍然显示在运行。 上轮的通用 404 会把已接收的派发写成终态。当前它保持可恢复的 unknown,随后同一 ID 返回 completed 时正常落盘。 这次改动覆盖 Botmux 状态查询及本地回执。状态命令只读预览或按 --execute 保存观察。
改动思路 / Approach
继续在 Botmux 适配器内使用已保存的触发 ID、共享传输、文件锁与类型化回执。只有明确的旧式会话缺失可以省略 ID。 这次改动覆盖 Botmux 状态查询及本地回执。状态命令只读预览或按 --execute 保存观察。 已有的状态命令和回执格式足以完成处理。旧式会话缺失有明确的响应形状和回归测试。无归属的观察可以在下一次查询获取真实结果。
具体改动 / Changes
按 docs/integrations/botmux-goal-channel-runtime.md 在 af9b668ff7fb6ddfd0b78022bf22563bd5891378 的合同复验。上游正常缺失使用 HTTP 200 并回送请求 ID。 集成规范 · Botmux 路由 · 上游缺失处理
-
dispatch_id_query。复用会话时按实际派发身份读取状态。
-
typed_lifecycle_attribution。仅接受归属已核实的派发状态,保留明确会话缺失兼容。
-
local_receipt_only。预览保持只读,显式执行只持久化当前派发观察。
-
从未排队的派发保留自己的本地状态。 unaccepted_dispatch
-
请求携带回执中的触发 ID。 requester
-
只为明确会话缺失保留无 ID 的旧式 404。 session_level_missing
-
缺失或错用 ID 时保留可再次查询的状态,不提供其他派发的输出。 identity_unverified
-
在执行模式下写当前回执并保留既有终态。 _persist_dispatch_receipt
对主干的风险 / Risks
基线 25 项、当前提交 36 项 Botmux 和迁移测试通过。Git 差异、分支签署及检查时主干的模拟合并通过。 真实本地 CLI 配合回环 HTTP 夹具验证请求和持久回执。部署中的 Botmux/Lark 和托管 CI 未纳入验证。
第三笔完成后第二笔仍报告 running。无 ID 的通用 404、无 ID 的 200 及携带外来 ID 的 200/404 均保持 unknown,匹配的后续完成均能写入。 明确旧式 unknown_session 和匹配 ID 的缺失仍写入 not_found。普通 HTTP 错误保留已排队状态。正式禁用后无状态查询请求,已保存回执字节不变。 在上一提交,通用 404 写入终态后重复读取仍挡住真实完成。当前重跑使用同一请求及同一 HTTP 对照。 上轮评审
我的整体评价 / Verdict
通过当前提交。Botmux 观察由本地持久派发身份限定。终态由已有类型化的回执转换写入,Goal 生命周期仍由已有控制面处理。 后续普通查询可以继续确认这笔任务的结果,现有明确缺失仍可展示。历史上已经写成终态的回执由原状态机保留。
English verdict: APPROVE 176e817. The current CLI retains explicit legacy session absence, qualifies ordinary not_found by trigger identity, and records the same dispatch's later valid completion after an ambiguous response.
Goal And Delivered Outcome
_status_botmux_runtimeinloopx/control_plane/goals/botmux_runtime.pyread back a dispatch with the session'strigger-result, which is the session's latest turn. On a reused session that is not necessarily the turn the receipt belongs to: a dispatch the provider never accepted (attempting,rejected, or anunknownthat was never queued) has no turn in it, and an accepted one can be overtaken by a newer turn another client started.statusreturnedcompleted,ok=True,readback_verified=True, andstatus --executeraisedinvalid botmux dispatch transition: rejected->completed. After:rejected,ok=False,readback_verified=False; anattemptingreceipt is promoted tounknownand persisted, and repeated status keeps a never-queuedunknownunknown. (2) After an accepted second turn failed and another client completed a third turn,statusreported the third turn's completion for this dispatch and--executepersisted it. After: status asks for the receipt's storedtrigger_id, promotes a provider state only when the response names that same id, and otherwise reportsunknown(trigger_identity_unverified) without promoting. Rows:regression_parity,unit.mainat7bb1b01.Author Declaration
Implemented against
_status_botmux_runtimetests/control_plane/test_botmux_goal_channel_runtime.py::test_status_never_vouches_for_rejected_dispatch_on_reused_session,::test_status_promotes_unresolved_attempt_on_reused_session_without_provider_resultunknownstays unknown on repeated status_status_botmux_runtime::test_repeated_status_never_adopts_previous_result_for_interrupted_dispatch,::test_status_recovers_accepted_dispatch_after_a_status_read_failure_status_botmux_runtime::test_status_reads_the_turn_this_receipt_was_queued_under,::test_status_does_not_promote_a_result_attributed_to_another_turn,::test_status_without_a_stored_trigger_id_asks_the_provider_nothingloopx.clibecause the local tree could not import the real one;test_runtime_cli_parses_setup_doctor_trigger_and_statuswas deselected.Scope And Continuation
statusread-back of a Botmux dispatch. The?triggerId=query and the echoedtriggerIdfollow the Botmux async-trigger contract as read from its source at the commit the reviewer cited; no live Botmux was contacted. A dispatch whose POST response was lost, so notrigger_idwas stored, staysunknownrather than being recovered automatically; recovering it needs a per-turn provider lookup keyed by something LoopX already holds.Validation
6681ca1ad179e20a16bf3599ba9f41a9576e3969for the diff; local runs used a working tree whose touched files were blob-identical tomain7bb1b01before the change.regression_paritypassedunitpassedtest_botmux_goal_channel_runtime.pyandtests/test_state_migration.pytogether: 25 passed, 1 deselected;ruff checkclean.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).none.Signed-off-bytrailer (git commit -s).🤖 Generated with Claude Code