Skip to content

Feature request: safe tool-payload truncation helper preserving pairing invariants #4379

@drukpa1455

Description

@drukpa1455

Summary

Add a utility/helper for safe tool payload truncation/redaction that preserves tool call/return pairing invariants.

Motivation

When users compact history manually, they often clear large tool args/results. Doing this incorrectly can break tool call/return pairing and cause model/provider errors. A canonical helper would reduce footguns.

Proposal (additive)

  • Provide helper(s) that can truncate/redact tool payloads while preserving structural invariants.
  • Keep scope focused on message transformation correctness (not policy).
  • Include invariant tests for paired tool-call/tool-return behavior.

Relation to #4137

This is useful with or without first-class compaction; it can serve as a building block for custom processors and future framework compaction strategies.

Offer

Happy to implement a minimal version with tests, pending maintainer guidance on module placement and naming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions