fix(agent): 修复附件状态同步:上传文件后 Agent 调用 read_file 无法读取用户附件问题#519
Merged
xerrors merged 2 commits intoxerrors:mainfrom Feb 25, 2026
Merged
fix(agent): 修复附件状态同步:上传文件后 Agent 调用 read_file 无法读取用户附件问题#519xerrors merged 2 commits intoxerrors:mainfrom
xerrors merged 2 commits intoxerrors:mainfrom
Conversation
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.
变更描述
背景与问题
在
44e41bb重构后,附件已转为基于 StateBackend 使用,但出现两个连续问题:read_file无法读取到用户上传附件;本 PR 目标(以第一提交为主)
第一提交核心修复:
attachments+files),确保附件立即进入可读文件系统视图,Agent 可直接通过read_file访问。第二提交补充增强:
files更新策略改为只处理/attachments/命名空间,采用增量合并(并对已删除附件写None删除),避免覆盖非附件 runtime files。具体改动
src/services/conversation_service.py/attachments/...,不再整包覆盖files。test/test_conversation_service_attachment_state.py修复效果
read_file /attachments/...直接读取用户上传内容;变更类型
测试
相关日志或者截图
说明
(可选)有什么需要特别说明的吗?
💡 提示: 提交前可以运行
make lint和make format检查代码规范