Skip to content

fix(dsh): honor cancellation when command probes finish - #8520

Merged
huangruiteng merged 1 commit into
loopx-project:mainfrom
xiaobaifly7:codex/dsh-resolver-late-cancellation
Nov 11, 2026
Merged

huangruiteng merged 1 commit into
loopx-project:mainfrom
xiaobaifly7:codex/dsh-resolver-late-cancellation

Conversation

@xiaobaifly7

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

The resolver can report missing after a version probe completes at the same time its maintenance signal is cancelled. It checks cancellation only when the runner throws this module's LoopXCliError('aborted'); a returned nonzero result or another rejected error is swallowed, and a late successful result can be accepted.

Recheck the supplied signal when the probe resolves or rejects. Cancellation now remains a nonretryable aborted result, which the existing Driver suppresses, and no fallback candidate is probed after cancellation.

  • Outcome basis: an offline reproduction of the resolver/Driver cancellation boundary.
  • Intended base: main, fresh branch from d3ac3bd8d69821ae5843b7cef5fdb6dcbc7cae74.
  • This demonstrates a reachable plugin defect; it does not establish the cause of any historical installed-host failure.

Author Declaration

  • Written by: model_agent, OpenAI Codex (GPT-6).

Implemented against

  • Specification: no written specification; the reproduced defect in this PR is the basis. Existing cancellation ownership is packages/dsh-loopx-plugin/src/cli.ts:resolveLoopXCommand and src/driver.ts:evaluate at the base above.
Criterion Disposition Symbol / path Test
Cancelled probe completion remains aborted for returned success, returned failure and rejection implemented src/cli.ts:resolveLoopXCommand three completion-boundary cases in tests/cli.spec.ts
Driver does not publish a missing-CLI warning or queue work for cancelled maintenance implemented existing evaluate catch tests/driver.spec.ts maintenance-signal case
Uncancelled command selection, version floor and retry policy remain intact implemented existing resolver existing resolver/Driver cases
  • Self-check: plugin host/client/test typechecks; focused CLI and complete Driver tests; four baseline/head regression cases. The change uses the existing signal and error owner, with no dependency, setting, new error kind or retry.

Scope And Continuation

Complete within this cancellation race. Resolver preference, durable Windows runtime provisioning, diagnostic enrichment and GoalBar failure projection are independent. In particular, this does not implement the GoalBar work claimed in #8506.

Validation

  • Tested revision: 4e8fbaeb308eba2e0e7be060bcfe1d4a5f68321f.
  • Run state: finished.
  • Input classes: synthetic.
Check kind Result Evidence / limitation
regression_parity passed All four new cancellation cases fail against the actual main resolver and pass after the fix; source restored after the comparison.
unit passed Complete tests/driver.spec.ts: 65 passed. CLI runJsonCommand group: 22 passed; three unchanged mutation/reaping cases excluded.
static passed All three plugin TypeScript configurations checked directly with the installed compiler; diff and bilingual RFC checks passed.
static blocked The local pnpm wrapper reports ERR_PNPM_VERIFY_DEPS_BEFORE_RUN; direct installed compiler/test-runner entrypoints were used without changing package or lock files.
integration not_run Full plugin suite, build/package canaries and complete premerge were not rerun for this separate branch.
real_entrypoint not_run No installed Harness, live session or real provider was used.

The tests exercise the actual resolver and Driver with controlled probe completions. They qualify cancellation handling, not installed-host recovery or the timing of a historical incident.

Frontend / Visual Evidence

  • UI impact: none. The existing Driver cancellation boundary is preserved; no component, protocol or GoalBar projection changes.
  • Before/after, viewports, preview and craft review: N/A.
  • Source data: synthetic.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Host or runtime integration
  • Capability or extension

Technical Direction

Preserve the existing DSH Driver cancellation contract. No new capability, shared authority or migration claim.

Shared-authority RFC fixture impact

N/A; no shared-authority or storage semantics change.

