已关闭
ram-a-mem记忆摄入失败 #6
chuchengkai创建于  25 天前关闭于  13 天前
chuchengkai成员
25 天前 创建

【缺陷描述】:请补充详细的缺陷问题现象描述

ram-a-mem记忆摄入失败

一、缺陷信息

ram-a-mem记忆摄入失败

【缺陷所属的os版本】

cat /etc/os-release
NAME="openEuler"
VERSION="26.09 (DevStation)"
ID="openEuler"
VERSION_ID="26.09"
PRETTY_NAME="openEuler 26.09 (DevStation)"
ANSI_COLOR="0;31"

【内核版本】

6.6.0-163.0.0.1.oe2609.aarch64

【缺陷所属软件及版本号】

ram-a-mem-0.0.1-1.oe2609.aarch64

【环境信息】

openeuler 2609 虚拟机

【问题复现步骤】

ram-a-mem daemon启动后发送mcp请求进行记忆摄入
curl -sS http://127.0.0.1:18081/mcp -H 'Authorization: Bearer tmp' -H 'Mcp-Session-Id: dc414f0e-c5ca-4c90-8b2f-2bc9e6f0cc13' -H 'MCP-Protocol-Version: 2025-11-25' -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "memory_ingest",
"arguments": {
"conversation_id": "cli-test-1787815800",
"messages": [
{
"id": "msg-1787815800",
"role": "user",
"speaker": "test-user",
"text": "我计划从九月份开始系统学习 Rust。",
"timestamp": "2026-08-21T10:00:00+08:00",
"candidate": true
}
]
}
}
}'

【实际结果】

记忆摄入失败
data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{"code":"PIPELINE_FAILED","message":"memory pipeline failed","request_id":"c6da6842-db4c-404d-90d7-4f7abf40c1f0","retriable":true,"stage":"extract"}"}],"structuredContent":{"code":"PIPELINE_FAILED","message":"memory pipeline failed","request_id":"c6da6842-db4c-404d-90d7-4f7abf40c1f0","retriable":true,"stage":"extract"},"isError":true}}
id: 1/0

【期望结果】

记忆摄入成功

【其他相关附件信息】

【缺陷详情及分析指导参考链接】

开发确认主要是因为当前记忆管线使用模型(Qwen3:5-122B-Al0B、MiniMax-M2.7) 均为推理模型;API 返回时将实际回管放在 reasoning_content 字段:content 返回 null。 ram-a-mem 的 LLM 客户端只读取标准 OpenAI API 的 /choices/0/message/content 字段;检测到为空即判定提取失败; 报错 empty_content。
需要补充资料说明记忆管线使用模型的限制

likedislike
Cchuchengkai成员
25 天前 关联了里程碑:openEuler-26.09-DevStation-round2
openeuler-ci-botopeneuler-ci-bot成员
25 天前 添加了label:sig/sig-intelligence
openeuler-ci-bot
openeuler-ci-bot成员
25 天前 评论:

Welcome To openEuler Community

Hey @chuchengkai , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: sig-intelligence ,
and any of the maintainers: @fromhsc, @gogoxiaoxiao, @huzhengce, @kaitiandu, @leon-wang2021, @liumiao27, @lyhu, @wqianli ,
and any of the committers: @chantsztung, @jie-qi, @vanient9gap, @xiangyou_xie, @xtchen .

likedislike
DoraA_MengjieDoraA_Mengjie成员
18 天前 关联了pull request:feat: harden RAM-A-MEM validation and observability
DoraA_Mengjie
DoraA_Mengjie成员
18 天前 评论:

感谢反馈。该问题现象描述准确,当前失败点在 memory_ingest 的 Extract 阶段。

从现象看,服务端返回了 OpenAI-compatible Chat Completions 响应,但最终答案没有落在 choices[0].message.content,而是只返回在 reasoning_content 中,导致 ram-a-mem 客户端读取到空 content,进而报 empty_content / PIPELINE_FAILED(stage=extract)

当前 ram-a-mem 记忆摄入管线对抽取模型的兼容要求是:

  1. 接口需兼容 OpenAI Chat Completions 协议;
  2. 模型最终输出必须稳定返回到 choices[0].message.content
  3. Extract 阶段的 content 需要是可解析的结构化 JSON;
  4. reasoning_content 可存在,但不能作为最终业务输出使用;
  5. 如果模型只返回 reasoning_contentcontent 为空,当前版本会判定为模型响应不满足记忆抽取协议要求。

