Repository navigation
fix(agent-core-v2): recover failed uploaded image references - #5000
Open
pvzheroes125 wants to merge 1 commit into
Open
pvzheroes125 wants to merge 1 commit into
pvzheroes125 wants to merge 1 commit into
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. |
🦋 Changeset detectedLatest commit: c15b4a6 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 |
commit: |
This branch has not been deployed
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
已上传图片可能留下不可读的
ms://引用,导致包含这张历史图片的后续模型请求持续返回 400。即使会话仍保留本地原图,现有上传缓存也会一直复用失败引用。本 PR 提供 #4948 图片恢复部分的独立替代方案,目标同为
release/2026-11-16;不替代 #4948 的其他修复。该分支已包含 #4905 的上传状态校验,本 PR 在其基础上补充错误发生后的恢复和持久标记。Bug Reproduction Steps
error,模型读取它时返回图片引用错误,或invalid_request_error类型的Invalid request Error。Root Cause
上传缓存记录远端文件 ID,但没有记录“这个本地图片在当前上传目标已明确失败”。上传响应校验可以防止新失败引用进入缓存,无法处理旧版本已经保存的失败引用。
这是客户端恢复措施:复用本地原图发送内联图片,不修复服务端文件。旧缓存引用只有在文件查询明确返回
status: error或extract_status: error时才作永久标记;新上传响应明确失败时也写同一标记。Code Changes
复用现有附件、上传缓存和请求恢复策略。正常请求不增加文件 GET;在限定的 400 后查询本次实际发送且能映射回本地图片的文件,保留正常引用,只让确认失败的图片回退原图。
mediaPolicy.ts:仅匹配 HTTP 400 的两种形态:Invalid request Error且类型为invalid_request_error,或明确的failed to validate image_url content: blob ID … does not exist。保留现有格式、解码等图片错误处理。mediaResolverService.ts:记录已解析图片与既有缓存键的对应关系;标记复用image-upload-cache,作用域仍是本地文件、provider、协议、base URL 和账号。保留旧缓存文件和本地原图,不改会话历史或数据库格式。Behavior Changes and Affected Users
必要回归共 143 项通过,覆盖原有媒体能力、上传状态校验与请求生命周期,以及多图去重、只替换坏图、单次重试、后续请求与新 resolver 实例不再上传、账号隔离、不确定查询结果和其他 400 不误伤。无限重试下同一次请求也只检查一批文件,下一次独立请求仍可重新检查尚未确认失败的文件。Core typecheck 通过;变更文件的 type-aware lint 无 error,6 条 warning 均位于未改动的基线代码。
同一恢复实现此前还用合成图片做过真实服务端验证:失败引用触发 400 后查询状态,坏图回退原图并成功请求,下一轮与新进程不再查询或上传。该实测使用旧 Vendor 基线;本 release 移植的验证为上述定向回归和类型检查,未重新跑整套 UI 或 Windows fullstack。
验证命令与文件
新增回归放入现有
mediaResolver.test.ts;llmRequesterService.test.ts仅补接口 stub。release 已有的正常 MCP 截图上传测试与上传状态测试完整保留。Checklist
/approve). No new issue; this is an alternative implementation of the media recovery in fix: resolve behavior regressions from #4630 #4948 for maintainer review.gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update. No new command or configuration.