fix:修复graph-memory部分全量用例 - #98
Open
openjiuwen-sync-bot[bot] wants to merge 2 commits into
Open
Conversation
|
|
|
head_sha:
|
|
head_sha:
|
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.
Paired: GitHub #98 ↔ GitCode !228
冒烟测试:

问题背景
此前多个 Java 测试仅保留了 Python 用例数据,但以
SDKGap为由跳过。逐项对照 Python 实现和测试后发现,问题分为两类:具体差异包括:
IllegalArgumentException,Python 抛出带标准错误码的BaseError。debug=true时,Java 没有记录 GraphMemory LLM 调用的模板、prompt 和响应。Human实体的summary_target翻倍,Java 未实现该行为。解决方案
1. 补齐本地确定性测试夹具
在
GraphMemoryCaseSupport中加入本地可执行的:addMemory + search执行链路测试不依赖真实 LLM、Embedding、Milvus 或阿里云 Reranker,不产生外部网络请求,但仍通过公开 API 执行真实 GraphMemory 主流程。
2. 修复 core 运行时契约
重复注册同名策略且
force=false时,改为抛出:BaseError(StatusCode.MEMORY_STORE_VALIDATION_INVALID)debug=true时,按 Python 行为记录:日志在释放 LLM semaphore 后输出,避免延长并发许可占用时间。
构造实体摘要 prompt 时:
summary_targetHuman实体使用summary_target * 23. 恢复 Python 测试意图
解除以下用例的
@Disabled:TestGraphMemory002TestGraphMemory003TestGraphMemory004TestGraphMemory005TestGraphMemory008TestGraphMemory010TestGraphMemory012TestGraphMemory014TestGraphMemory015覆盖的 Python 契约包括:
content_fmt_kwargs角色格式化attachEmbedderreference_timeAddMemStrategy的 recall、summary 和 merge 配置force=true覆盖同名策略force=false重复策略错误014 的 Episode 预期同步为 Python 原用例中的两条包含断言。
015 对 Python 测试进行了等价加强:明确要求重复注册必须抛出异常,避免“没有抛异常也能继续通过”的测试漏洞。
变更范围
agent-core-java
GraphMemory.javaExtractionPrompts.javasummary_target翻倍GraphMemoryBaseTest.javaGraphExtractionTest.javajiuwen-test
GraphMemoryCaseSupport.java@Disabled验证结果
agent-core-java
mvn -q -Dtest=GraphMemoryBaseTest,GraphExtractionTest test结果:11 个测试通过,0 失败,0 跳过。
jiuwen-test
结果:
当前仅保留以下未修复用例的跳过状态:
TestGraphMemory011:真实 rerank 搜索契约TestGraphMemory013:query_embedding + reference_time搜索契约