Skip to content

Discard canceled DSH continuation plans after maintenance - #8856

Merged
loopx-agent merged 1 commit into
mainfrom
codex/dsh-maintenance-plan-fence-20261116
Nov 16, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/dsh-maintenance-plan-fence-20261116

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Problem

The DSH Driver could build a queue or wait plan inside Agent maintenance just before Pause. Pause cancelled the controller while the result was still returning. The Driver applied that late result and submitted a stale continuation message or registered a stale recheck timer.

Change

Check the combined cancellation signal and the exact Session after maintenance returns, before applying either plan. An interrupted evaluation returns unavailable. An explicit Start makes a fresh evaluation, and the existing Pause checks still cover the already-claimed Turn.

Validation

  • Deterministic regressions exercise Pause and host maintenance cancellation after both a queue plan and a wait plan have been built. Each case verifies a subsequent fresh evaluation.
  • With base and candidate packages in isolated DSH 0.2.1-rc.2 sessions and real File and SQLite CLI backends, the old package published a queue request or timer after a committed owner Stop. The candidate published neither. Explicit owner Resume restored one fresh request or timer in every case. The probe used a synthetic local model and captured queue and timer publication. All eight runs recorded zero quota debits.
  • All 303 plugin tests, TypeScript checks, the packed GoalBar runtime smoke, and standard premerge validation passed. The packed Driver matched a rebuild of the signed commit.

Revalidate the captured Session and combined admission signal before publishing a queue or scheduler wait plan. Cover Pause and native maintenance cancellation for both plans, followed by a fresh evaluation.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

评审提交 bc788be746a6dfffdcac6606536ad6feafff65f8,按不可变 merge base 59e68906d4082f43fae52e4219e374c5e97539a9 对照。查到远端主干为 f599a60ce64fd78db80d6318c84e3af58bfc1df9,DSH Driver 代码相同,PR 分支在 GitHub 显示落后。

动机 / Motivation

在已启用 LoopX 的 DSH Session 中,通过 GoalBar 暂停、继续或由 Host 取消维护的用户。
DSH 维护回调已算完计划时,Pause 或 Host 可以取消评估。主干仍会把返回的旧计划入队或设置定时器,并报告评估成功。
在真实 DSH maintenance 回调算出 queue 或 wait 计划后取消,然后让回调返回。分别读回原始评估、实际 inbox 插入、定时器记录和显式 Start 后的下一次评估。
File 和 SQLite 上,主干分别留下旧入队或旧定时器。新提交的取消评估返回 evaluation_unavailable,原计划无可见效果。显式恢复产生一个新 guard,以及一个新请求或定时器。
验证使用 DSH 0.2.1-rc.2 与隔离的 File/SQLite CLI。观察真实 inbox 和定时器注册,合成输入止于模型执行前。现场已安装配置与其他支持版本待验。

改动思路 / Approach

在共享的 maintenance 返回边界检查当前 Session 与现有组合 AbortSignal。检查通过后,Driver 才会应用 queue 或 wait,取消继续由 GoalBar Pause 或 Host 触发。
在回调内继续校验绑定和 quota。取消落在回调计算结束之后时,新检查使用该次评估真实的组合信号,丢掉尚未应用的计划。

具体改动 / Changes

两个文件新增 47 行。按主干的 packages/dsh-loopx-plugin/README.md 复核 same-session-maintenance、cancellation-before-plan-application 和 explicit-fresh-evaluation。 基础契约

关键代码讲解

  • LoopXContinuationDriver.evaluate。进入维护前保存 Session,把 scheduler controller 与 DSH maintenance signal 合并。回调回来后先检查真实取消和 Session 变化,再写 scheduler token、设 timer 或提交 followup。 Driver
  • cancelQueued 与 cancelPending。Pause 取消正在计算的计划,并保留已经被 DSH 领取的原请求的原有处理。组合信号在 callback 返回后仍可读。 取消入口 · 取消 owner
  • evaluateActivatedSession。把本次没完成的评估返回为 unavailable。显式 Start 仍按已绑定 Session 重新评估。现有 GoalBar 调用两个同一 Session 的入口。 Driver 回执 · GoalBar 调用

对主干的风险 / Risks

  • 两库基线在取消后的真实 inbox 出现一次旧 continuation。当前两库在恢复前均为零,随后只出现一个新 guard 的 continuation。
  • 预置一条隔离的 quota 消费记录,让真实 CLI 给出可调度 wait。两库主干在取消后各注册旧 timer,候选在 Start 前均为零。Start 后各注册一次新 timer。主干把失败前的阶梯计入后一次,基线第二次等 60 分钟,候选从 30 分钟起。所有对照的新增扣额为零。
  • 两种后端的 queue 和 wait 共八次对照准确出现预期差异。精确提交的 303 项测试、TypeScript 和已打包的 GoalBar runtime smoke 通过。单独串行的标准 premerge 四项直接、六项选定检查通过。较早并发运行曾超时,另一次质量直跑在现有 GoalBar 50 ms watch 用例失败。 新增四个测试覆盖 Pause 与 Host 取消和两类计划,在主干 Driver 上按预期失败。 回归用例

我的整体评价 / Verdict

批准当前提交。一次检查同时覆盖队列和定时器。复用已经由 Pause 和 Host 写入的同一个信号,避免第三套取消状态。 等待和入队都保留可读的取消结果,显式继续可重新获得当前授权。

English verdict: APPROVE. Exact head bc788be746a6dfffdcac6606536ad6feafff65f8 discards queue and timer plans returned after DSH cancellation. A fresh explicit evaluation stays available on both File and SQLite.

@loopx-agent
loopx-agent merged commit ab95b72 into main Nov 16, 2026
35 of 41 checks passed
@loopx-agent
loopx-agent deleted the codex/dsh-maintenance-plan-fence-20261116 branch November 16, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant