Skip to content

fix(offload): recover after-tool-call messages#184

Open
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:fix/after-tool-call-message-fallback
Open

fix(offload): recover after-tool-call messages#184
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:fix/after-tool-call-message-fallback

Conversation

@RerankerGuo

Copy link
Copy Markdown

Description | 描述

Make the after_tool_call hook recover the conversation message array from compatible hook context locations when event.messages is missing or empty. The handler now tries ctx.messages, ctx.historyMessages, ctx.params.session.messages, ctx.params.messages, and event.historyMessages, then backfills event.messages so existing MMD injection and L3 compression logic can continue through the same path.

This keeps the existing OpenClaw patch path working while making the hook more tolerant of runtime event shape changes.

Related Issue | 关联 Issue

Fix #118

Change Type | 修改类型

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

Self-test Checklist | 自测清单

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

Additional Notes | 其他说明

Verified with npx vitest run src/offload/hooks/after-tool-call.test.ts, npm test, and npm run build using Node v24.15.0.

Signed-off-by: Ziyang Guo <121015044+RunMarshal@users.noreply.github.com>
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.

after_tool_call hook: event.messages undefined, L3 compression broken in OpenClaw 5.27

1 participant