Repository navigation
fix(agent-core-v2): show task notifications in live transcript - #4465
Conversation
🦋 Changeset detectedLatest commit: 741bd53 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24b690463b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| export class TurnPrompt extends AgentEvent2<z.infer<typeof turnPromptSchema>> { | ||
| static override readonly type = 'turn.prompt'; | ||
| static override readonly durable = true; | ||
| static override readonly observable = true; |
There was a problem hiding this comment.
Keep turn.prompt off public event streams
Setting observable publishes TurnPrompt for every turn, not only task-origin turns. Both kap-server's broadcaster and node-sdk's session wiring forward observable events, but turn.prompt is absent from the public agentEventSchema and the SDK's closed Event union, so schema-validating desktop/web clients can reject or drop every prompt event and exhaustive SDK consumers receive an event their API says is impossible. The event also carries raw input, including hook-injected parts and unprojected media URLs that TurnStarted deliberately filters. Keep this event internal to transcript projection or explicitly filter it at every public boundary. These contracts have external desktop, web, extension, and SDK consumers.
AGENTS.md reference: AGENTS.md:L123-L125
Useful? React with 👍 / 👎.
Read the active prompt by turn id instead of adding transcript-only event data. Prevent duplicate notification frames during cold heals.
Publish turn.prompt on the agent event bus and consume it in live transcript projection. Forward observable turn prompts through WS, SDK, and klient.
24b6904 to
741bd53
Compare
The behaviour of MoonshotAI#4421 has been in the requester since 94397aa, but its suite still asserted only that the lowered system message lost its `tools` field, which a message kept in place would also satisfy. Assert instead that no system message survives and the history keeps its length, and rename the case after what it protects. Also settle ten ledger rows that were already implemented here: MoonshotAI#3733, MoonshotAI#4413, MoonshotAI#4418, MoonshotAI#4421, MoonshotAI#4435, MoonshotAI#4460, MoonshotAI#4465, MoonshotAI#4516, MoonshotAI#4523, MoonshotAI#4532 and the MoonshotAI#4558 test calibration, each with a probe over the suite that pins it. Two rows carried a probe without a test-name selector (MoonshotAI#4557, MoonshotAI#4558), which aborted `--verify` for every other row; MoonshotAI#4557 is a changelog sync and now carries a manual probe.
Requirement or Bug
修复后台任务完成并自动开启后续回合时,desktop / web 的 live 会话只显示后续工具活动、看不到 NotificationCard 的问题。
Bug Reproduction Steps
<notification>,但 live 时间线没有 NotificationCard;后续 heal 完成后卡片才出现。Root Cause
TurnStarted对 task origin 不携带公开prompt,而 kap-server 的 live 投影又把同任务的task.notified当作“本轮 prompt 的重复内容”丢弃。因此,live transcript 既没有通知 prompt,也没有通知 frame,客户端没有数据生成 NotificationCard。冷快照 heal 随后补回 prompt,所以通知又会显示。本次是根本修复:为 task-origin 的
TurnStarted增加仅用于 transcript 投影的内部transcriptPrompt,让完整通知直接进入 live prompt。公开prompt和公共TurnStartedEvent类型保持原契约,WS / SDK / klient 边界均剥离内部字段,避免原始 XML 泄露给既有客户端。Code Changes
Behavior Changes and Affected Users
TurnStarted.prompttranscriptPrompt内部字段受影响模块与验证:
agent-core-v2:idle-notification-repro6 个测试通过;typecheck 通过。kap-server:transcript与sessionEventBroadcaster共 232 个测试通过;typecheck 通过。node-sdk:session-event-wiring6 个测试通过,包含公共类型断言;typecheck 通过。klient:memory32 个测试通过,包含validate:false;typecheck 与 examples typecheck 通过。check-no-comments:1776 个文件通过。oxlint --type-aware --threads=1:77 warnings、0 errors;全仓pnpm run lint与其余 CI 检查均已通过(test-windows按设计 skip)。UI Evidence
使用真实 kap-server 与随仓库打包的 Kimi Code Web,在两个版本中执行同一受控场景:后台 Bash 完成后自动开启 task-origin 回合。
d18a7bcd3:回合仍在运行(busy=true),模型已收到完整通知,Skill 卡可见,但 NotificationCard 为 0。650415b60:同一 live 阶段 NotificationCard 为 1,通知正文和输出路径可见;heal 完成后仍为 1,没有重复。查看两次实测的机器判定 JSON
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.