Skip to content

fix: include prepend context in gateway recall response#36

Open
lazyayuan wants to merge 1 commit into
Tencent:mainfrom
lazyayuan:fix/gateway-recall-prepend-context
Open

fix: include prepend context in gateway recall response#36
lazyayuan wants to merge 1 commit into
Tencent:mainfrom
lazyayuan:fix/gateway-recall-prepend-context

Conversation

@lazyayuan
Copy link
Copy Markdown

Description | 描述

Fix a Gateway/Hermes /recall compatibility issue where L1 recall content in prependContext could be dropped.

The core recall logic already returns L1 memories in prependContext, but the Gateway /recall response previously only exposed appendSystemContext through the legacy context field. As a result, custom Agent integrations or the Hermes provider calling Gateway /recall directly could not receive the L1 memories returned in prependContext.

This PR:

  • Adds prependContext and appendSystemContext to the Gateway /recall response.
  • Preserves backward compatibility by building the legacy context field from appendSystemContext + prependContext.
  • Updates Hermes prefetch() to prefer the split fields when present, and fall back to the legacy context field for old Gateway responses.
  • Adds TypeScript and Python regression tests covering both new and legacy /recall response behavior.

Related Issue | 关联 Issue

None

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Verified with:

  • npm test
  • npm run build:plugin
  • python -m pytest hermes-plugin/memory/memory_tencentdb/tests -q
  • git diff --check

Additional Notes | 其他说明

The legacy context field is preserved so existing clients can still read the full recall context. New clients can read appendSystemContext and prependContext separately.

Signed-off-by: 袁慎亨 <2219014054@qq.com>
@Maxwell-Code07
Copy link
Copy Markdown
Collaborator

Hi @lazyayuan,

We've received your PR regarding the missing prependContext in Gateway recall response. Thanks for catching this! We'll review and follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants