Repository navigation
fix: compact tool results while preserving full execution evidence - #67
Merged
Merged
Conversation
Keep full tool artifacts for evidence and presentation while replaying compact tool-authored bodies to the model. Cover process and workspace outputs, persistence, compaction budgets, and checkpoint reads. Validation: cargo fmt --all --check; git diff --cached --check; 18 focused runtime, workspace-tool, and provider-boundary tests passed. Baseline commit before the requested result-contract and history-allocation refactor.
Always emit tool-authored process text instead of falling back to the full JSON envelope for non-UTF-8 captures. Preserve captured bytes in artifacts, label lossy text explicitly, and deduplicate recovery guidance. Unify tool result content ownership and constructor validation, borrow compaction history instead of cloning payloads, and share process output fields with TUI and debug-shell readers. Preserve historical artifact compatibility and keep malformed streams inspectable. Validation: cargo fmt --all --check; cargo clippy --all-targets --all-features -- -D warnings; cargo test --all; cargo build -p merry-cli; Python Ruff and ty; rebuilt native extension with test-utils; 78 Python tests; uv build; git diff --check.
Use exact-byte fixtures and cover LF/CRLF behavior. Validation: 84 tests passed on Python 3.10 and 3.14; Ruff, ty and packaging passed.
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.
Summary
Separate tool-authored model bodies from full display/evidence artifacts so repeated model requests do not replay redundant output envelopes.
Boundaries and compatibility
Validation
Completed on the submitted code before creating this PR:
Regression coverage includes binary stdout/stderr at multiple sizes, output truncation and exceptional statuses, duplicate guidance, byte-exact artifacts, save/resume and checkpoint readback, full permission-review evidence, atomic rejection of invalid results, and TUI legacy/malformed-output handling.