fix(harness): compact compose mutation results - #998
Closed
mfpiccolo wants to merge 4 commits into
Closed
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
skill-check — worker0 verified, 69 skipped (no docs/).
Four for four. Nicely done. |
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
Prevent large function results from unnecessarily inflating Harness transcripts and model context.
Harness previously serialized function results into model-visible
contentwhile also persisting the complete raw value in structureddetails. This duplicated successful responses in durable session history and increased context-assembly payload size, trace volume, and compaction pressure.This change introduces function-agnostic safeguards. It does not special-case Compose or rewrite another function’s contract.
Changes
Bound model-visible function results
All function results now have a hard model-visible text limit of 12,000 characters.
Oversized results end with an explicit marker:
The complete rendered result, including the marker, remains within the limit. This applies uniformly to every iii function.
Stop duplicating successful results
Raw function values remain available during execution for processing that needs them, including:
After that processing completes, successful results are persisted with
details: null.The model-visible
contentremains in the transcript, but the complete raw response is no longer stored beside it as a second copy.Bound failure metadata
Failed function results may require structured metadata for diagnostics.
Failure
detailsare retained when small. Oversized failure details are replaced with a bounded representation containing:truncated: trueModel-visible invocation error text is also subject to the general 12,000-character limit.
Cover deferred function completions
Deferred function results previously constructed transcript messages directly and bypassed the normal append path.
The same bounds and persistence policy now apply to:
Remove unnecessary details before context assembly
Before transcript messages are sent to the context manager, ordinary function-result
detailsare cleared from the model-facing copy.Permission-denial details remain available because provider adapters use that structured information to communicate denials.
Architectural scope
Harness remains function-agnostic.
This PR does not:
Functions remain responsible for returning appropriately designed response payloads. These Harness safeguards provide a general upper bound and prevent duplicate persistence when a function legitimately—or accidentally—returns a large result.
Any change to Compose’s native mutation response must be made where the Compose functions are implemented and registered.
Result
Before this change, a large successful response could be retained twice:
content.detailsvalue.After this change:
Validation
cargo test --manifest-path harness/Cargo.toml --libcargo clippy --manifest-path harness/Cargo.toml --all-targets -- -D warningscargo fmt --manifest-path harness/Cargo.tomlgit diff --checkRegression coverage includes: