Skip to content

fix(tool): harden result envelope contract - #26

Merged
ForeverAngry merged 1 commit into
mainfrom
fix/tool-result-envelope-contract
May 28, 2026
Merged

fix(tool): harden result envelope contract#26
ForeverAngry merged 1 commit into
mainfrom
fix/tool-result-envelope-contract

Conversation

@ForeverAngry

@ForeverAngry ForeverAngry commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

Close the ToolResultEnvelope contract gaps from #8 before downstream caches and trace consumers depend on the shape.

This adds three pieces to the model-visible envelope boundary:

  • redaction policies over JSON Pointer deny/allow lists, applied before truncation or total-size bounding
  • path-aware omitted segments with opaque, decodable continuation tokens
  • a total serialized-byte budget so large objects with many small fields are bounded, not just per-string/per-array clamped

The raw dispatch path remains unchanged. Bounded helpers still opt in at the model-visible boundary.

Public API

  • ToolResultEnvelopeConfig::with_max_total_bytes
  • ToolResultEnvelopeConfig::with_redaction_policy
  • RedactionPolicy / RedactionRule
  • OmittedSegment
  • ToolResultOmissionReason
  • ToolResultPageToken
  • decode_tool_result_page_token

Existing serialized envelopes remain readable because new envelope fields are serde-defaulted where needed.

Validation

  • cargo test --test result_envelope --all-features
  • just check

Closes #8

Copilot AI review requested due to automatic review settings May 28, 2026 22:37
@ForeverAngry
ForeverAngry force-pushed the fix/tool-result-envelope-contract branch from dab4dfc to 5cc52de Compare May 28, 2026 22:39
@ForeverAngry
ForeverAngry merged commit 16a821d into main May 28, 2026
14 checks passed
@ForeverAngry
ForeverAngry deleted the fix/tool-result-envelope-contract branch May 28, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions github-actions Bot mentioned this pull request May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolResultEnvelope follow-ups: redaction policy, unique page_token, total-size bound

3 participants