Repository navigation
fix(memory): 支持默认模型热更新并透传模型服务错误 #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
openjiuwen-sync-bot
wants to merge
1
commit into
openJiuwen-ai:release/0.2.2
Choose a base branch
from
openjiuwenai:sync/pr-530
base: release/0.2.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head_sha:
cfd25b539bcb43e8a598fb74dd8dae9594ce736dImportant
I1. APIResponseValidationError
漏捕获(jiuwen_memory/common/llm/llm_impl/openai_llm.py:197-202)
异常继续外抛,既不记日志,也不走 502 映射。
I2. 确定性错误仍被重试和重复抽取(jiuwen_memory/construction/llm_retry.py:46、jiuwen_memor
y/control/engine_impl/grouped_write.py:380)
extract 被调用 2 次,并记了一次 merge_fallback。
错误的写入要打约 6 次上游请求、等待约 6 秒才报错。
做了免重复处理,本次新增的错误类型没有接入,「透传」的体验打了折扣。
同样跳过 merge fallback。
I3. retryable 一律为 False,与 S09
错误语义不符(jiuwen_memory_entry/core/error_response.py:23-24)
Minor
错误的写入会熔断 120 秒,期间读路径也降级为 None,而记忆服务本身是健康的。in-process
路径无此行为,两条路径不一致。
LLM 插件作者不知道要做转换,也没有 S09 测试基线要求的跨实现契约测试。
依旧是笼统内部错误。若本次有意只做 LLM,建议在 F05 已知遗留里写明。
的原因(如模型名不存在)无处可查。可记录经 safe_error_message 脱敏后的摘要。
才恢复「固定整条连接」的保护。S08 写了这个前提,但本仓库内 update_defaults
没有生产调用方(只有测试),宿主侧是否照做无法在此验证。
测试缺口
建议补充的用例:
test_host_update_rejects_locked_fields:update_defaults
的这两个校验分支目前没有被直接覆盖。
tests/unit/api/test_write_entry_scopes.py:148 的超时用例。
LLMServiceError。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head_sha:
ad6f30d4a7dafbfd3adef70e35b8918449c4fc101. I1:APIResponseValidationError 漏捕获
已补充 openai.APIError 兜底,统一转换为 LLMServiceError,返回 HTTP 502 和固定的响应异常提示。原始异常保留在异常链中,不向调用方暴露上游响应正文。已补充 OpenAI、DashScope 用例。
2. I2:确定性错误重试及单条重复抽取
已修复。鉴权、参数等确定性错误不再重试;连接故障、408/409/429、5xx 保留原有有限重试。单条 infer 写入遇到 LLMServiceError 时,与 LLMTimeoutError 一样直接返回原错误,不再触发重复抽取。多条输入的既有降级逻辑保持不变。
3. I3:retryable 统一为 false
已通过 LLMServiceError.retryable 统一分类,构建层与 HTTP 错误包复用同一规则。模型超时仍沿用现有“不重试”策略,避免叠加等待,相关规则已补充到 S07。
4. 模型错误误计入熔断
已修复。HTTP 明确返回模型领域错误时,清零服务连接失败计数,避免连续模型错误触发共享读写熔断。网络故障及其他服务错误仍沿用原有规则。已验证连续模型写入失败后,读取仍可正常执行。
5. 接口契约及跨实现测试不足
已补充 LLM.chat() 的服务错误转换契约,并增加 OpenAI、DashScope 的错误转换测试。
6. Embedding 错误未覆盖
本次修复范围限定为 LLM 错误处理,Embedding 错误归一暂不扩展,已在 F05 已知遗留中明确。
7. 日志诊断信息不足
本次保留安全错误分类和状态码日志,暂不直接记录上游响应正文。脱敏函数无法保证任意上游正文均不包含敏感业务信息,更细的诊断字段后续单独完善,已记录遗留。
8. 重启后依赖宿主重新注册默认值
已核实 Swarm 启动路径会在服务启动前重新调用 configuration.update_defaults(),满足恢复继承标记的前提。本次无需新增 Memory 侧启动逻辑。
9. 中英文错误文案混用
该项属于文案一致性问题,不影响配置校验和错误传播,本次暂不调整。
10. 测试缺口
已补齐不完整连接、锁定字段、响应校验异常、单条抽取不重复、HTTP 模型超时 504,以及同一连接同时编辑与恢复的冲突校验。