Boundary Checklist

  • No private state, credentials, raw traces, local machine paths or internal links in the diff or PR.
  • Scoped to the reproduced cancellation race; no competing GoalBar implementation.
  • No paired RFC changed.
  • UI impact is none.
  • Every commit includes a DCO sign-off.

Signed-off-by: xiaobaifly7 <196511160+xiaobaifly7@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

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 · max

动机 / Motivation

这项修复影响已启用 LoopX 自动续跑的 DSH 会话:用户或宿主取消一次维护任务时,命令探测可能恰好结束。旧版能在取消后接受刚返回的有效版本;非零结果和普通拒绝仍会进入备用探测,Driver 也可能把一次正常取消报成缺少 CLI。这次变更让已取消的探测统一返回不可重试的 aborted;Driver 安静结束这次尝试,不排队,未取消的备用路径仍可用。范围限于版本探测完成时的取消;不改变安装、版本下限、续跑授权、GoalBar 或其他故障诊断。

改动思路 / Approach

同一会话 Driver 和 AbortSignal 持有取消;命令解析器负责读取版本并返回原 typed 错误。 成功和拒绝都在现有 await 边界检查原 AbortSignal;沿用既有非重试错误和 Driver 消费,无需全局重试或更改宿主。 直接撤掉备用解析会破坏无取消的 Windows 或托管安装。正反路径都在同一解析器验证,未激活 Session 的 Driver 及 GoalBar 仍按原条件工作。 当前范围只在 resolver 完成时重新读取信号;Driver 生产代码继续使用原取消处理。 复用已有取消结果即可;把检查移到 Driver 会漏掉其他解析器调用者,改变 fallback 或延迟会引入无关风险。

具体改动 / Changes

依据 DSH 设计:docs/plans/2026-08-20-dsh-native-skill-driver.md,固定修订 d3ac3bd。逐项:Same-session cancellation — implemented;Retry ownership — implemented。

关键代码讲解

  • cli.ts:380:探测完成先读信号,再决定能否采纳版本,因此晚到的有效结果也不能复活被取消的工作。
  • cli.ts:385:普通拒绝若与取消重叠仍输出 aborted;未取消时原候选循环接续。已经是 typed aborted 的异常保持原语义。
  • driver.spec.ts:470:维护控制器和 Driver 控制器不同,回归覆盖维护信号的来源;CLI 测试同时覆盖三种完成结果。生产代码只加了六行,其他两文件均为回归测试。

对主干的风险 / Risks

无阻断发现。 实际 Node 进程的成功、非零和 adapter 拒绝在取消后均成为 aborted 且只有一候选;基线一例接受旧结果、另外两例进入备用 runner。Driver 对照基线有 missing 警告,head 无警告、无排队。 真实子进程在未取消时先返回非零,第二候选仍被接受,版本下限和 argv 保持原合同。 完整的三个受影响测试文件共 112 项通过;host、client 和 tests TypeScript 配置、源包 build、DCO、diff/RFC 配对及公开边界检查均通过。精确差异的变更质量回执已验证。 #8521 在同一区域只改诊断;本地合成两变更后取消用例仍过,诊断缺陷单列,不影响本 head 的结论。

我的整体评价 / Verdict

精确 head:4e8fbaeb308eba2e0e7be060bcfe1d4a5f68321f。长程推进:正常取消不会被当成缺少 CLI 或激活另一候选,下一次合法触发仍可继续。用户体验:少一次误报警告,不需要重填配置。检查了命令解析、Driver 取消和现有 GoalBar service 调用。没有新增或修改渲染页面。 未在已安装 DSH、Windows 或旧 SDK 上重启会话;未查询远端 CI,也未跑整仓 premerge。本地 package build 不代表安装或合并资格。

English verdict: APPROVE — 4e8fbae; real spawned completion tests preserve cancellation and the uncancelled fallback, with no blocking finding.

@huangruiteng
huangruiteng merged commit cf807b5 into loopx-project:main Nov 11, 2026
34 of 44 checks passed
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.

3 participants