feat(openclaw-plugin):context engine refactor design & enforce token budget and reduce context bloat#891
Merged
chenjw merged 4 commits intovolcengine:mainfrom Mar 23, 2026
Conversation
…olcengine#730) (volcengine#796) * test(openclaw-plugin): add vitest test infrastructure for volcengine#730 * fix(openclaw-plugin): raise recallScoreThreshold default from 0.01 to 0.15 (volcengine#730) * fix(openclaw-plugin): narrow isLeafLikeMemory boost to level-2 only (volcengine#730) * fix(openclaw-plugin): prefer abstract over full content fetch in memory injection (volcengine#730) * feat(openclaw-plugin): add recallMaxContentChars and recallPreferAbstract config (volcengine#730) * feat(openclaw-plugin): enforce tokenBudget in injection with decrement loop (volcengine#730) * fix(openclaw-plugin): update recallScoreThreshold placeholder to match new default (volcengine#730) * fix(openclaw-plugin): deduplicate content resolution and document budget behavior (volcengine#730) Extract resolveMemoryContent() helper to eliminate duplicate content-resolution logic between buildMemoryLines and buildMemoryLinesWithBudget. Add JSDoc and inline comment documenting intentional first-line budget overshoot (spec §6.2). Tighten test assertion from <=120 to <=106 tokens. * fix(openclaw-plugin): use truthy fallback for empty abstract strings (volcengine#730) Change nullish coalescing (??) to truthy fallback (||) in resolveMemoryContent() so empty-string abstracts fall back to item.uri instead of producing empty content lines.
Co-authored-by: Mijamind <mijamind@163.com> Co-authored-by: GPT-5.4 <noreply@openai.com>
|
Failed to generate code suggestions for PR |
chenjw
reviewed
Mar 23, 2026
| - 调用 `session.commit(wait=false)` 提交 OpenViking session | ||
| - 异步:commit 在后台执行,afterTurn 立即返回,更新 session中 CompactState, 下一轮 Compact状态检查 中确认完成 | ||
|
|
||
| 兜底 flush:进程退出时(service.stop() / SIGTERM / SIGINT),遍历所有 buffer 执行 commitAndReset,确保未提交的累积内容不丢失 |
Collaborator
There was a problem hiding this comment.
依赖在退出时的commit,感觉不太容易做到, 建议在正常上传记忆和commit的时候就需要确保这种异常后的恢复工作。 这样在异常退出后就无需做了。
chenjw
approved these changes
Mar 23, 2026
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.
Description
fix(openclaw-plugin): enforce token budget and reduce context bloat
Extract resolveMemoryContent() helper to eliminate duplicate content-resolution
logic between buildMemoryLines and buildMemoryLinesWithBudget. Add JSDoc and
inline comment documenting intentional first-line budget overshoot (spec §6.2).
Tighten test assertion from <=120 to <=106 tokens.
Change nullish coalescing (??) to truthy fallback (||) in
resolveMemoryContent() so empty-string abstracts fall back to item.uri
instead of producing empty content lines.
Related Issue
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes