Skip to content

Release: hard-prune post-compression tool context (#5667) - #5852

Merged
nesquena-hermes merged 1 commit into
masterfrom
gate/5667-2027
Jul 9, 2026
Merged

nesquena-hermes merged 1 commit into
masterfrom
gate/5667-2027

Conversation

@nesquena-hermes

Copy link
Copy Markdown
Collaborator

Ships #5667 (@franksong2702) — hard-prune post-compression tool context (#4685).

What

After a compression event, the protected-tail tool-result payloads in the model context are hard-capped to a token budget (applied once, post-compression only), preventing context blowup.

Gate (deep-review re-gate on live head 1350182)

  • Byte-identical to PR head. Codex advisor: SAFE TO SHIP, reproduced:
    • Pairing-safe: replaces tool content on a deep copy only, never removes/reorders → every tool_call↔tool_result ID preserved through prune + API sanitization.
    • Model-context-only: assigns s.context_messages; s.messages (visible transcript) retains full tool output (shared-object probe).
    • Post-compression-gated, idempotent, restart-persistent, filtered from display merges.
  • Tests: 65 own + 992 regression (compress/context/prune/tool_result/streaming) green.

Closes #5667.

WebUI hard token-cap on protected-tail tool-result payloads in the MODEL CONTEXT
only, applied once after a confirmed compression event, to prevent post-compression
context blowup. Deep-copy content-replace only (no message removal/reorder → no
orphaned tool_result); visible transcript (s.messages) untouched.

Deep-review re-gate: Codex SAFE (pairing-safety + context-only + idempotent verified
by reproduction), 65 own + 992 regression tests green. Crown-jewel streaming path.

Co-authored-by: franksong2702 <franksong2702@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a post-compression cap for tool-result payloads in model context. The main changes are:

  • New hard-prune helpers for compressed context tool outputs.
  • Post-compression pruning that updates context_messages without touching the visible transcript.
  • Display-merge filters for generated tool-result summaries.
  • Tests for pruning, idempotency, API sanitization, and display separation.
  • A release changelog entry for the behavior change.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The pruning path is gated to confirmed compression events.
  • The visible transcript remains separate from the pruned model context.
  • The private summary flag is removed before provider payloads are built.

Important Files Changed

Filename Overview
api/streaming.py Adds model-context-only hard pruning after compression and filters generated summaries out of display merges.
tests/test_auto_compression_card.py Adds focused tests for pruning behavior, idempotency, private flag handling, and transcript preservation.
CHANGELOG.md Adds the release note for the compressed-context tool-result cap.

Reviews (1): Last reviewed commit: "Release: hard-prune post-compression too..." | Re-trigger Greptile

@nesquena-hermes
nesquena-hermes merged commit f449ff2 into master Jul 9, 2026
18 checks passed
@nesquena-hermes
nesquena-hermes deleted the gate/5667-2027 branch July 9, 2026 20:41
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.

1 participant