Skip to content

fix(runtime): 完成通知允许静默结束,避免误报空响应 - #550

Closed
Blue-Berrys wants to merge 1 commit into
vastsa:mainfrom
Blue-Berrys:fix/issue-504-completion-empty
Closed

Blue-Berrys wants to merge 1 commit into
vastsa:mainfrom
Blue-Berrys:fix/issue-504-completion-empty

Conversation

@Blue-Berrys

Copy link
Copy Markdown
Contributor

任务已完成后,系统发送的 completion 通知允许无需回复,但运行时仍将空输出当作失败:先自动重试,再报 EMPTY_MODEL_RESPONSE。本次仅让当前 Host 台账确认的 completion 通知正常静默结束。

Fixes #504.

复用现有消息来源信息,校验目标会话及 message/reply-to ID;不增加插件可控制的跳过检查开关。每个新请求会重置例外,运行中接受用户追加指令也会恢复普通响应要求。普通用户请求、task/message、复制的通知文本仍保留一次重试和空响应错误;提供方错误、取消和原任务结果不变。同步了相关中英文规范和 E2E 场景。

验证(macOS arm64,专属 worktree):

  • 完整运行时测试 573 项、桌面 provenance/service/IPC 测试 27 项通过。
  • JS 构建、Host 构建、运行时类型检查、lint、文档检查通过。
  • 提交后同步主线,候选 4288e1238eb55985f9459b2b8f1c12774c5c613a,基线 cdc63d06b53eeaa5683ae3f7be804e86181eeda3,重新构建后运行 pnpm test:e2e:session-completionpnpm test:e2e:collaboration,均通过。
  • 新测试连接真实 Host 台账、生产 Main 来源解析器、sidecar 和本地 SSE,验证原任务及汇总、完成通知正常结算且不生成应答链,以及后续普通请求/伪造通知/task/message 的错误保护。

E2E 由测试驱动消息持久化与结算;没有覆盖 Electron 队列/outbox UI,也没有调用付费或真实远端模型。

另以未修改的主线 runtime 编译产物作对照,新 SSE 测试在完成通知处复现 EMPTY_MODEL_RESPONSE;恢复候选源码并重建后,同一测试再次全部通过。独立只读审查无阻断问题。

Completion notices already permit no acknowledgement, but the runtime
retried their empty success and reported EMPTY_MODEL_RESPONSE. Use only
the current Host-resolved completion provenance to accept that silence;
reset the exception for new runs and accepted user steering.

Preserve ordinary empty-response recovery and cover the trust boundary
with runtime tests and a real Host/sidecar/local SSE regression.

fixes vastsa#504
@vastsa

vastsa commented Sep 17, 2026

Copy link
Copy Markdown
Owner

感谢修复,方向和信任边界都没问题,已确认能复现并修掉 #504。审查里发现三处需要补:例外覆盖了整个回合(工具批次之后或 steering 之后的静默也会被放过)、被接受的空回复进入了下一轮模型上下文(目前只靠 pi-ai 转换器兜底)、以及 D409/ADR 0239 被原地改写而不是追加决策。已在当前 main 上落地:#564 (保留本 PR 的提交与署名,并补上上述三项与对应测试)。合入后会关闭本 PR。

@vastsa

vastsa commented Sep 17, 2026

Copy link
Copy Markdown
Owner

已由 #564 合入 main(保留本 PR 的提交与署名,并补上例外范围收窄、空回复不进上下文、D446/ADR 0239 修订段)。感谢贡献。

@vastsa vastsa closed this Sep 17, 2026
veyliss pushed a commit to veyliss/PI-Desktop that referenced this pull request Sep 18, 2026
PR vastsa#550 let a Host-ledger completion notice finish without visible text,
but the exemption covered the whole run and the accepted empty reply was
appended to the runtime entries. Two consequences: a reply that followed
tool results, or answered user steering that pi had injected before the
first response, could also end silently without D193 recovery, and the
empty assistant entry reached the next provider request, where only the
pi-ai converters kept it from being rejected.

Spend the exemption on the first settled reply of the run (silent, text,
or tool batch) and revoke it as soon as an accepted steering message
enters the model context; a provider retry of the same attempt keeps it.
Keep the accepted silence out of the runtime entries and pi transcript
state, and drop content-less assistants in the context projection, which
is what a restored transcript already did. The E2E now also asserts that
no request after the silent notice carries an empty assistant message.

Refs vastsa#504.
veyliss pushed a commit to veyliss/PI-Desktop that referenced this pull request Sep 18, 2026
PR vastsa#550 rewrote the accepted D409 row and the ADR 0239 decision text in
place. The log is append-only for accepted decisions, so restore both and
record the change as D446 with an ADR 0239 amendment section, marking
D409 and the ADR index row as amended. D444 and D445 were taken by
PR vastsa#560 and PR vastsa#563 while this branch was in review.

Align spec 02-agent-runtime §5e and the error-code table with the
narrowed contract (first reply only, tool batch and steering revoke it,
provider retry keeps it, accepted silence stays out of model context),
add the session-completion suite to the E2E routing index, and mirror
every change in the zh-CN pages.
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.

[Bug] 完成通知在任务已成功并总结后触发 EMPTY_MODEL_RESPONSE

2 participants