Repository navigation
fix: retain file changes across conversation compaction - #123467
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 15, 2026
steipete
added a commit
that referenced
this pull request
Oct 15, 2026
* refactor(packages): consolidate protocol and stream ownership Use one tuple-preserving ordered literal-union constructor without changing Gateway protocol JSON, exported shapes, or static inference. Share Anthropic request, refusal, reducer, compaction and terminal ownership while preserving the SDK/fetch adapters and their error profiles. Reuse the existing abort race. Reuse prepared compaction details and table widths, trust typed internal file metadata inputs, and leave the Agent loop as the sole message-snapshot owner. Replace the primitive-only session-options deep clone with a shallow copy. Remove write-only transport scratch indices and duplicate outer cleanup; reuse prepared Markdown token projections. Route Completions context budgeting through the shared calibrated CJK estimator, correcting underestimated rare/halfwidth and supplementary input. Add request-budget regression cases. Best-effort tradeoffs accepted: - Malformed internal assistant/tool-name values violating AgentMessage can throw instead of being silently omitted. The guards came from extractions #85341/#123467, with no cited human malformed-message incident. External tool arguments and patch-result metadata remain validated. - An impossible table column/width mismatch no longer gets a custom error. The removed throw came from strict-index ratchet #104577, not an actual-use report; columns and widths still come from the same ordered allocation. No Phase E standalone session-memory backend, security authority, public protocol/config/SDK contract, schema, dependency or durability change. * test(plugins): make cancellation ownership fixture deterministic Hold the Anthropic fixture's second pull on its existing cleanup gate so the custom cancellation work is actually admitted before testing its ownership. An upstream fetch abort may otherwise error the wrapper before cancel runs, making the test demand settlement of work that was never accepted. Keep every origin-context, drainage, lifetime and reuse assertion unchanged. No production behavior, timeout, retry or skip changes.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 16, 2026
…aw#172991) * refactor(packages): consolidate protocol and stream ownership Use one tuple-preserving ordered literal-union constructor without changing Gateway protocol JSON, exported shapes, or static inference. Share Anthropic request, refusal, reducer, compaction and terminal ownership while preserving the SDK/fetch adapters and their error profiles. Reuse the existing abort race. Reuse prepared compaction details and table widths, trust typed internal file metadata inputs, and leave the Agent loop as the sole message-snapshot owner. Replace the primitive-only session-options deep clone with a shallow copy. Remove write-only transport scratch indices and duplicate outer cleanup; reuse prepared Markdown token projections. Route Completions context budgeting through the shared calibrated CJK estimator, correcting underestimated rare/halfwidth and supplementary input. Add request-budget regression cases. Best-effort tradeoffs accepted: - Malformed internal assistant/tool-name values violating AgentMessage can throw instead of being silently omitted. The guards came from extractions openclaw#85341/openclaw#123467, with no cited human malformed-message incident. External tool arguments and patch-result metadata remain validated. - An impossible table column/width mismatch no longer gets a custom error. The removed throw came from strict-index ratchet openclaw#104577, not an actual-use report; columns and widths still come from the same ordered allocation. No Phase E standalone session-memory backend, security authority, public protocol/config/SDK contract, schema, dependency or durability change. * test(plugins): make cancellation ownership fixture deterministic Hold the Anthropic fixture's second pull on its existing cleanup gate so the custom cancellation work is actually admitted before testing its ownership. An upstream fetch abort may otherwise error the wrapper before cancel runs, making the test demand settlement of work that was never accepted. Keep every origin-context, drainage, lifetime and reuse assertion unchanged. No production behavior, timeout, retry or skip changes.
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.
What Problem This Solves
Fixes an issue where file identities could disappear from compacted conversation history when coding tools used accepted path aliases, namespaced tool names, or
apply_patch. After compaction, the surviving<read-files>and<modified-files>blocks could therefore omit files the agent had actually read or changed.Why This Change Was Made
File-operation extraction now normalizes the open-ended namespace prefix, selects the first string path from
path,file_path, orfilePath, and consumes the structuredapply_patchresult summary instead of parsing patch text. Added files are recorded as writes, modified files as edits, and deleted files are intentionally omitted because they no longer exist for a continuation to inspect. Nearby accumulator and summary formatting logic was consolidated so production code shrinks by four lines.User Impact
Agents retain accurate read and modified file context across ordinary compaction, branch summaries, and repeated compactions, including MCP-projected tools and multi-file patches. Unknown tools remain ignored.
Evidence
node scripts/run-vitest.mjs packages/agent-core/src/harness/compaction/utils.test.tsfailed exactly the path-alias, namespaced-name, andapply_patchprovenance cases (3 failed, 14 passed).node scripts/run-vitest.mjs packages/agent-core/src/harness/compaction/utils.test.ts(17 passed).pnpm tsgopassed.pnpm tsgo:core:testpassed.