Quellcode durchsuchen

fix(explore): keep the drift warning out of the cuttable epilogue (CG-31)

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 <noreply@anthropic.com>
Colby McHenry vor 1 Monat
Ursprung
Commit
c54e0080c2
1 geänderte Dateien mit 13 neuen und 9 gelöschten Zeilen
  1. 13 9
      src/mcp/tools.ts

+ 13 - 9
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