fix(proxy): 修复 Hermes Bridge 会话识别与 Knowledge 注入 - #960
Open
Vocllum wants to merge 2 commits into
Open
Conversation
Collaborator
|
Thank you for your attention and contribution! We will schedule an internal review of this PR, and we will share any feedback right here. |
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.
改动说明
x-conversation-id时,兼容查找带hermes:前缀的 SessionStore 会话。start-proxy.sh生成的配置中补全注册KnowledgeToolsInjector所需的knowledge配置段。根因
Hermes 主请求会以
hermes:hermes-ops-test-001这类复合键保存 Session,但 Bridge 请求携带的是裸会话 IDhermes-ops-test-001。原有 Bridge 回退逻辑只尝试codebuddy:和claude-code:,没有尝试hermes:,因此 Session 已初始化时仍会返回 HTTP 401。官方部署配置虽然在
injection.injectors中启用了knowledge,但没有生成knowledge.enabled、knowledge.endpoint和knowledge.serviceToken。因此shouldRegisterKnowledgeInjector(config)始终为 false,knowledge-tools-injector不会注册。具体修改
sessionKeyCandidates(),保留精确键查找和已有前缀顺序,并补充hermes:候选键。knowledge配置,复用现有 Memory Core 地址和 Gateway Service Token。数据安全
本次修改不会重写、迁移、删除或重新分组任何记忆记录。Session 候选键只影响 Bridge 请求对 SessionStore 的查询;Knowledge Injector 只读取知识资产并生成工具说明,不会修改 L0/L1/L2 记忆数据。
验证结果
修复前,SessionStore 中已存在
hermes:hermes-ops-test-001时,两个 Bridge 使用裸 ID 请求均返回 HTTP 401。修复后,两个 Handler 都能恢复已初始化的 Session,向上游传递正确的 user/team/agent/task 身份并返回 HTTP 200。git diff --check origin/feat/server_team...HEAD通过。仓库级
npx tsc --noEmit仍会报告基线中已有的错误,涉及src/config.ts、Claude Code/CodeBuddy Session 初始化器以及可选依赖@context-proxy/cost-guard;本次修改没有引入新的类型错误。Fixes #957