Commit 515b590
fix(mcp): reversible truncation for text tools + bounded expand_query floor
Address truncation-audit findings so every markdown-default response stays
bounded and recoverable:
- S4: tracedecay_files and tracedecay_type_hierarchy no longer clip oversized
output irreversibly. New render::truncate_text_with_handle stores the full
body and returns the markdown truncation envelope with an rh_ handle
(delegates to truncated_markdown_with_handle; no duplicated logic).
- S3: lcm_expand_query_tool_json's format:"json"+needs_synthesis path could
emit an unbounded payload when even the Minimal compaction tier overflowed.
New bounded_lcm_expand_query_floor_text enforces a floor: stores a retrieval
handle (surfaced as response_handle for the Hermes bridge) and keeps the
contract keys (status, needs_synthesis, bounded answer/prompt, rebuilt
synthesis_prompt) while zeroing unbounded arrays with *_truncated markers.
- S5: LCM preflight/expand_query compaction tiers now call
observe_response_truncation so those truncations show up in metrics.
- Drop unused LCM_GREP_SNIPPET_CHARS (lcm_grep hits are already bounded).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent a538d28 commit 515b590
3 files changed
Lines changed: 373 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| |||
1535 | 1535 | | |
1536 | 1536 | | |
1537 | 1537 | | |
1538 | | - | |
| 1538 | + | |
1539 | 1539 | | |
1540 | 1540 | | |
1541 | 1541 | | |
| |||
0 commit comments