Keep shared MCP types stable in Code Mode exec descriptions (#50536)

## Why

Changing a deferred tool's output schema could add or remove the shared MCP type preamble from the `exec` description.

## What changed

Include the default or configured MCP TypeScript preamble whenever `code_mode_only` is enabled, regardless of the available tools' output schemas. Preserve an empty preamble override as a way to omit the section.

## Testing

Add a regression test that checks description stability when a deferred tool gains an MCP output schema, covering default, custom, and empty preambles. Update description expectations, request snapshots, and two Guardian context-budget test thresholds for the added preamble.

GitOrigin-RevId: 725035d6159e9da3c4beff5482c426c082e768b4
This commit is contained in:
Ahmed Ibrahim
2026-10-03 05:51:19 +00:00
committed by copyberry
parent 7d5f55bdad
commit e1b5b56a4f
22 changed files with 113 additions and 70 deletions
@@ -6,8 +6,8 @@ Scenario: Guardian follow-up review request layout
## Window 1
-- request 1 (request; Initial Guardian Review Request) --
00:additional_tools/developer (1; hash=ae2f2f1f9dcd0cd9):
- namespace/functions; hash=fd8638eaf7cabb95
00:additional_tools/developer (1; hash=a8891bdc414756a2):
- namespace/functions; hash=af55b81b2cec6cc2
- custom/exec
- function/wait
01:message/developer:
@@ -6,8 +6,8 @@ Scenario: Guardian review request layout
## Window 1
-- request 1 (request; Guardian Review Request) --
00:additional_tools/developer (1; hash=ae2f2f1f9dcd0cd9):
- namespace/functions; hash=fd8638eaf7cabb95
00:additional_tools/developer (1; hash=a8891bdc414756a2):
- namespace/functions; hash=af55b81b2cec6cc2
- custom/exec
- function/wait
01:message/developer: