From c54e0080c20b29794c3111198de9e55369918a78 Mon Sep 17 00:00:00 2001 From: Colby McHenry Date: Thu, 6 Aug 2026 03:15:06 -0500 Subject: [PATCH] fix(explore): keep the drift warning out of the cuttable epilogue (CG-31) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The '⚠ changed on disk after the last index sync' banner is an honesty claim about source we DID render — line refs elsewhere in the response may be shifted — not a note about the response. Drawing the epilogue boundary after it means the size cut can never be what silences it. Suite numbers unchanged. Co-Authored-By: Claude Opus 5 --- src/mcp/tools.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mcp/tools.ts b/src/mcp/tools.ts index 1c499a3..c57ae0f 100644 --- a/src/mcp/tools.ts +++ b/src/mcp/tools.ts @@ -5187,15 +5187,6 @@ export class ToolHandler { } } - // Everything pushed from here on is EPILOGUE — meta-text about the response - // rather than the response. Marked so the hard-ceiling cut at the end can - // spend it before it spends a rendered file section (CG-31): a section is - // source the agent otherwise has to Read, the epilogue is a pointer list and - // two reminders. Lines already in `lines` are only MUTATED below (the - // verbatim header, the summary sentinel), never re-ordered, so the index - // stays valid. - const epilogueStart = lines.length; - // The back-reference convention, stated once where the verbatim guarantee is // (#1474 does the same for drift). Without it a pointer reads as an // apology for missing source rather than as an index into source the agent @@ -5220,6 +5211,19 @@ export class ToolHandler { ); } + // Everything pushed from here on is EPILOGUE — meta-text ABOUT the response + // rather than part of it. Marked so the hard-ceiling cut at the end can + // spend it before it spends a rendered file section (CG-31): a section is + // source the agent otherwise has to Read; the epilogue is a pointer list and + // two reminders, and the note that replaces it carries their instruction. + // + // Drawn AFTER the drift warning on purpose — that one is an honesty claim + // about source we did render, not a note about the response, so it is never + // the thing we drop. Lines already in `lines` are only MUTATED from here on + // (the verbatim header, the summary sentinel), never re-ordered, so the + // index stays valid. + const epilogueStart = lines.length; + // The curated header count is computed from the files that SURVIVE the final // truncation (see end of method) — `filesIncluded` can over-count when the // hard ceiling drops trailing sections — so leave a sentinel here and fill it