fix(mcp): bold labels instead of ATX headings in tool results (#778) (#951)

MCP tool results used Markdown ATX headings (##/###/####) for section
headers — the status summary, each search hit, every file section in an
exploration — which Markdown-rendering clients (e.g. the Claude Code
VSCode extension) blow up to H1–H4 font size, filling the transcript with
oversized lines (worst on search/explore, where the noise scales with
result count). Swap them all for bold labels, which render at body size
while keeping the same structure. CLI/TTY output (ContextBuilder) is
unchanged — the issue notes it's fine.

The format is parse-coupled, so kept in sync:
- The explore truncation boundary and the offload chunker
  (reasoning/reasoner.ts) both key off the per-file header, now a unique
  `**`-prefixed marker emitted via a shared fileSectionHeader() helper.
- Updated the offload strip regexes and switched the opt-in report-style
  prompt off ATX headings (same client, same rendering issue).
- Updated test helpers (sectionFor, sourcedFiles, the callers
  section-boundary scan) that scanned the old markers.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-06-22 12:06:35 -05:00
committed by GitHub
co-authored by Claude Opus 4.8
parent ace8d8a0d0
commit 3e1547bbe1
15 changed files with 106 additions and 81 deletions
@@ -9,7 +9,7 @@
* "### Relationships" section would have caught it, but that is disabled below 500 files.
* Net: on a small RTK app the synthesized edge existed in the graph yet was invisible to
* the agent. The fix feeds a `dynNamed` set (named non-callable endpoints that participate
* in a heuristic edge) to the tier-independent "## Dynamic-dispatch links" scan. This test
* in a heuristic edge) to the tier-independent "**Dynamic-dispatch links**" scan. This test
* pins it on a deliberately tiny (<150-file) fixture so the Relationships gate is OFF and
* the dynamic-dispatch-links path is the ONLY thing that can surface the hop.
*/
@@ -77,7 +77,7 @@ export const outerThunk = createAsyncThunk('app/outer', async (n: number, { disp
// The synthesized hop now surfaces (was invisible: both endpoints `constant` AND the
// small-repo Relationships section is off).
expect(text).toContain('## Dynamic-dispatch links among your symbols');
expect(text).toContain('**Dynamic-dispatch links among your symbols');
expect(text).toMatch(/outerThunk\s+→\s+innerThunk/);
// It reads as a dynamic-dispatch bridge with its wiring site, not a bare `calls`.
expect(text).toMatch(/dynamic: redux thunk @/);