|
1 | 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
2 | | -import { createTestAdmittedRunContext } from "../../agents/admitted-run-context.test-support.js"; |
| 2 | +import { buildPreparedCliRunContext } from "../../agents/cli-runner.test-helpers.js"; |
3 | 3 | import { executeDeps } from "../../agents/cli-runner/execute-deps.js"; |
4 | 4 | import { executePreparedCliRun } from "../../agents/cli-runner/execute.js"; |
5 | 5 | import { prepareCliPromptImagePayload } from "../../agents/cli-runner/helpers.js"; |
6 | 6 | import { buildCliMcpGrantContext } from "../../agents/cli-runner/mcp-grant-context.js"; |
7 | | -import type { PreparedCliRunContext, RunCliAgentParams } from "../../agents/cli-runner/types.js"; |
| 7 | +import type { RunCliAgentParams } from "../../agents/cli-runner/types.js"; |
8 | 8 | import { detectAndLoadPromptImages } from "../../agents/embedded-agent-runner/run/images.js"; |
9 | 9 | import { FailoverError } from "../../agents/failover-error.js"; |
10 | 10 | import { installSessionPlacementAdmissionProvider } from "../../agents/session-placement-admission.js"; |
@@ -135,31 +135,24 @@ describe("executeAgentTurn: CLI session routing", () => { |
135 | 135 | input: "stdin" as const, |
136 | 136 | serialize: true, |
137 | 137 | }; |
138 | | - const executionContext: PreparedCliRunContext = { |
139 | | - params: { |
140 | | - ...run, |
141 | | - admittedRunContext: createTestAdmittedRunContext(run.runId), |
142 | | - skillsSnapshot: undefined, |
143 | | - }, |
144 | | - started: Date.now(), |
| 138 | + const prepared = buildPreparedCliRunContext({ |
| 139 | + provider: "claude-cli", |
| 140 | + model: run.model, |
| 141 | + runId: run.runId, |
145 | 142 | workspaceDir: run.workspaceDir, |
146 | | - cwd: run.cwd, |
147 | | - backendResolved: { id: "claude-cli", config: backend, bundleMcp: false }, |
148 | | - preparedBackend: { backend, env: {} }, |
149 | | - reusableCliSession: { mode: "reuse", sessionId: observedCliSessionId }, |
150 | | - hadSessionFile: false, |
151 | | - contextEngineConfig: run.config ?? {}, |
152 | | - modelId: run.model ?? "claude-sonnet-4-6", |
153 | | - normalizedModel: run.model ?? "claude-sonnet-4-6", |
154 | | - systemPrompt: "system", |
155 | | - systemPromptReport: {} as PreparedCliRunContext["systemPromptReport"], |
156 | | - claudeSkillsPluginArgs: [], |
157 | | - bootstrapPromptWarningLines: [], |
158 | | - authEpochVersion: 2, |
| 143 | + config: run.config, |
| 144 | + backend, |
| 145 | + }); |
| 146 | + prepared.params = { |
| 147 | + ...run, |
| 148 | + admittedRunContext: prepared.params.admittedRunContext, |
| 149 | + skillsSnapshot: undefined, |
159 | 150 | }; |
| 151 | + prepared.cwd = run.cwd; |
| 152 | + prepared.reusableCliSession = { mode: "reuse", sessionId: observedCliSessionId }; |
160 | 153 | executeDeps.invokeNodeClaudeCliRun = nodeInvoke; |
161 | 154 | try { |
162 | | - await executePreparedCliRun(executionContext, observedCliSessionId); |
| 155 | + await executePreparedCliRun(prepared, observedCliSessionId); |
163 | 156 | } finally { |
164 | 157 | executeDeps.invokeNodeClaudeCliRun = restoreNodeInvoke; |
165 | 158 | } |
|
0 commit comments