Repository navigation
Conversation
|
Codex Review Summary: ✅ CompletedThis 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: 740bbc8dae
ℹ️ 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".
| placement, | ||
| origin: presented, | ||
| text: text.join('\n'), | ||
| text: presented.kind === 'cron' ? cronPromptOf(text.join('\n')) : text.join('\n'), |
There was a problem hiding this comment.
Avoid double-stripping prompts in existing web clients
When a scheduled prompt itself contains <prompt>\n...\n</prompt> (for example, because it asks the agent to process that XML), the server now unwraps it once, but the shipped web client still calls its equivalent extractor for every cron item (apps/kimi-code/dist-web/assets/index-3waulFY5.js:162-169). Previously that client received the outer <cron-fire> envelope, so its single extraction returned the complete original prompt; with this change, its second extraction silently discards everything outside the prompt's inner tags. Preserve the old payload for existing clients, or make extraction require a complete cron envelope before changing the server-side shape.
AGENTS.md reference: AGENTS.md:L121-L123
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
已在 62b8e72 收紧服务端的拆包:只有文本恰好是 renderCronFireXml 生成的完整包装时才拆,提示词里自己带的 <prompt> 标签原样保留,并加了嵌套标签的用例。旧版 dist-web 对这种提示词还会多拆一层,这是过渡期内只影响显示的边角情况(给模型的内容不变)。code-app bump 子模块时会删掉客户端的解析器,之后 CLI 的 web dist 同步进来就消失了。这一点已写进 PR 描述,是否接受这个过渡期由维护者决定。
Requirement or Bug
定时任务触发的那一轮,开头的
user_message.text是写给模型的内部包装:任务 id、cron 表达式、是否重复这些信息已经结构化地放在
origin({ kind: "cron", job_id, schedule, recurring, coalesced_count, stale })里。所以每个按 KAP 渲染对话的客户端都得自己再解析一遍这段 XML,才能显示用户写的那句提示词。code-app 现在就在userMessageText.ts里维护着一份extractCronPrompt。Bug Reproduction Steps
user_message.text是整段<cron-fire>…</cron-fire>,而不是提示词本身。Root Cause
定时任务触发时,引擎用
renderCronFireXml把提示词包进<cron-fire>交给模型。kap-server 的userMessageItem把文本原样放进text;它对附件提示、媒体标签都做了剥离,唯独没有处理这层包装。Code Changes
只有文本恰好是
renderCronFireXml生成的完整包装(首行<cron-fire …>、结尾</prompt>\n</cron-fire>)时才拆,提示词里自己带的<prompt>标签原样保留;不是完整包装时(例如没有包装的旧数据),文本保持原样。过渡期的一个边角情况:在 CLI 自带的
dist-web更新之前,旧客户端还会对文本再跑一遍自己的解析器。如果定时任务的提示词里本身就带<prompt>…</prompt>,显示时会被多拆一层(只影响显示,给模型的内容不变)。code-app bump 子模块时会删掉客户端的解析器。Behavior Changes and Affected Users
user_message.text<cron-fire>XML受影响模块:
packages/kap-server/src/services/conversation/conversationItems.ts。测试:
test/services/conversation.test.ts里定时任务的用例改用真实的<cron-fire>包装文本,断言text是提示词本身;提示词里嵌套的<prompt>标签原样保留;没有包装的消息保持原样。code-app bump 子模块之后,可以删掉客户端的
extractCronPrompt。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset. 现有客户端已经自己剥掉包装,用户看不到变化,不写。gen-docsskill, or this PR needs no doc update.