fix(runtime): 完成通知允许静默结束,并收窄例外范围 - #564
Merged
Merged
Conversation
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 #504
PR #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 #504.
PR #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 #560 and PR #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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与修复
Fixes #504
Lands #550
任务完成后投递给发起会话的 completion 通知,模型按提示无需回复时,运行时仍把空输出当作失败:先自动重跑,再报
EMPTY_MODEL_RESPONSE。本分支保留 #550 的修复方向(只有 Main 从 Host 台账解析出的 completion 来源信息才能豁免静默),并补上审查发现的落地项:pnpm test:e2e:session-completion,中英规格同步。验证(macOS arm64 / Node 24,独立 worktree,候选已 rebase 到当前
origin/main)3f02b9777c1df831c3ff782519635eefd995a4bec36d24600e2e2aac53583319b754dfba13a4f436pnpm build:js、pnpm lint、check-architecture、pnpm docs:check通过session-message-input.test.mjs5/5pnpm test:e2e:session-completion通过(真实 host-core 台账 + 生产 Main 来源解析器 + sidecar + 本地 SSE;新增断言:静默通知之后的每个请求都不携带空 assistant 消息)pnpm test:e2e:collaboration通过origin/main的 runtime.ts 换入重建后,同一 E2E 在完成通知处报EMPTY_MODEL_RESPONSE;换回候选源码后通过未覆盖:Electron 队列/outbox UI 路径、真实付费 provider。
🤖 Generated with Claude Code