fix(offload): resolve session manager in assemble() without sessionKey (#878) - #882
Open
dailylights wants to merge 5 commits into
Open
fix(offload): resolve session manager in assemble() without sessionKey (#878)#882dailylights wants to merge 5 commits into
dailylights wants to merge 5 commits into
Conversation
dailylights
force-pushed
the
fix/assemble-sessionkey-fallback
branch
2 times, most recently
from
August 9, 2026 06:10
47587d1 to
2a92401
Compare
…ompact All three context-engine API methods can receive calls without a sessionKey from the OpenClaw framework. When missing, the fallback chain is: sessionKey -> sessionTarget?.sessionKey -> sessionId -> key. - assemble(): already had the fix, now also includes sessionTarget?.sessionKey - afterTurn(): added fallback for when _offloadManager is not cached - compact(): added fallback matching PR TencentCloud#863 This unblocks the entire L1.5/MMD/L2/L3 pipeline and context compaction which depend on stateManager being resolved. Fixes TencentCloud#878, unblocks TencentCloud#880
dailylights
force-pushed
the
fix/assemble-sessionkey-fallback
branch
from
August 9, 2026 06:12
2a92401 to
8adb0ae
Compare
Collaborator
|
Thanks for your contribution and attention! We will review this PR and get back to you as soon as possible. |
Author
测试已添加新增了 assemble() 测试(7 个)
afterTurn() 测试(7 个)
compact() 测试(4 个)
运行方式: |
Author
更新:afterTurn 优化根据评估反馈, 的 session 解析已从两次 resolve 合并为一次统一的回退路径,去除了冗余代码。同时添加了 缓存。 变更: (+21/-7) → afterTurn 逻辑更简洁高效 |
Author
质量提升完成代码改进
测试覆盖(26 用例 / 345 行)
对比 YOMXXX #893
|
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.
Fixes #878
What Problem This Solves
assemble()is called on everyafterTurnbut always skips withno stateManager (sessionKey=none), because OpenClaw's framework does not pass asessionKeyto the context-engine API. This causes a cascading failure: context compaction, MMD injection, L1.5/L2/L3 all never run, and the context window grows unbounded (474k tokens, 107.6% heap).The Fix
Apply the sessionKey fallback chain (
sessionKey → sessionTarget?.sessionKey → sessionId → key) to all three context-engine API methods:assemble()— the primary fix; unblocks the entire pipelineafterTurn()— added fallback for when_offloadManageris not cachedcompact()— added fallback matching PR fix(offload): resolve session manager from sessionId when sessionKey is missing in compact() #863 (which targetsfeat/server_team; this applies the same fix tomain)Also added
!isInternalMemorySession()guard to skip internal memory sessions.Impact
This is a blocking dependency for #880 (L1.5/MMD/L2/L3 never run in OpenClaw plugin mode). Without a resolved stateManager:
Evidence
assemble SKIP: no stateManager (sessionKey=none)on every afterTurn