也就是说,ram-a-mem 并不是强制要求“非推理模型”,但要求推理模型最终必须返回标准 content。如果所用 Qwen3 / MiniMax 推理模型支持关闭 thinking/reasoning,建议在请求配置中显式关闭;如果服务端无法关闭推理,需保证 reasoning 与最终答案分离,并且最终 JSON 写入 message.content

后续修复方向已在 PR18 中补充:

  • 增加 reasoning_effort / enable_thinking 等模型兼容配置;
  • 增加 reasoning-only 响应识别;
  • 当只返回 reasoning_content、没有 content 时,可按配置进行一次有界纠正重试;
  • 增加模型兼容性说明文档,明确 contentreasoning_content 的边界;
  • ARM64 镜像验证中已覆盖 GLM Coding Plan 场景,完整 memory_ingest -> memory_search 已通过。

关联修复 PR:!18
关联问题:#6

在 PR 合入前,临时规避建议:

  • 优先使用稳定返回 choices[0].message.content 的非推理/低推理模型;
  • 或在 Provider 配置中关闭 thinking/reasoning;
  • 或调大 Extract 输出预算,避免模型在短 max_tokens 下只生成 reasoning 而没有最终 content;
  • 如果当前模型服务始终只返回 reasoning_content,则该服务暂不满足 ram-a-mem 记忆抽取协议要求。
likedislike
DoraA_Mengjie
DoraA_Mengjie成员
18 天前 评论:

PR18 合入后,可以通过配置模型兼容参数来适配这类推理模型响应。

示例配置:

{
  "providers": {
    "reasoning_effort": "none",
    "enable_thinking": null,
    "send_temperature": true,
    "temperature": 0.0,
    "output_token_parameter": "max_tokens",
    "structured_output": "prompt_only",
    "reasoning_only_retry": true,
    "json_repair_attempts": 1
  },
  "pipeline": {
    "extractor_max_output_tokens": 1600,
    "verifier_max_output_tokens": 1000,
    "reasoning_reserve_tokens": 0
  }
}
说明:
- 如果模型服务支持 reasoning_effort,建议配置 "reasoning_effort": "none"。
- 如果模型服务支持 enable_thinking,则可改用 "enable_thinking": false,但不要和 reasoning_effort 同时配置。
- 如果服务不接受 temperature,可配置 "send_temperature": false。
- 如果服务使用 Responses/新版 token 参数,可将 "output_token_parameter" 改成 "max_completion_tokens"。
- 如果服务不确定是否支持结构化输出,先使用 "structured_output": "prompt_only"。
- reasoning_only_retry: true 表示当模型只返回 reasoning_content、content 为空时,RAM-A 会自动做一次纠正重试,要求模型返回最终 content。
- extractor_max_output_tokens / verifier_max_output_tokens 是输出 token 上限,不是输入长度,也不是字符数。
模型侧仍需满足一个关键条件:
memory_ingest 最终可解析的 JSON 必须返回到 choices[0].message.content。reasoning_content 可以存在,但 RAM-A 不会把它当作记忆结果解析。
如果使用 Qwen3 / MiniMax 这类推理模型,建议优先确认服务端是否支持关闭 thinking/reasoning;如果支持,就显式关闭。如果无法关闭,则至少要保证最终 JSON 会进入 content,否则即使 PR18 合入,也只能触发一次纠正重试,不能保证一定成功。
likedislike
DoraA_Mengjie
DoraA_Mengjie成员
18 天前 评论:

补充说明:
修改前使用 GLM Coding Plan 跑通过,是因为当时实际 memory_ingest 的 Extract/Ground 请求最终拿到了非空 choices[0].message.content,其中包含 RAM-A 需要解析的 JSON。因此旧版本虽然不会读取 reasoning_content,但仍然可以摄入成功。

失败场景主要出现在推理模型只返回 reasoning_contentcontent 为空时。修改前 RAM-A 无法区分这是 reasoning-only 响应还是普通 empty content,会直接在 Extract/Ground 阶段失败。

likedislike
openeuler-ci-botopeneuler-ci-bot成员
13 天前 关闭了 issue
openeuler-ci-botopeneuler-ci-bot成员
13 天前 issue状态由 待办的 改变为 已完成