Repository navigation
fix(kap-server): drop reserved metadata keys from session profile updates - #4842
Conversation
🦋 Changeset detectedLatest commit: e2b0f6e 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 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: |
06046f1 to
2079c71
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06046f1a24
ℹ️ 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".
* fix(agent-core-v2): truncate oversized skill content (#4834) * fix(kap-server): bind the main agent when a session is created (#4839) * fix(kap-server): bind the main agent when a session is created * fix(kap-server): reject a profile on prompt submissions * fix(kap-server): reject a profile change through the session profile * fix(kap-server): wait for model configuration before binding a new session * fix(agent-core-v2): deduplicate restored task notifications (#4836) * fix(agent-core-v2): deduplicate restored task notifications * chore: add notification replay fix changeset * fix(agent-core-v2): preserve task notifications after prompt-only crashes * fix(agent-core-v2): complete prompts before ending turns * test: align lifecycle snapshots with prompt completion order * fix(agent-core-v2): settle all prompts during turn finalization * fix(kap-server): drop reserved metadata keys from session profile updates (#4842) * fix(kap-server): drop reserved metadata keys from session profile updates * fix(kap-server): keep stored reserved metadata keys on profile updates * docs: split and rewrite the server API reference (#4841) * docs: split and rewrite the server API reference * docs: redirect old server API anchors to the split pages * docs: describe profile metadata as a replacement * docs: mark question responses as answered-only * fix(kap-server): avoid heartbeat timeout after scheduling stalls (#4823) * fix(kap-server): avoid heartbeat timeout reaping after stalls or clock jumps * fix(kap-server): grace heartbeat window for short scheduling stalls * fix(kap-server): treat only clearly late heartbeats as scheduling stalls * fix(kap-server): time heartbeats on a monotonic clock and drain queued input before reaping --------- Co-authored-by: Kimi Code (Grok Bot) <[email protected]> * fix(kap-server): undo a turn only once when requests race (#4846) * docs: describe heartbeat stall handling (#4849) * docs: describe heartbeat stall handling * docs: explain the monotonic clock in the heartbeat notes * fix(agent-core-v2): acquire session lock before loop restoration (#4848) * fix(agent-core-v2): acquire session lock before loop restoration * chore: add session lock lifecycle changeset * fix(agent-core-v2): hold session lock through loop restoration - add an operation-scoped lease to the session run gate - hold it across loop initialization, reset, and pending drains - cover idle timeout and release ordering * fix(agent-core-v2): keep the output of stopped tool calls (#4854) * fix(kap-server): drop the partial reply of a retried step (#4855) * fix(agent-core-v2): dedupe historical tool schemas (#4862) * fix(agent-core-v2): dedupe historical tool schemas * chore: add duplicate tool schema changeset * fix(agent-core-v2): preserve first tool schema declaration * fix(agent-core-v2): remind on changed tool schemas * fix(agent-core-v2): block stale tool schema calls * fix(agent-core-v2): normalize registry schemas in pending checks * fix(agent-core-v2): import registry tool metadata type * fix(agent-core-v2): preserve abort handling during validation * fix(agent-core-v2): refine validation hook preparation * fix(agent-core-v2): make validation hooks synchronous * fix(agent-core-v2): preserve tool result notes on fork (#4867) * fix(agent-core-v2): preserve tool result notes on fork * chore: add fork tool result note changeset * fix(agent-core-v2): scope tool result note restoration to forks * fix(agent-core-v2): normalize inherited tool result notes * fix(agent-core-v2): isolate fork note restoration * feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS (#4843) (#4870) * chore: sync web dist from code-app (#4871) code-app: 8ab17294e031323186d357d121c5360b8353900e Co-authored-by: kimi-agent-bot <[email protected]> * ci: release packages (#4835) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: sync web dist from code-app code-app: 5835391dac3a2b9e0c65ffbd418f0d6042a7adb2 --------- Co-authored-by: Haozhe <[email protected]> Co-authored-by: qer <[email protected]> Co-authored-by: Kimi Code (Grok Bot) <[email protected]> Co-authored-by: grapedge <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Requirement or Bug
POST /api/v1/sessions会丢掉metadata里的保留键(cwd、goal、parent_session_id、child_session_kind),但POST /api/v1/sessions/{session_id}/profile会把它们原样写进会话的自定义元数据。通过 profile 接口可以把任意会话挂到另一个会话的子会话列表下,也可以把真正的子会话从父会话下摘掉。Bug Reproduction Steps
POST /api/v1/sessions/B/profile,body{"metadata": {"parent_session_id": "<A>", "child_session_kind": "child"}}。GET /api/v1/sessions/A/children列出 B。反过来,对一个真正的子会话写
{"metadata": {"parent_session_id": null, "child_session_kind": null}},它就不再出现在父会话的子会话列表里。Root Cause
保留键的过滤只写在创建接口的路由里,profile 接口用请求的
metadata整体替换会话的自定义元数据,保留键也跟着被客户端覆盖或删除。根本修复:保留键由服务端掌管。创建接口丢弃请求里的保留键;profile 接口替换时,新的自定义元数据 = 请求中的非保留键 + 会话已存的保留键。Code Changes
profile 接口仍然是「请求的
metadata非空就整体替换」,这个约定不变。文档没有在这个 PR 里改:
server-api.md正在由 #4841 整页重写,两个 PR 都合入后,再在新的「会话接口」页补上 profile 接口丢弃保留键的说明,避免两边冲突。Behavior Changes and Affected Users
metadata.parent_session_id/child_session_kindPOST /sessions/{id}/children创建{ source })metadata.goalmetadata.cwdcustom.cwd。会话读取时用真实工作目录覆盖它;只有既没有 v2cwd、也没有 v1workDir的旧会话,索引会用custom.cwd作为工作目录,profile 写入任何metadata都可能改掉或冲掉它custom.cwd保留updateSession支持cwd参数,但现有代码路径都不传;没有其他调用方metadata键测试(
packages/kap-server/test/sessions.test.ts):null的父子键、回写别的父会话 id 三种情况,父子关系都保留;创建接口原有的同类测试不变。
Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.