Skip to content

Commit f095549

Browse files
authored
perf(agents): cut CLI runner reliability import cost (#109772)
1 parent f69cb2f commit f095549

4 files changed

Lines changed: 11 additions & 17 deletions

File tree

‎scripts/lib/ci-node-test-plan.mjs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ const COMPACT_GROUP_SECONDS_HINTS = new Map([
4545
["agentic-agents-core-auth", 23],
4646
["agentic-agents-core-isolated", 8],
4747
["agentic-agents-core-models", 60],
48-
// cli-runner.reliability.test.ts imports a ~245s module graph on its own
49-
// (79 tests in <2s, import dominates); one file cannot be split further, so
50-
// its stripe is a near-solo bin and the sibling stripes stay tiny.
51-
["agentic-agents-core-runner-cli-1", 245],
52-
["agentic-agents-core-runner-cli-2", 18],
53-
["agentic-agents-core-runner-cli-3", 8],
48+
// Reliability's runtime-free provider check dropped its wall time from
49+
// ~245s to ~5s. LPT now puts spawn in stripe 1 and balances the small files
50+
// across the remaining stripes.
51+
["agentic-agents-core-runner-cli-1", 18],
52+
["agentic-agents-core-runner-cli-2", 11],
53+
["agentic-agents-core-runner-cli-3", 12],
5454
["agentic-agents-core-runner-commands", 25],
5555
["agentic-agents-core-runner-embedded", 9],
5656
["agentic-agents-core-runner-sessions", 10],
@@ -136,10 +136,10 @@ const COMPACT_GROUP_SECONDS_HINTS = new Map([
136136
// re-evaluation cost that dominates these serial suites.
137137
const STRIPE_FILE_SECONDS_HINTS = new Map([
138138
// cli-runner entries are CI wall clock (begin->checkmark deltas from the
139-
// compact runs above); reliability's import graph alone runs ~245s, so LPT
140-
// must isolate it or its stripe owns the PR tail.
139+
// compact runs above), refreshed by focused Testbox profiling where noted.
141140
["src/agents/cli-runner.context-engine.test.ts", 6],
142-
["src/agents/cli-runner.reliability.test.ts", 245],
141+
// Fresh profile: 5.1s total, 3.8s import; retain a conservative packing hint.
142+
["src/agents/cli-runner.reliability.test.ts", 8],
143143
["src/agents/cli-runner.spawn.test.ts", 18],
144144
["src/auto-reply/reply/commands-export-session.test.ts", 8],
145145
["src/auto-reply/reply/commands-gating.test.ts", 6],

‎src/agents/cli-runner/helpers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const CLI_RUN_QUEUE = new KeyedAsyncQueue();
5555
const CLI_IMAGE_SWEEP_TTL_MS = 7 * 24 * 60 * 60 * 1_000;
5656
const sweptCliImageRoots = new Set<string>();
5757

58-
function isClaudeCliProvider(providerId: string): boolean {
58+
export function isClaudeCliProvider(providerId: string): boolean {
5959
return normalizeOptionalLowercaseString(providerId) === "claude-cli";
6060
}
6161

‎src/agents/cli-runner/prepare.test.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ vi.mock("../../plugins/hook-runner-global.js", () => ({
7070
getGlobalHookRunner: vi.fn(() => null),
7171
}));
7272

73-
vi.mock("../../plugin-sdk/anthropic-cli.js", () => ({
74-
CLAUDE_CLI_BACKEND_ID: "claude-cli",
75-
isClaudeCliProvider: (providerId: string) => providerId === "claude-cli",
76-
}));
77-
7873
vi.mock("../../tts/tts-settings.js", () => ({
7974
buildTtsSystemPromptHint: vi.fn(() => undefined),
8075
}));

‎src/agents/cli-runner/prepare.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
} from "../../gateway/mcp-http.loopback-runtime.js";
2626
import { resolveMcpLoopbackScopedTools } from "../../gateway/mcp-http.runtime.js";
2727
import { buildSystemAgentToolsMcpServerConfig } from "../../mcp/openclaw-tools-serve-config.js";
28-
import { isClaudeCliProvider } from "../../plugin-sdk/anthropic-cli.js";
2928
import type {
3029
CliBackendAuthEpochMode,
3130
CliBackendPreparedExecution,
@@ -101,7 +100,7 @@ import {
101100
import { prepareCliBundleMcpConfig } from "./bundle-mcp.js";
102101
import { getClaudeLiveSessionGenerationForOwner } from "./claude-live-session.js";
103102
import { prepareClaudeCliSkillsPlugin } from "./claude-skills-plugin.js";
104-
import { buildCliAgentSystemPrompt, normalizeCliModel } from "./helpers.js";
103+
import { buildCliAgentSystemPrompt, isClaudeCliProvider, normalizeCliModel } from "./helpers.js";
105104
import { cliBackendLog } from "./log.js";
106105
import {
107106
buildCliMcpBashElevated,

0 commit comments

Comments
 (0)