Repository navigation
fix(agent-core-v2): validate Kimi media upload status - #4905
Merged
7Sageer merged 3 commits intoNov 13, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 4800cf4 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: |
7Sageer
approved these changes
Nov 13, 2026
sailist
changed the base branch from
release/2026-11-13
to
release/2026-11-13-2
November 13, 2026 08:55
7Sageer
approved these changes
Nov 13, 2026
Merged
6 tasks done
This was referenced Nov 14, 2026
wbxl2000
pushed a commit
that referenced
this pull request
Nov 16, 2026
* fix(agent-core-v2): avoid quadratic cloning during session replay (#4885) * fix(agent-core-v2): avoid quadratic cloning during session replay * fix(agent-core-v2): isolate replay assignments and preserve rollback order * refactor(agent-core-v2): make participant mutable replay explicit opt-in --------- Co-authored-by: kimi-agent-bot <[email protected]> * fix(agent-core-v2): validate Kimi media upload status (#4905) * fix(agent-core-v2): reject failed Kimi image extraction * chore: add Kimi image extraction changeset * fix(agent-core-v2): validate Kimi media upload status * fix(kap-server): forward swarm member task events (#4922) * test(agent-core-v2): make zero-timeout task wait deterministic (#4925) Co-authored-by: kimi-agent-bot <[email protected]> * feat(registry): support search_url and feedback_url on custom registry providers (#4875) * feat(registry): support search_url and feedback_url on custom registry providers * fix(sdk): honor provider.env credentials and custom_headers for feedback_url * refactor(core): submit feedback through the engine Web and desktop reach this machine through kap-server, so feedback submission resolves the active model's provider in the engine and is exposed on the same route and klient method. The SDK facade keeps the managed OAuth path and no longer re-derives provider credentials. * refactor(sdk): drop the unused feedback facade Product clients submit feedback through the engine. The SDK facade and oauth toolkit no longer keep a second managed-only submission path. * refactor(feedback): share engine schemas across route and klient The HTTP body uses the engine field names, so the route forwards it and the klient contract imports the same schemas. * refactor(feedback): drop unused kap and klient surfaces TUI reaches IFeedbackService through the harness. The HTTP routes, klient facade, and the schemas that only served them have no caller. * refactor(feedback): package and upload feedback attachments in the engine * refactor(feedback): keep FeedbackService internal to agent-core-v2 * test(cli): provide execFile in node:child_process mocks The feedback codebase scanner added in this branch calls promisify(execFile) at module scope and is now reachable from the agent-core-v2 index, so partial child_process mocks in these suites failed module evaluation. * feat(feedback): disclose submitted files, attach request_id, and drop text-only option (#4876) * feat(registry): support search_url and feedback_url on custom registry providers * fix(sdk): honor provider.env credentials and custom_headers for feedback_url * refactor(core): submit feedback through the engine Web and desktop reach this machine through kap-server, so feedback submission resolves the active model's provider in the engine and is exposed on the same route and klient method. The SDK facade keeps the managed OAuth path and no longer re-derives provider credentials. * refactor(sdk): drop the unused feedback facade Product clients submit feedback through the engine. The SDK facade and oauth toolkit no longer keep a second managed-only submission path. * refactor(feedback): share engine schemas across route and klient The HTTP body uses the engine field names, so the route forwards it and the klient contract imports the same schemas. * refactor(feedback): drop unused kap and klient surfaces TUI reaches IFeedbackService through the harness. The HTTP routes, klient facade, and the schemas that only served them have no caller. * refactor(feedback): package and upload feedback attachments in the engine * refactor(feedback): keep FeedbackService internal to agent-core-v2 * test(cli): provide execFile in node:child_process mocks The feedback codebase scanner added in this branch calls promisify(execFile) at module scope and is now reachable from the agent-core-v2 index, so partial child_process mocks in these suites failed module evaluation. * feat(feedback): disclose submitted files, attach request_id, and drop text-only option * fix(session-export): keep SESSION_NOT_FOUND for missing non-empty session ids The global-log-only fallback exists for feedback submissions without an active session (empty id). Scoping it to empty ids restores the 40401 envelope that kap-server's export route promises for unknown sessions. * test(agent-core-v2): pin retained request id semantics in llmRequester assertions * chore: sync web dist from code-app code-app: 11563df26b92f0035659083327976a2e9b8e6727 code-app-release: b0b6d9c7a45c96ca48039ff05789c6e90f76ef20 code-app-local-build: 005d2b437493b7ab04d01f70542f3b6356699f4d * ci: release packages (#4918) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(agent-core-v2): align request id back-sync with main --------- Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: Haozhe <[email protected]> Co-authored-by: 7Sageer <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
5 of 6 tasks
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.
Requirement or Bug
Windows 会话中,
ReadMediaFile读取从 Word 提取的公式图片后,后续模型请求可能反复返回 HTTP 400。代码层面已确认:Kimi 文件上传适配只检查上传接口是否返回文件 ID,没有检查文件处理结果,导致处理失败或尚未就绪的文件仍可能变成并复用ms://引用。Kimi
/v1/files还存在两种响应形态:托管智能体格式使用extract_status/extract_error,模型推理兼容格式使用status/status_details。本 PR 在生成和缓存引用前统一校验两种形态;原始 Windows 案例是否由同一机制触发仍需其现场响应进一步核实,本 PR 不作超出代码证据的归因。Bug Reproduction Steps
代码级复现:
POST /v1/files返回 HTTP 2xx,响应包含文件 ID,以及extract_status: "error"或兼容格式的status: "error"。uploadImage调用真实kimiFiles上传一张图片。ms://<id>,媒体解析器随后会把它作为成功结果缓存并用于后续请求。回归测试还覆盖未就绪状态和空文件 ID,并让后续上传返回
extract_status: "ready"与status: "uploaded"的桥接响应,验证合法响应仍生成相同的ms://引用。Root Cause
createKimiFiles在client.files.create成功后直接返回文件引用,丢失了响应中的处理状态。上传请求成功与文件处理成功因此被错误地视为同一件事;而媒体解析器只会对适配器正常返回的结果写入内存与持久缓存,所以无效引用会跨后续请求复用。这是针对根因的修复:在引用生成之前拒绝失败、未就绪或缺少有效文件 ID 的响应,而不是在模型请求返回 400 后清理会话或绕过错误。
Code Changes
packages/agent-core-v2/src/human/llm/builtin/provider/kimi/files.ts:新增统一的parseUploadedKimiFile校验,同时服务 Kimi OpenAI、Anthropic 与 Responses 上传能力。extract_status存在时必须为ready。status接受ready/ok/processed;桥接响应中的status: "uploaded"仅在extract_status: "ready"时接受。id、不携带状态字段的精简兼容响应。status_details、extract_error、字符串或嵌套error.message、message中的可用详情;非字符串extract_error继续经 JSON 序列化保留。packages/agent-core-v2/test/llm-adapter/model/modelRequester.test.ts:等量扩展现有uploadImage用例,覆盖两种状态字段的失败与未就绪响应、错误详情、空 ID 和桥接成功响应,并保留原能力声明和凭证传递断言。测试声明数保持 14,未净增。.changeset/kimi-image-extract-status.md:更新用户可见修复说明,覆盖失败或未就绪的 Kimi 媒体上传。Behavior Changes and Affected Users
extract_status: "ready",或兼容状态status: "ready" / "ok" / "processed"ms://引用extract_status: "ready"同时携带status: "uploaded"ms://引用id,省略两种状态字段ms://引用extract_status为error、processing或其他非ready值status为error、processing、单独uploaded或其他非就绪值,包括与 ready 提取状态冲突ms://undefined或空白引用status_details、extract_error、error或messageextract_error受影响模块与覆盖:
modelRequester.test.ts直接覆盖状态校验、错误原因保留、成功响应及原能力声明/凭证行为。mediaResolver.test.ts全文件回归,包含未携带extract_status的真实 Kimi 上传成功场景和普通上传失败后的 inline 降级。验证结果与环境边界
modelRequester.test.ts14/14 通过。modelRequester.test.ts14/14,mediaResolver.test.ts58/58,合计 72/72 通过。agent-core-v2typecheck 通过。no-confusing-void-expression。Checklist
/approve). 本次为内部维护反馈,无单独 issue;问题背景与代码级复现已完整列出。gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. 本次为局部错误处理修复,不需要文档更新。