Skip to content

Commit 3a55f8d

Browse files
authored
refactor(agents): remove dead test surfaces (#107113)
1 parent be5558c commit 3a55f8d

14 files changed

Lines changed: 43 additions & 303 deletions

‎scripts/deadcode-exports.baseline.mjs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
496496
"src/acp/control-plane/active-turns.ts: resetAcpActiveTurnsForTests",
497497
"src/acp/runtime/registry.ts: AcpRuntimeBackend",
498498
"src/agents/agent-bundle-lsp-runtime.ts: spawnLspServerProcess",
499-
"src/agents/agent-bundle-mcp-tools.ts: __testing",
500-
"src/agents/agent-bundle-mcp-tools.ts: testing",
501499
"src/agents/agent-hooks/compaction-instructions.ts: DEFAULT_COMPACTION_INSTRUCTIONS",
502500
"src/agents/agent-hooks/compaction-safeguard.ts: testing",
503501
"src/agents/agent-hooks/context-pruning.ts: computeEffectiveSettings",
@@ -509,8 +507,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
509507
"src/agents/agent-steering-queue.ts: listPendingAgentSteeringItemsFromSubagentRuns",
510508
"src/agents/agent-tools.before-tool-call.ts: BeforeToolCallBlockedError",
511509
"src/agents/agent-tools.before-tool-call.ts: testing",
512-
"src/agents/agent-tools.params.ts: normalizeHallucinatedOfficePathExtension",
513-
"src/agents/agent-tools.params.ts: stripMalformedXmlArgValueSuffix",
514510
"src/agents/agent-tools.read.ts: REQUIRED_PARAM_GROUPS",
515511
"src/agents/agent-tools.read.ts: resolveToolPathAgainstWorkspaceRoot",
516512
"src/agents/apply-patch.ts: applyPatch",
@@ -602,7 +598,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
602598
"src/agents/embedded-agent-runner/thinking.ts: OMITTED_ASSISTANT_REASONING_TEXT",
603599
"src/agents/embedded-agent-runner/tool-call-argument-decoding.ts: decodeHtmlEntitiesInObject",
604600
"src/agents/embedded-agent-runner/tool-result-truncation.ts: calculateMaxToolResultChars",
605-
"src/agents/embedded-agent-runner/tool-result-truncation.ts: createToolResultPromptProjectionState",
606601
"src/agents/embedded-agent-runner/tool-result-truncation.ts: getToolResultTextLength",
607602
"src/agents/embedded-agent-runner/tool-result-truncation.ts: truncateOversizedToolResultsInRuntimeTranscript",
608603
"src/agents/embedded-agent-runner/tool-result-truncation.ts: truncateOversizedToolResultsInSession",
@@ -643,7 +638,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
643638
"src/agents/models-config.ts: writeModelsFileAtomicForModelsJson",
644639
"src/agents/modes/interactive/theme/theme.ts: setTheme",
645640
"src/agents/openai-completions-compat.ts: resolveOpenAICompletionsCompatDefaults",
646-
"src/agents/openai-transport-stream.ts: __testing",
647641
"src/agents/openai-transport-stream.ts: testing",
648642
"src/agents/plugin-model-catalog.ts: PLUGIN_MODEL_CATALOG_FILE",
649643
"src/agents/provider-attribution.ts: listProviderAttributionPolicies",
@@ -694,7 +688,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
694688
"src/agents/subagent-registry.ts: testing",
695689
"src/agents/subagent-spawn.ts: testing",
696690
"src/agents/system-prompt-config.ts: resolveAgentSystemPromptConfig",
697-
"src/agents/tool-call-id.ts: isValidCloudCodeAssistToolId",
698691
"src/agents/tool-call-id.ts: sanitizeToolCallId",
699692
"src/agents/tool-loop-detection.ts: CRITICAL_THRESHOLD",
700693
"src/agents/tool-loop-detection.ts: GLOBAL_CIRCUIT_BREAKER_THRESHOLD",

‎src/agents/agent-bundle-mcp-runtime.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import {
1111
completeDeferredSessionMcpRuntimeRetirement,
1212
createBundleMcpJsonSchemaValidator,
1313
createSessionMcpRuntime,
14+
testing,
1415
} from "./agent-bundle-mcp-runtime.js";
15-
import { cleanupBundleMcpHarness } from "./agent-bundle-mcp-test-harness.js";
1616
import {
1717
getOrCreateSessionMcpRuntime,
1818
materializeBundleMcpToolsForRun,
1919
retireSessionMcpRuntime,
2020
retireSessionMcpRuntimeForSessionKey,
21-
testing,
2221
} from "./agent-bundle-mcp-tools.js";
2322
import type { SessionMcpRuntime } from "./agent-bundle-mcp-types.js";
2423
import { writeExecutable } from "./bundle-mcp-shared.test-harness.js";
@@ -371,7 +370,7 @@ function makeRuntime(
371370

372371
afterEach(async () => {
373372
cleanupTempDirs(tempDirs);
374-
await cleanupBundleMcpHarness();
373+
await testing.resetSessionMcpRuntimeManager();
375374
});
376375

377376
describe("session MCP runtime", () => {

‎src/agents/agent-bundle-mcp-test-harness.ts‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎src/agents/agent-bundle-mcp-tools.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/** Public facade for bundle MCP tool materialization and session-scoped runtime management. */
22
export type { McpToolCatalogDiagnostic } from "./agent-bundle-mcp-types.js";
33
export {
4-
testing,
5-
testing as __testing,
64
disposeAllSessionMcpRuntimes,
75
getOrCreateSessionMcpRuntime,
86
peekSessionMcpRuntime,

‎src/agents/agent-tools.params.test.ts‎

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {
88
REQUIRED_PARAM_GROUPS,
99
getToolParamsRecord,
1010
normalizeFileToolPathParam,
11-
normalizeHallucinatedOfficePathExtension,
12-
stripMalformedXmlArgValueSuffix,
1311
wrapToolParamValidation,
1412
} from "./agent-tools.params.js";
1513

@@ -20,28 +18,18 @@ describe("assertRequiredParams", () => {
2018
});
2119

2220
it("strips only the malformed terminal XML arg-value suffix", () => {
23-
expect(stripMalformedXmlArgValueSuffix("echo test</arg_value>>")).toBe("echo test");
24-
expect(stripMalformedXmlArgValueSuffix("echo test</arg_value>>>>>")).toBe("echo test");
25-
expect(stripMalformedXmlArgValueSuffix("echo test</arg_value>")).toBe("echo test</arg_value>");
26-
expect(stripMalformedXmlArgValueSuffix("echo </arg_value>> test")).toBe(
27-
"echo </arg_value>> test",
28-
);
21+
expect(normalizeFileToolPathParam("echo test</arg_value>>")).toBe("echo test");
22+
expect(normalizeFileToolPathParam("echo test</arg_value>>>>>")).toBe("echo test");
23+
expect(normalizeFileToolPathParam("echo test</arg_value>")).toBe("echo test</arg_value>");
24+
expect(normalizeFileToolPathParam("echo </arg_value>> test")).toBe("echo </arg_value>> test");
2925
});
3026

3127
it("normalizes known hallucinated Office/codex path extensions", () => {
32-
expect(normalizeHallucinatedOfficePathExtension("reports/final.docodex")).toBe(
33-
"reports/final.docx",
34-
);
35-
expect(normalizeHallucinatedOfficePathExtension("slides/plan.pptxodex")).toBe(
36-
"slides/plan.pptx",
37-
);
38-
expect(normalizeHallucinatedOfficePathExtension("sheets/budget.XLSCODEX")).toBe(
39-
"sheets/budget.xlsx",
40-
);
41-
expect(normalizeHallucinatedOfficePathExtension("notes/codex-report.txt")).toBe(
42-
"notes/codex-report.txt",
43-
);
44-
expect(normalizeHallucinatedOfficePathExtension("archive.docodex/notes.txt")).toBe(
28+
expect(normalizeFileToolPathParam("reports/final.docodex")).toBe("reports/final.docx");
29+
expect(normalizeFileToolPathParam("slides/plan.pptxodex")).toBe("slides/plan.pptx");
30+
expect(normalizeFileToolPathParam("sheets/budget.XLSCODEX")).toBe("sheets/budget.xlsx");
31+
expect(normalizeFileToolPathParam("notes/codex-report.txt")).toBe("notes/codex-report.txt");
32+
expect(normalizeFileToolPathParam("archive.docodex/notes.txt")).toBe(
4533
"archive.docodex/notes.txt",
4634
);
4735
});

‎src/agents/agent-tools.params.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ export function getToolParamsRecord(params: unknown): Record<string, unknown> |
112112
}
113113

114114
/** Strip extra closing markers sometimes produced in XML arg_value path params. */
115-
export function stripMalformedXmlArgValueSuffix(value: string): string {
115+
function stripMalformedXmlArgValueSuffix(value: string): string {
116116
return value.includes("</arg_value>") ? value.replace(XML_ARG_VALUE_SUFFIX_RE, "") : value;
117117
}
118118

119119
/** Normalize known model-hallucinated Office/codex path extensions. */
120-
export function normalizeHallucinatedOfficePathExtension(value: string): string {
120+
function normalizeHallucinatedOfficePathExtension(value: string): string {
121121
return value.replace(HALLUCINATED_OFFICE_PATH_EXTENSION_RE, (_match, family: string) => {
122122
return OFFICE_EXTENSION_BY_FAMILY[family.toLowerCase()] ?? _match;
123123
});

‎src/agents/bundle-mcp.test-harness.ts‎

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)