The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 18:30 UTC
perf(ci): run server test files in parallel on each shard (#35618)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 12, 2026 at 14:37 UTC
a3cde98425e4d3fc962aafd2e3dc4f789dc67926
4 files changed
+245
-292
.github/workflows/ci.yml
+2
-1
@@ -504,8 +504,9 @@ jobs:
504
T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md
505
T3CODE_TRANSFER_BUDGET_RESULT_PATH: ${{ runner.temp }}/thread-transfer-result.json
506
T3CODE_TRANSFER_BUDGET_SCENARIOS_PATH: ${{ runner.temp }}/thread-transfer-scenarios.json
507
+ # One process per file spends ~2s starting before its tests run; one file per vCPU overlaps that.
508
run: >-
508
- vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }}
509
+ vp run test:cached -- --shard ${{ matrix.shard }}/${{ strategy.job-total }} --concurrency 4
510
--uncached apps/server/integration/transferBudgetV2.integration.test.ts
511
--verify-hits 1 apps/server
512
apps/server/src/git/GitManager.test.ts
+39
-17
@@ -206,34 +206,55 @@ function runGit(
206
});
207
}
208
209
+/** A committed repository and an empty bare remote, built once and copied into each test. */
210
+class GitFixtureTemplates extends Context.Service<
211
+ GitFixtureTemplates,
212
+ { readonly repo: string; readonly bareRemote: string }
213
+>()("t3/git/GitManager.test/GitFixtureTemplates") {}
214
+
215
+const layerGitFixtureTemplates = Layer.effect(
216
+ GitFixtureTemplates,
217
+ Effect.gen(function* () {
218
+ const fs = yield* FileSystem.FileSystem;
219
+ const repo = yield* makeTempDir("t3code-git-template-");
220
+ // An empty template skips copying git's sample hooks into every test repository.
221
+ yield* runGit(repo, ["init", "--initial-branch=main", "--template="]);
222
+ yield* runGit(repo, ["config", "user.email", "test@example.com"]);
223
+ yield* runGit(repo, ["config", "user.name", "Test User"]);
224
+ // Override global autocrlf on Windows for LF assertions, including linked worktrees.
225
+ yield* runGit(repo, ["config", "core.autocrlf", "false"]);
226
+ yield* fs.writeFileString(NodePath.join(repo, "README.md"), "hello\n");
227
+ yield* runGit(repo, ["add", "README.md"]);
228
+ yield* runGit(repo, ["commit", "-m", "Initial commit"]);
229
+ const bareRemote = yield* makeTempDir("t3code-git-remote-template-");
230
+ yield* runGit(bareRemote, ["init", "--bare", "--template="]);
231
+ yield* fs.makeDirectory(NodePath.join(bareRemote, "hooks"), { recursive: true });
232
+ return { repo, bareRemote };
233
+ }),
234
+);
235
+
236
function initRepo(
237
cwd: string,
211
-): Effect.Effect<
212
- void,
213
- PlatformError.PlatformError | GitCommandError,
214
- FileSystem.FileSystem | Scope.Scope | GitVcsDriver.GitVcsDriver
215
-> {
238
+): Effect.Effect<void, PlatformError.PlatformError, FileSystem.FileSystem | GitFixtureTemplates> {
239
return Effect.gen(function* () {
240
const fs = yield* FileSystem.FileSystem;
218
- yield* runGit(cwd, ["init", "--initial-branch=main"]);
219
- yield* runGit(cwd, ["config", "user.email", "test@example.com"]);
220
- yield* runGit(cwd, ["config", "user.name", "Test User"]);
221
- // Override global autocrlf on Windows for LF assertions, including linked worktrees.
222
- yield* runGit(cwd, ["config", "core.autocrlf", "false"]);
223
- yield* fs.writeFileString(NodePath.join(cwd, "README.md"), "hello\n");
224
- yield* runGit(cwd, ["add", "README.md"]);
225
- yield* runGit(cwd, ["commit", "-m", "Initial commit"]);
241
+ const templates = yield* GitFixtureTemplates;
242
+ for (const entry of [".git", "README.md"]) {
243
+ yield* fs.copy(NodePath.join(templates.repo, entry), NodePath.join(cwd, entry));
244
+ }
245
});
246
}
247
248
function createBareRemote(): Effect.Effect<
249
string,
231
- PlatformError.PlatformError | GitCommandError,
232
- FileSystem.FileSystem | Scope.Scope | GitVcsDriver.GitVcsDriver
250
+ PlatformError.PlatformError,
251
+ FileSystem.FileSystem | Scope.Scope | GitFixtureTemplates
252
> {
253
return Effect.gen(function* () {
254
+ const fs = yield* FileSystem.FileSystem;
255
+ const templates = yield* GitFixtureTemplates;
256
const remoteDir = yield* makeTempDir("t3code-git-remote-");
236
- yield* runGit(remoteDir, ["init", "--bare"]);
257
+ yield* fs.copy(templates.bareRemote, remoteDir, { overwrite: true });
258
return remoteDir;
259
});
260
}
@@ -743,7 +764,8 @@ function makeManager(input?: {
764
765
const asThreadId = (threadId: string) => threadId as ThreadId;
766
746
-const layerGitManagerTest = GitVcsDriver.layer.pipe(
767
+const layerGitManagerTest = layerGitFixtureTemplates.pipe(
768
+ Layer.provideMerge(GitVcsDriver.layer),
769
Layer.provide(ServerConfig.layerTest(process.cwd(), { prefix: "t3-git-manager-test-" })),
770
Layer.provideMerge(VcsProcess.layer),
771
Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+133
-257
@@ -16,7 +16,7 @@ import * as NodePath from "node:path";
16
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
17
import * as NodeServices from "@effect/platform-node/NodeServices";
18
import * as DocumentText from "../../provider/DocumentText.ts";
19
-import { assert, describe, it } from "@effect/vitest";
19
+import { assert, beforeAll, describe, it } from "@effect/vitest";
20
import {
21
CheckpointId,
22
EnvironmentId,
@@ -120,6 +120,50 @@ const layerTest = Layer.mergeAll(
120
McpProviderSessions.layer,
121
layerHost,
122
);
123
+// Node spends ~0.5s loading the agent scripts' TypeScript module graph on every spawn;
124
+// a bundle built once per file starts in ~0.15s. Tests still talk to a real subprocess.
125
+const bundledAgents = Deferred.makeUnsafe<{
126
+ readonly mock: string;
127
+ readonly replay: string;
128
+ readonly compileCache: string;
129
+}>();
130
+const bundledMockAgentPath = Deferred.await(bundledAgents).pipe(
131
+ Effect.map((agents) => agents.mock),
132
+);
133
+const bundledReplayAgentPath = Deferred.await(bundledAgents).pipe(
134
+ Effect.map((agents) => agents.replay),
135
+);
136
+const bundleAgents = Effect.gen(function* () {
137
+ const fileSystem = yield* FileSystem.FileSystem;
138
+ const path = yield* Path.Path;
139
+ const outDir = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-acp-agents-" });
140
+ const input = {
141
+ mock: yield* path.fromFileUrl(new URL("../../../scripts/acp-mock-agent.ts", import.meta.url)),
142
+ replay: yield* path.fromFileUrl(
143
+ new URL("../../../scripts/acp-replay-agent.ts", import.meta.url),
144
+ ),
145
+ };
146
+ const { build } = yield* Effect.promise(() => import("vite-plus"));
147
+ yield* Effect.promise(() =>
148
+ build({
149
+ configFile: false,
150
+ logLevel: "silent",
151
+ root: path.dirname(input.mock),
152
+ ssr: { noExternal: true },
153
+ build: {
154
+ ssr: true,
155
+ outDir,
156
+ rollupOptions: { input, output: { format: "es", entryFileNames: "[name].mjs" } },
157
+ },
158
+ }),
159
+ );
160
+ yield* Deferred.succeed(bundledAgents, {
161
+ mock: path.join(outDir, "mock.mjs"),
162
+ replay: path.join(outDir, "replay.mjs"),
163
+ compileCache: path.join(outDir, "compile-cache"),
164
+ });
165
+}).pipe(Effect.provide(NodeServices.layer));
166
+
167
const ACP_TEST_DRIVER = ProviderDriverKind.make("acp-test");
168
const decodeUnknownJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
169
@@ -492,6 +536,7 @@ function makeMockRuntime(input: {
536
cwd: runtimeInput.cwd,
537
env: {
538
T3_ACP_SESSION_LIFECYCLE: "1",
539
+ NODE_COMPILE_CACHE: (yield* Deferred.await(bundledAgents)).compileCache,
540
...(typeof input.environment === "function"
541
? input.environment(runtimeOrdinal)
542
: input.environment),
@@ -532,7 +577,6 @@ const makePromptInactivityHarness = Effect.fnUntraced(function* (input: {
577
readonly cancelled?: Deferred.Deferred<void>;
578
}) {
579
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
535
- const path = yield* Path.Path;
580
const natives: Array<AcpSessionRuntime.AcpSessionRuntime["Service"]> = [];
581
const instanceId = ProviderInstanceId.make("acp-prompt-inactivity");
582
const adapter = yield* makeAcpAdapterV2({
@@ -543,9 +587,7 @@ const makePromptInactivityHarness = Effect.fnUntraced(function* (input: {
587
promptInactivityTimeout: "15 minutes",
588
makeRuntime: makeMockRuntime({
589
childProcessSpawner,
546
- mockAgentPath: yield* path.fromFileUrl(
547
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
548
- ),
590
+ mockAgentPath: yield* bundledMockAgentPath,
591
environment: input.environment,
592
wrapRuntime: (runtime) => {
593
natives.push(runtime);
@@ -687,11 +729,8 @@ const makeInstructionCompactionHarness = Effect.fnUntraced(function* (
729
environment: Readonly<Record<string, string>>,
730
) {
731
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
690
- const path = yield* Path.Path;
732
const selfInvocation = yield* resolveSelfInvocation();
692
- const mockAgentPath = yield* path.fromFileUrl(
693
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
694
- );
733
+ const mockAgentPath = yield* bundledMockAgentPath;
734
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
735
const instanceId = ProviderInstanceId.make("acp-test-instruction-compaction");
736
const threadId = ThreadId.make("thread-acp-instruction-compaction");
@@ -788,9 +827,7 @@ const runFormElicitation = (input: {
827
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
828
const fileSystem = yield* FileSystem.FileSystem;
829
const path = yield* Path.Path;
791
- const mockAgentPath = yield* path.fromFileUrl(
792
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
793
- );
830
+ const mockAgentPath = yield* bundledMockAgentPath;
831
const directory = yield* fileSystem.makeTempDirectoryScoped({
832
prefix: "t3-acp-form-elicitation-",
833
});
@@ -872,9 +909,10 @@ const optionValues = (question: OrchestrationV2UserInputQuestion | undefined) =>
909
question?.options.map((option) => option.value ?? option.label);
910
911
describe("AcpAdapterV2", () => {
912
+ beforeAll(() => bundleAgents);
913
+
914
it.live("reports per-turn usage unavailable on a continuation turn that never prompts", () =>
915
Effect.gen(function* () {
877
- const path = yield* Path.Path;
916
const instanceId = ProviderInstanceId.make("acp-test-usage-continuation");
917
const threadId = ThreadId.make("thread-acp-usage-continuation");
918
let promptOrdinal = 0;
@@ -893,9 +931,7 @@ describe("AcpAdapterV2", () => {
931
enablePostSettleContinuation: true,
932
makeRuntime: makeMockRuntime({
933
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
896
- mockAgentPath: yield* path.fromFileUrl(
897
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
898
- ),
934
+ mockAgentPath: yield* bundledMockAgentPath,
935
wrapRuntime: (runtime) => ({
936
...runtime,
937
prompt: () => {
@@ -996,7 +1032,6 @@ describe("AcpAdapterV2", () => {
1032
);
1033
it.live("fails an end_turn the outcome check rejects and restarts before the next turn", () =>
1034
Effect.gen(function* () {
999
- const path = yield* Path.Path;
1035
const instanceId = ProviderInstanceId.make("acp-test-prompt-outcome");
1036
const threadId = ThreadId.make("thread-acp-prompt-outcome");
1037
const quota = {
@@ -1023,9 +1058,7 @@ describe("AcpAdapterV2", () => {
1058
}),
1059
makeRuntime: makeMockRuntime({
1060
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1026
- mockAgentPath: yield* path.fromFileUrl(
1027
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1028
- ),
1061
+ mockAgentPath: yield* bundledMockAgentPath,
1062
wrapRuntime: (runtime, runtimeOrdinal) => ({
1063
...runtime,
1064
prompt: () =>
@@ -1087,7 +1120,6 @@ describe("AcpAdapterV2", () => {
1120
);
1121
it.live("retains returned usage when Stop finalizes before the prompt callback", () =>
1122
Effect.gen(function* () {
1090
- const path = yield* Path.Path;
1123
const instanceId = ProviderInstanceId.make("acp-test-prompt-usage-stop");
1124
const threadId = ThreadId.make("thread-acp-prompt-usage-stop");
1125
const wireSettled = yield* Deferred.make<void>();
@@ -1109,9 +1141,7 @@ describe("AcpAdapterV2", () => {
1141
preserveRuntimeOnSettledInterrupt: true,
1142
makeRuntime: makeMockRuntime({
1143
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1112
- mockAgentPath: yield* path.fromFileUrl(
1113
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1114
- ),
1144
+ mockAgentPath: yield* bundledMockAgentPath,
1145
wrapRuntime: (runtime) => ({
1146
...runtime,
1147
prompt: () =>
@@ -1180,7 +1210,6 @@ describe("AcpAdapterV2", () => {
1210
1211
it.live("drops a late prompt response that lands after the turn finalized", () =>
1212
Effect.gen(function* () {
1183
- const path = yield* Path.Path;
1213
const instanceId = ProviderInstanceId.make("acp-test-prompt-usage-late");
1214
const threadId = ThreadId.make("thread-acp-prompt-usage-late");
1215
const dispatched = yield* Deferred.make<void>();
@@ -1201,9 +1230,7 @@ describe("AcpAdapterV2", () => {
1230
terminateRuntimeProcessGroupOnInterrupt: true,
1231
makeRuntime: makeMockRuntime({
1232
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1204
- mockAgentPath: yield* path.fromFileUrl(
1205
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1206
- ),
1233
+ mockAgentPath: yield* bundledMockAgentPath,
1234
ownDetachedProcessGroup: true,
1235
processGroupTerminationGrace: 0,
1236
wrapRuntime: (runtime) => ({
@@ -1309,7 +1336,6 @@ describe("AcpAdapterV2", () => {
1336
1337
it.live("keeps usage unavailable for undeclared agents even when they report usage", () =>
1338
Effect.gen(function* () {
1312
- const path = yield* Path.Path;
1339
const instanceId = ProviderInstanceId.make("acp-test-usage-undeclared");
1340
const threadId = ThreadId.make("thread-acp-usage-undeclared");
1341
const adapter = yield* makeAcpAdapterV2({
@@ -1320,9 +1346,7 @@ describe("AcpAdapterV2", () => {
1346
capabilities: AcpProviderCapabilitiesV2,
1347
makeRuntime: makeMockRuntime({
1348
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1323
- mockAgentPath: yield* path.fromFileUrl(
1324
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1325
- ),
1349
+ mockAgentPath: yield* bundledMockAgentPath,
1350
wrapRuntime: (runtime) => ({
1351
...runtime,
1352
prompt: () =>
@@ -1382,7 +1406,6 @@ describe("AcpAdapterV2", () => {
1406
"fails the turn on an ACP v2 idle error with %s, settles its open tool, and accepts the next prompt",
1407
(details) =>
1408
Effect.gen(function* () {
1385
- const path = yield* Path.Path;
1409
const instanceId = ProviderInstanceId.make(`idle-error-${details}`);
1410
const threadId = ThreadId.make(`thread-idle-error-${details}`);
1411
const childSessionId = "mock-child-session-idle-error";
@@ -1411,9 +1434,7 @@ describe("AcpAdapterV2", () => {
1434
: undefined,
1435
makeRuntime: makeMockRuntime({
1436
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1414
- mockAgentPath: yield* path.fromFileUrl(
1415
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1416
- ),
1437
+ mockAgentPath: yield* bundledMockAgentPath,
1438
environment: { T3_ACP_IDLE_ERROR: details },
1439
}),
1440
},
@@ -1759,9 +1780,7 @@ describe("AcpAdapterV2", () => {
1780
transcript,
1781
statusPath,
1782
fileSystem,
1762
- scriptPath: yield* path.fromFileUrl(
1763
- new URL("../../../scripts/acp-replay-agent.ts", import.meta.url),
1764
- ),
1783
+ scriptPath: yield* bundledReplayAgentPath,
1784
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1785
}),
1786
}).pipe(
@@ -1824,7 +1843,6 @@ describe("AcpAdapterV2", () => {
1843
"projects Mistral retry notices and their %s outcome",
1844
(outcome) =>
1845
Effect.gen(function* () {
1827
- const path = yield* Path.Path;
1846
const instanceId = ProviderInstanceId.make(`vibe-retry-${outcome}`);
1847
const threadId = ThreadId.make(`thread-vibe-retry-${outcome}`);
1848
const adapter = yield* makeAcpAdapterV2({
@@ -1837,9 +1855,7 @@ describe("AcpAdapterV2", () => {
1855
promptFailure: (cause) => acpRegistryPromptFailure("mistral-vibe", cause),
1856
makeRuntime: makeMockRuntime({
1857
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
1840
- mockAgentPath: yield* path.fromFileUrl(
1841
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1842
- ),
1858
+ mockAgentPath: yield* bundledMockAgentPath,
1859
environment: { T3_ACP_VIBE_RETRY_OUTCOME: outcome },
1860
}),
1861
},
@@ -1927,11 +1943,8 @@ describe("AcpAdapterV2", () => {
1943
({ environment, planModeId, buildModeId }) =>
1944
Effect.gen(function* () {
1945
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1930
- const path = yield* Path.Path;
1946
const selfInvocation = yield* resolveSelfInvocation();
1932
- const mockAgentPath = yield* path.fromFileUrl(
1933
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
1934
- );
1947
+ const mockAgentPath = yield* bundledMockAgentPath;
1948
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
1949
const instanceId = ProviderInstanceId.make("acp-test-instruction-transitions");
1950
const threadId = ThreadId.make("thread-acp-instruction-transitions");
@@ -2114,10 +2127,7 @@ describe("AcpAdapterV2", () => {
2127
it.live("reapplies a selection after a switch away from it failed partway", () =>
2128
Effect.gen(function* () {
2129
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2117
- const path = yield* Path.Path;
2118
- const mockAgentPath = yield* path.fromFileUrl(
2119
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2120
- );
2130
+ const mockAgentPath = yield* bundledMockAgentPath;
2131
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
2132
const instanceId = ProviderInstanceId.make("acp-test-partial-selection-reapply");
2133
const threadId = ThreadId.make("thread-acp-partial-selection-reapply");
@@ -2207,7 +2217,6 @@ describe("AcpAdapterV2", () => {
2217
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
2218
let handler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
2219
const instanceId = ProviderInstanceId.make("acp-named-stream-wait");
2210
- const path = yield* Path.Path;
2220
const adapter = yield* makeAcpAdapterV2({
2221
instanceId,
2222
selfInvocation: yield* resolveSelfInvocation(),
@@ -2216,9 +2225,7 @@ describe("AcpAdapterV2", () => {
2225
capabilities: AcpProviderCapabilitiesV2,
2226
makeRuntime: makeMockRuntime({
2227
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
2219
- mockAgentPath: yield* path.fromFileUrl(
2220
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2221
- ),
2228
+ mockAgentPath: yield* bundledMockAgentPath,
2229
wrapRuntime: (runtime) => ({
2230
...runtime,
2231
handleSessionUpdate: (next) =>
@@ -2357,7 +2364,6 @@ describe("AcpAdapterV2", () => {
2364
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
2365
let handler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
2366
const instanceId = ProviderInstanceId.make("acp-named-text-resume");
2360
- const path = yield* Path.Path;
2367
const adapter = yield* makeAcpAdapterV2({
2368
instanceId,
2369
selfInvocation: yield* resolveSelfInvocation(),
@@ -2366,9 +2372,7 @@ describe("AcpAdapterV2", () => {
2372
capabilities: AcpProviderCapabilitiesV2,
2373
makeRuntime: makeMockRuntime({
2374
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
2369
- mockAgentPath: yield* path.fromFileUrl(
2370
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2371
- ),
2375
+ mockAgentPath: yield* bundledMockAgentPath,
2376
wrapRuntime: (runtime) => ({
2377
...runtime,
2378
handleSessionUpdate: (next) =>
@@ -2512,11 +2516,8 @@ describe("AcpAdapterV2", () => {
2516
it.effect("starts a new replay message after ACP v2 plan boundaries", () =>
2517
Effect.gen(function* () {
2518
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2515
- const path = yield* Path.Path;
2519
const selfInvocation = yield* resolveSelfInvocation();
2517
- const mockAgentPath = yield* path.fromFileUrl(
2518
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2519
- );
2520
+ const mockAgentPath = yield* bundledMockAgentPath;
2521
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
2522
let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
2523
const instanceId = ProviderInstanceId.make("acp-test-v2-plan-replay-boundary");
@@ -2615,10 +2616,7 @@ describe("AcpAdapterV2", () => {
2616
it.effect("persists a bounded subset of streamed root and child tool updates", () =>
2617
Effect.gen(function* () {
2618
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2618
- const path = yield* Path.Path;
2619
- const mockAgentPath = yield* path.fromFileUrl(
2620
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2621
- );
2619
+ const mockAgentPath = yield* bundledMockAgentPath;
2620
type Runtime = AcpSessionRuntime.AcpSessionRuntime["Service"];
2621
let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
2622
// Devin resends the growing file without status on each update.
@@ -2787,10 +2785,7 @@ describe("AcpAdapterV2", () => {
2785
it.effect("keeps Devin parent paragraphs intact while projecting native child work", () =>
2786
Effect.gen(function* () {
2787
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2790
- const path = yield* Path.Path;
2791
- const mockAgentPath = yield* path.fromFileUrl(
2792
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
2793
- );
2788
+ const mockAgentPath = yield* bundledMockAgentPath;
2789
type Runtime = AcpSessionRuntime.AcpSessionRuntime["Service"];
2790
let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
2791
let createTerminal: Parameters<Runtime["handleCreateTerminal"]>[0] | undefined;
@@ -3111,10 +3106,7 @@ describe("AcpAdapterV2", () => {
3106
it.effect("routes interleaved Copilot subagent output into subagent threads", () =>
3107
Effect.gen(function* () {
3108
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3114
- const path = yield* Path.Path;
3115
- const mockAgentPath = yield* path.fromFileUrl(
3116
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3117
- );
3109
+ const mockAgentPath = yield* bundledMockAgentPath;
3110
type Runtime = AcpSessionRuntime.AcpSessionRuntime["Service"];
3111
let handler: Parameters<Runtime["handleSessionUpdate"]>[0] | undefined;
3112
let sessionEvent:
@@ -3309,11 +3301,8 @@ describe("AcpAdapterV2", () => {
3301
it.effect("keeps protocol diagnostics off unless a protocol logger is supplied", () =>
3302
Effect.gen(function* () {
3303
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3312
- const path = yield* Path.Path;
3304
const selfInvocation = yield* resolveSelfInvocation();
3314
- const mockAgentPath = yield* path.fromFileUrl(
3315
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3316
- );
3305
+ const mockAgentPath = yield* bundledMockAgentPath;
3306
const runTurn = Effect.fn("AcpAdapterV2.testProtocolLoggingTurn")(function* (
3307
name: string,
3308
nativeLogging?: NonNullable<Parameters<typeof makeAcpAdapterV2>[0]["nativeLogging"]>,
@@ -3395,11 +3384,8 @@ describe("AcpAdapterV2", () => {
3384
it.effect("advertises ACP session notices and shows them as system notices", () =>
3385
Effect.gen(function* () {
3386
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3398
- const path = yield* Path.Path;
3387
const selfInvocation = yield* resolveSelfInvocation();
3400
- const mockAgentPath = yield* path.fromFileUrl(
3401
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3402
- );
3388
+ const mockAgentPath = yield* bundledMockAgentPath;
3389
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3390
const instanceId = ProviderInstanceId.make("acp-test-notice");
3391
const adapter = yield* makeAcpAdapterV2({
@@ -3477,11 +3463,8 @@ describe("AcpAdapterV2", () => {
3463
it.effect("projects ACP v2 fidelity updates into first-class orchestration items", () =>
3464
Effect.gen(function* () {
3465
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3480
- const path = yield* Path.Path;
3466
const selfInvocation = yield* resolveSelfInvocation();
3482
- const mockAgentPath = yield* path.fromFileUrl(
3483
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3484
- );
3467
+ const mockAgentPath = yield* bundledMockAgentPath;
3468
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
3469
let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
3470
const instanceId = ProviderInstanceId.make("acp-test-v2-fidelity");
@@ -3675,10 +3658,7 @@ describe("AcpAdapterV2", () => {
3658
it.effect("projects only the tail of long ACP terminal output", () =>
3659
Effect.gen(function* () {
3660
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3678
- const path = yield* Path.Path;
3679
- const mockAgentPath = yield* path.fromFileUrl(
3680
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3681
- );
3661
+ const mockAgentPath = yield* bundledMockAgentPath;
3662
const instanceId = ProviderInstanceId.make("acp-test-long-terminal");
3663
const adapter = yield* makeAcpAdapterV2({
3664
instanceId,
@@ -3742,11 +3722,8 @@ describe("AcpAdapterV2", () => {
3722
Effect.gen(function* () {
3723
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3724
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3745
- const path = yield* Path.Path;
3725
const selfInvocation = yield* resolveSelfInvocation();
3747
- const mockAgentPath = yield* path.fromFileUrl(
3748
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3749
- );
3726
+ const mockAgentPath = yield* bundledMockAgentPath;
3727
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3728
const instanceId = ProviderInstanceId.make("acp-test-eager-resume");
3729
const adapter = yield* makeAcpAdapterV2({
@@ -3820,11 +3797,8 @@ describe("AcpAdapterV2", () => {
3797
it.live("creates a fresh ACP identity when recovering an exhausted target", () =>
3798
Effect.gen(function* () {
3799
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3823
- const path = yield* Path.Path;
3800
const selfInvocation = yield* resolveSelfInvocation();
3825
- const mockAgentPath = yield* path.fromFileUrl(
3826
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3827
- );
3801
+ const mockAgentPath = yield* bundledMockAgentPath;
3802
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3803
const instanceId = ProviderInstanceId.make("acp-test-exhausted-target");
3804
const adapter = yield* makeAcpAdapterV2({
@@ -3914,11 +3888,8 @@ describe("AcpAdapterV2", () => {
3888
Effect.gen(function* () {
3889
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
3890
const idAllocator = yield* IdAllocator.IdAllocatorV2;
3917
- const path = yield* Path.Path;
3891
const selfInvocation = yield* resolveSelfInvocation();
3919
- const mockAgentPath = yield* path.fromFileUrl(
3920
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
3921
- );
3892
+ const mockAgentPath = yield* bundledMockAgentPath;
3893
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
3894
const instanceId = ProviderInstanceId.make("acp-test-stale-eager-resume");
3895
const adapter = yield* makeAcpAdapterV2({
@@ -4014,11 +3985,8 @@ describe("AcpAdapterV2", () => {
3985
it.live("replaces an unexpectedly terminated ACP runtime before the next turn", () =>
3986
Effect.gen(function* () {
3987
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4017
- const path = yield* Path.Path;
3988
const selfInvocation = yield* resolveSelfInvocation();
4019
- const mockAgentPath = yield* path.fromFileUrl(
4020
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4021
- );
3989
+ const mockAgentPath = yield* bundledMockAgentPath;
3990
const runtimeInputs: AcpAdapterV2RuntimeInput[] = [];
3991
let runtimeOrdinalSeen = 0;
3992
const baseMakeRuntime = makeMockRuntime({
@@ -4328,9 +4296,7 @@ describe("AcpAdapterV2", () => {
4296
const fileSystem = yield* FileSystem.FileSystem;
4297
const path = yield* Path.Path;
4298
const selfInvocation = yield* resolveSelfInvocation();
4331
- const mockAgentPath = yield* path.fromFileUrl(
4332
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4333
- );
4299
+ const mockAgentPath = yield* bundledMockAgentPath;
4300
// A directory stands in for cgroupfs: the join wrapper appends the agent
4301
// PID to cgroup.procs and stays in this process's cgroup, which is the
4302
// cgroup the lease reports.
@@ -4423,11 +4389,8 @@ describe("AcpAdapterV2", () => {
4389
it.effect("negotiates and executes optional native session forks through the ACP runtime", () =>
4390
Effect.gen(function* () {
4391
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4426
- const path = yield* Path.Path;
4392
const selfInvocation = yield* resolveSelfInvocation();
4428
- const mockAgentPath = yield* path.fromFileUrl(
4429
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4430
- );
4393
+ const mockAgentPath = yield* bundledMockAgentPath;
4394
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
4395
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
4396
let createTerminal: Parameters<RuntimeService["handleCreateTerminal"]>[0] | undefined;
@@ -4629,9 +4592,7 @@ describe("AcpAdapterV2", () => {
4592
const fileSystem = yield* FileSystem.FileSystem;
4593
const path = yield* Path.Path;
4594
const selfInvocation = yield* resolveSelfInvocation();
4632
- const mockAgentPath = yield* path.fromFileUrl(
4633
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4634
- );
4595
+ const mockAgentPath = yield* bundledMockAgentPath;
4596
const workspace = yield* fileSystem.makeTempDirectoryScoped({
4597
prefix: "t3-acp-no-client-fs-",
4598
});
@@ -4717,11 +4678,8 @@ describe("AcpAdapterV2", () => {
4678
it.effect("does not turn an unknown permission approval into an execute grant", () =>
4679
Effect.gen(function* () {
4680
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4720
- const path = yield* Path.Path;
4681
const selfInvocation = yield* resolveSelfInvocation();
4722
- const mockAgentPath = yield* path.fromFileUrl(
4723
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4724
- );
4682
+ const mockAgentPath = yield* bundledMockAgentPath;
4683
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
4684
let requestPermission: Parameters<RuntimeService["handleRequestPermission"]>[0] | undefined;
4685
let createTerminal: Parameters<RuntimeService["handleCreateTerminal"]>[0] | undefined;
@@ -4876,11 +4834,8 @@ describe("AcpAdapterV2", () => {
4834
] as const)("$label", ({ kind, granted, ...testCase }) =>
4835
Effect.gen(function* () {
4836
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
4879
- const path = yield* Path.Path;
4837
const selfInvocation = yield* resolveSelfInvocation();
4881
- const mockAgentPath = yield* path.fromFileUrl(
4882
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
4883
- );
4838
+ const mockAgentPath = yield* bundledMockAgentPath;
4839
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
4840
let requestPermission: Parameters<RuntimeService["handleRequestPermission"]>[0] | undefined;
4841
let createTerminal: Parameters<RuntimeService["handleCreateTerminal"]>[0] | undefined;
@@ -5039,11 +4994,8 @@ describe("AcpAdapterV2", () => {
4994
] as const)("$label", ({ options, optionId }) =>
4995
Effect.gen(function* () {
4996
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5042
- const path = yield* Path.Path;
4997
const selfInvocation = yield* resolveSelfInvocation();
5044
- const mockAgentPath = yield* path.fromFileUrl(
5045
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5046
- );
4998
+ const mockAgentPath = yield* bundledMockAgentPath;
4999
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
5000
let requestPermission: Parameters<RuntimeService["handleRequestPermission"]>[0] | undefined;
5001
let runtimeInput: AcpAdapterV2RuntimeInput | undefined;
@@ -5156,11 +5108,8 @@ describe("AcpAdapterV2", () => {
5108
Effect.gen(function* () {
5109
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5110
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5159
- const path = yield* Path.Path;
5111
const selfInvocation = yield* resolveSelfInvocation();
5161
- const mockAgentPath = yield* path.fromFileUrl(
5162
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5163
- );
5112
+ const mockAgentPath = yield* bundledMockAgentPath;
5113
const instanceId = ProviderInstanceId.make("acp-test-rollback-session");
5114
const rollbackThreadId = ThreadId.make("thread-acp-rollback-session-target");
5115
yield* (yield* McpProviderSessions.McpProviderSessions).set({
@@ -5330,11 +5279,8 @@ describe("AcpAdapterV2", () => {
5279
it.effect("quarantines callbacks from a failed rollback replacement before retrying", () =>
5280
Effect.gen(function* () {
5281
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5333
- const path = yield* Path.Path;
5282
const selfInvocation = yield* resolveSelfInvocation();
5335
- const mockAgentPath = yield* path.fromFileUrl(
5336
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5337
- );
5283
+ const mockAgentPath = yield* bundledMockAgentPath;
5284
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
5285
const sessionUpdateHandlers: Array<
5286
Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined
@@ -5482,10 +5428,7 @@ describe("AcpAdapterV2", () => {
5428
it.live("settles a Grok background command that completed before an ACP v2 idle error", () =>
5429
Effect.gen(function* () {
5430
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5485
- const path = yield* Path.Path;
5486
- const mockAgentPath = yield* path.fromFileUrl(
5487
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5488
- );
5431
+ const mockAgentPath = yield* bundledMockAgentPath;
5432
const instanceId = ProviderInstanceId.make("grok-idle-error-background");
5433
const adapter = yield* makeGrokAdapterV2({
5434
instanceId,
@@ -5548,11 +5491,8 @@ describe("AcpAdapterV2", () => {
5491
it.effect("closes the ACP runtime when the agent never answers session/close", () =>
5492
Effect.gen(function* () {
5493
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5551
- const path = yield* Path.Path;
5494
const selfInvocation = yield* resolveSelfInvocation();
5553
- const mockAgentPath = yield* path.fromFileUrl(
5554
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5555
- );
5495
+ const mockAgentPath = yield* bundledMockAgentPath;
5496
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5497
const makeRuntime = makeMockRuntime({
5498
childProcessSpawner,
@@ -5613,10 +5553,7 @@ describe("AcpAdapterV2", () => {
5553
() =>
5554
Effect.gen(function* () {
5555
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5616
- const path = yield* Path.Path;
5617
- const mockAgentPath = yield* path.fromFileUrl(
5618
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5619
- );
5556
+ const mockAgentPath = yield* bundledMockAgentPath;
5557
const instanceId = ProviderInstanceId.make("grok-background-completion");
5558
const adapter = yield* makeGrokAdapterV2({
5559
instanceId,
@@ -5704,10 +5641,7 @@ describe("AcpAdapterV2", () => {
5641
Effect.gen(function* () {
5642
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5643
const fileSystem = yield* FileSystem.FileSystem;
5707
- const path = yield* Path.Path;
5708
- const mockAgentPath = yield* path.fromFileUrl(
5709
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5710
- );
5644
+ const mockAgentPath = yield* bundledMockAgentPath;
5645
const hostPlatform = yield* HostProcess.Platform;
5646
// Stands in for `grok inspect --json`, the catalog behind the `$` picker.
5647
const catalog = { skills: [{ name: "deploy", source: { path: "/s/deploy/SKILL.md" } }] };
@@ -5796,10 +5730,7 @@ describe("AcpAdapterV2", () => {
5730
({ shape, expectedCommand }) =>
5731
Effect.gen(function* () {
5732
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5799
- const path = yield* Path.Path;
5800
- const mockAgentPath = yield* path.fromFileUrl(
5801
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5802
- );
5733
+ const mockAgentPath = yield* bundledMockAgentPath;
5734
const instanceId = ProviderInstanceId.make("grok-kill-completion");
5735
const adapter = yield* makeGrokAdapterV2({
5736
instanceId,
@@ -5879,11 +5810,8 @@ describe("AcpAdapterV2", () => {
5810
it.effect("keeps an agent's empty-valued default choice selectable", () =>
5811
Effect.gen(function* () {
5812
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5882
- const path = yield* Path.Path;
5813
const selfInvocation = yield* resolveSelfInvocation();
5884
- const mockAgentPath = yield* path.fromFileUrl(
5885
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5886
- );
5814
+ const mockAgentPath = yield* bundledMockAgentPath;
5815
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5816
const instanceId = ProviderInstanceId.make("acp-test");
5817
let agentDescriptor: ProviderOptionDescriptor | undefined;
@@ -5979,11 +5907,8 @@ describe("AcpAdapterV2", () => {
5907
Effect.gen(function* () {
5908
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
5909
const idAllocator = yield* IdAllocator.IdAllocatorV2;
5982
- const path = yield* Path.Path;
5910
const selfInvocation = yield* resolveSelfInvocation();
5984
- const mockAgentPath = yield* path.fromFileUrl(
5985
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
5986
- );
5911
+ const mockAgentPath = yield* bundledMockAgentPath;
5912
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
5913
const instanceId = ProviderInstanceId.make("acp-test");
5914
const adapter = yield* makeAcpAdapterV2({
@@ -5997,6 +5922,7 @@ describe("AcpAdapterV2", () => {
5922
environment: (runtimeOrdinal) =>
5923
runtimeOrdinal === 1 ? { T3_ACP_EMIT_EMPTY_SUCCESSFUL_BASH_THEN_HANG: "1" } : {},
5924
ownDetachedProcessGroup: true,
5925
+ processGroupTerminationGrace: 0,
5926
protocolEvents,
5927
}),
5928
normalizeToolCall: normalizeXAiAcpToolCallState,
@@ -6119,7 +6045,6 @@ describe("AcpAdapterV2", () => {
6045
it.effect("drains native ACP cancellation before admitting the next prompt", () =>
6046
Effect.gen(function* () {
6047
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6122
- const path = yield* Path.Path;
6048
const selfInvocation = yield* resolveSelfInvocation();
6049
const protocolEvents = yield* Queue.unbounded<EffectAcpProtocol.AcpProtocolLogEvent>();
6050
const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};
@@ -6131,9 +6056,7 @@ describe("AcpAdapterV2", () => {
6056
capabilities: AcpProviderCapabilitiesV2,
6057
makeRuntime: makeMockRuntime({
6058
childProcessSpawner,
6134
- mockAgentPath: yield* path.fromFileUrl(
6135
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6136
- ),
6059
+ mockAgentPath: yield* bundledMockAgentPath,
6060
environment: { T3_ACP_COMPLETE_FIRST_PROMPT_ON_CANCEL: "1" },
6061
protocolEvents,
6062
cancelBehavior: "wait-for-prompt",
@@ -6226,11 +6149,8 @@ describe("AcpAdapterV2", () => {
6149
it.effect("cancels pending permission requests while interrupting an ACP turn", () =>
6150
Effect.gen(function* () {
6151
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6229
- const path = yield* Path.Path;
6152
const selfInvocation = yield* resolveSelfInvocation();
6231
- const mockAgentPath = yield* path.fromFileUrl(
6232
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6233
- );
6153
+ const mockAgentPath = yield* bundledMockAgentPath;
6154
const releaseCancel = yield* Deferred.make<void>();
6155
const instanceId = ProviderInstanceId.make("acp-test");
6156
const adapter = yield* makeAcpAdapterV2({
@@ -6320,11 +6240,8 @@ describe("AcpAdapterV2", () => {
6240
it.live("keeps hard teardown excluded until a permission response is enqueued", () =>
6241
Effect.gen(function* () {
6242
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6323
- const path = yield* Path.Path;
6243
const selfInvocation = yield* resolveSelfInvocation();
6325
- const mockAgentPath = yield* path.fromFileUrl(
6326
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6327
- );
6244
+ const mockAgentPath = yield* bundledMockAgentPath;
6245
const responseEnqueued = yield* Deferred.make<void>();
6246
const releaseResponseAcknowledgement = yield* Deferred.make<void>();
6247
const instanceId = ProviderInstanceId.make("acp-test");
@@ -6668,11 +6585,8 @@ describe("AcpAdapterV2", () => {
6585
it.live("auto-approves tagged MCP elicitations under full-access policy", () =>
6586
Effect.gen(function* () {
6587
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6671
- const path = yield* Path.Path;
6588
const selfInvocation = yield* resolveSelfInvocation();
6673
- const mockAgentPath = yield* path.fromFileUrl(
6674
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6675
- );
6589
+ const mockAgentPath = yield* bundledMockAgentPath;
6590
const instanceId = ProviderInstanceId.make("acp-test-mcp-approval-elicitation");
6591
const adapter = yield* makeAcpAdapterV2({
6592
instanceId,
@@ -6729,11 +6643,8 @@ describe("AcpAdapterV2", () => {
6643
it.live("fails a held native response acknowledgement before normal session close", () =>
6644
Effect.gen(function* () {
6645
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6732
- const path = yield* Path.Path;
6646
const selfInvocation = yield* resolveSelfInvocation();
6734
- const mockAgentPath = yield* path.fromFileUrl(
6735
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6736
- );
6647
+ const mockAgentPath = yield* bundledMockAgentPath;
6648
const responseWritten = yield* Deferred.make<void>();
6649
const releaseResponseAcknowledgement = yield* Deferred.make<void>();
6650
const responseLifecycle: Array<string> = [];
@@ -6831,11 +6742,8 @@ describe("AcpAdapterV2", () => {
6742
Effect.gen(function* () {
6743
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6744
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6834
- const path = yield* Path.Path;
6745
const selfInvocation = yield* resolveSelfInvocation();
6836
- const mockAgentPath = yield* path.fromFileUrl(
6837
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6838
- );
6746
+ const mockAgentPath = yield* bundledMockAgentPath;
6747
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
6748
const instanceId = ProviderInstanceId.make("acp-test");
6749
const adapter = yield* makeAcpAdapterV2({
@@ -6850,6 +6758,7 @@ describe("AcpAdapterV2", () => {
6758
childProcessSpawner,
6759
mockAgentPath,
6760
ownDetachedProcessGroup: true,
6761
+ processGroupTerminationGrace: 0,
6762
environment: { T3_ACP_HANG_PROMPT_FOREVER: "1" },
6763
protocolEvents,
6764
}),
@@ -6924,11 +6833,8 @@ describe("AcpAdapterV2", () => {
6833
Effect.gen(function* () {
6834
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6835
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6927
- const path = yield* Path.Path;
6836
const selfInvocation = yield* resolveSelfInvocation();
6929
- const mockAgentPath = yield* path.fromFileUrl(
6930
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
6931
- );
6837
+ const mockAgentPath = yield* bundledMockAgentPath;
6838
const instanceId = ProviderInstanceId.make("acp-test");
6839
let subagentPhase: "spawn" | "complete" = "spawn";
6840
const promptSettled = yield* Deferred.make<void>();
@@ -7063,11 +6969,8 @@ describe("AcpAdapterV2", () => {
6969
Effect.gen(function* () {
6970
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
6971
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7066
- const path = yield* Path.Path;
6972
const selfInvocation = yield* resolveSelfInvocation();
7068
- const mockAgentPath = yield* path.fromFileUrl(
7069
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
7070
- );
6973
+ const mockAgentPath = yield* bundledMockAgentPath;
6974
const baseClock = yield* Clock.Clock;
6975
const finalizationClockRead = yield* Deferred.make<void>();
6976
const releaseFinalizationClockRead = yield* Deferred.make<void>();
@@ -7274,11 +7177,8 @@ describe("AcpAdapterV2", () => {
7177
Effect.gen(function* () {
7178
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7179
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7277
- const path = yield* Path.Path;
7180
const selfInvocation = yield* resolveSelfInvocation();
7279
- const mockAgentPath = yield* path.fromFileUrl(
7280
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
7281
- );
7181
+ const mockAgentPath = yield* bundledMockAgentPath;
7182
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
7183
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
7184
[];
@@ -7517,11 +7417,8 @@ describe("AcpAdapterV2", () => {
7417
Effect.gen(function* () {
7418
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7419
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7520
- const path = yield* Path.Path;
7420
const selfInvocation = yield* resolveSelfInvocation();
7522
- const mockAgentPath = yield* path.fromFileUrl(
7523
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
7524
- );
7421
+ const mockAgentPath = yield* bundledMockAgentPath;
7422
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
7423
[];
7424
const bufferedAssistantText = "BUFFERED_WAKE_AFTER_USER_ATTACH";
@@ -7811,11 +7708,8 @@ describe("AcpAdapterV2", () => {
7708
Effect.gen(function* () {
7709
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7710
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7814
- const path = yield* Path.Path;
7711
const selfInvocation = yield* resolveSelfInvocation();
7816
- const mockAgentPath = yield* path.fromFileUrl(
7817
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
7818
- );
7712
+ const mockAgentPath = yield* bundledMockAgentPath;
7713
const instanceId = ProviderInstanceId.make("acp-test");
7714
let subagentPhase: "spawn" | "complete" = "spawn";
7715
let cancelCalled = false;
@@ -7970,11 +7864,8 @@ describe("AcpAdapterV2", () => {
7864
Effect.gen(function* () {
7865
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7866
const idAllocator = yield* IdAllocator.IdAllocatorV2;
7973
- const path = yield* Path.Path;
7867
const selfInvocation = yield* resolveSelfInvocation();
7975
- const mockAgentPath = yield* path.fromFileUrl(
7976
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
7977
- );
7868
+ const mockAgentPath = yield* bundledMockAgentPath;
7869
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
7870
const instanceId = ProviderInstanceId.make("acp-test");
7871
const adapter = yield* makeAcpAdapterV2({
@@ -8046,11 +7937,8 @@ describe("AcpAdapterV2", () => {
7937
Effect.gen(function* () {
7938
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7939
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8049
- const path = yield* Path.Path;
7940
const selfInvocation = yield* resolveSelfInvocation();
8051
- const mockAgentPath = yield* path.fromFileUrl(
8052
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8053
- );
7941
+ const mockAgentPath = yield* bundledMockAgentPath;
7942
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
7943
const instanceId = ProviderInstanceId.make("acp-test");
7944
const capturedMutation: {
@@ -8080,6 +7968,7 @@ describe("AcpAdapterV2", () => {
7968
mockAgentPath,
7969
environment: { T3_ACP_HANG_PROMPT_FOREVER: "1" },
7970
ownDetachedProcessGroup: true,
7971
+ processGroupTerminationGrace: 0,
7972
protocolEvents,
7973
}),
7974
},
@@ -8183,14 +8072,12 @@ describe("AcpAdapterV2", () => {
8072
Effect.gen(function* () {
8073
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8074
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8186
- const path = yield* Path.Path;
8075
const selfInvocation = yield* resolveSelfInvocation();
8188
- const mockAgentPath = yield* path.fromFileUrl(
8189
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8190
- );
8076
+ const mockAgentPath = yield* bundledMockAgentPath;
8077
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
8078
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
8079
[];
8080
+ const native: { current?: AcpSessionRuntime.AcpSessionRuntime["Service"] } = {};
8081
const instanceId = ProviderInstanceId.make("acp-test");
8082
const adapter = yield* makeAcpAdapterV2({
8083
instanceId,
@@ -8217,6 +8104,10 @@ describe("AcpAdapterV2", () => {
8104
T3_ACP_EMIT_IN_TURN_TASKOUTPUT_THEN_LATE_DUPLICATE: "1",
8105
},
8106
protocolEvents,
8107
+ wrapRuntime: (runtime) => {
8108
+ native.current = runtime;
8109
+ return runtime;
8110
+ },
8111
}),
8112
},
8113
selfInvocation,
@@ -8276,6 +8167,18 @@ describe("AcpAdapterV2", () => {
8167
}
8168
assert.equal(terminalStatus, "completed");
8169
8170
+ // The agent re-reports on its own after a 2.5s wall-clock timer; send the same update now.
8171
+ yield* native.current!.request("_test/emit-update", {
8172
+ sessionId: "mock-session-1",
8173
+ update: {
8174
+ sessionUpdate: "tool_call_update",
8175
+ toolCallId: "tool-call-fetch-1",
8176
+ title: "get_command_or_subagent_output",
8177
+ kind: "other",
8178
+ status: "completed",
8179
+ rawOutput: { output: "MONITOR_LISTING_TOKEN_LATE" },
8180
+ },
8181
+ });
8182
yield* Stream.fromQueue(protocolEvents).pipe(
8183
Stream.filter(
8184
(event) =>
@@ -8306,11 +8209,8 @@ describe("AcpAdapterV2", () => {
8209
Effect.gen(function* () {
8210
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8211
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8309
- const path = yield* Path.Path;
8212
const selfInvocation = yield* resolveSelfInvocation();
8311
- const mockAgentPath = yield* path.fromFileUrl(
8312
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8313
- );
8213
+ const mockAgentPath = yield* bundledMockAgentPath;
8214
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
8215
[];
8216
const userPromptStarted = yield* Deferred.make<void>();
@@ -8510,11 +8410,8 @@ describe("AcpAdapterV2", () => {
8410
Effect.gen(function* () {
8411
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8412
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8513
- const path = yield* Path.Path;
8413
const selfInvocation = yield* resolveSelfInvocation();
8515
- const mockAgentPath = yield* path.fromFileUrl(
8516
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8517
- );
8414
+ const mockAgentPath = yield* bundledMockAgentPath;
8415
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
8416
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
8417
[];
@@ -8717,11 +8614,8 @@ describe("AcpAdapterV2", () => {
8614
Effect.gen(function* () {
8615
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8616
const idAllocator = yield* IdAllocator.IdAllocatorV2;
8720
- const path = yield* Path.Path;
8617
const selfInvocation = yield* resolveSelfInvocation();
8722
- const mockAgentPath = yield* path.fromFileUrl(
8723
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
8724
- );
8618
+ const mockAgentPath = yield* bundledMockAgentPath;
8619
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
8620
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
8621
[];
@@ -9079,11 +8973,8 @@ describe("AcpAdapterV2", () => {
8973
Effect.gen(function* () {
8974
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
8975
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9082
- const path = yield* Path.Path;
8976
const selfInvocation = yield* resolveSelfInvocation();
9084
- const mockAgentPath = yield* path.fromFileUrl(
9085
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9086
- );
8977
+ const mockAgentPath = yield* bundledMockAgentPath;
8978
const continuationRequests: Array<ProviderContinuationRequests.ProviderContinuationRequest> =
8979
[];
8980
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
@@ -9230,11 +9121,8 @@ describe("AcpAdapterV2", () => {
9121
({ status, exitCode }) =>
9122
Effect.gen(function* () {
9123
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9233
- const path = yield* Path.Path;
9124
const selfInvocation = yield* resolveSelfInvocation();
9235
- const mockAgentPath = yield* path.fromFileUrl(
9236
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9237
- );
9125
+ const mockAgentPath = yield* bundledMockAgentPath;
9126
type RuntimeService = AcpSessionRuntime.AcpSessionRuntime["Service"];
9127
let sessionUpdateHandler: Parameters<RuntimeService["handleSessionUpdate"]>[0] | undefined;
9128
let taskCompleted:
@@ -9447,11 +9335,8 @@ describe("AcpAdapterV2", () => {
9335
Effect.gen(function* () {
9336
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9337
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9450
- const path = yield* Path.Path;
9338
const selfInvocation = yield* resolveSelfInvocation();
9452
- const mockAgentPath = yield* path.fromFileUrl(
9453
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9454
- );
9339
+ const mockAgentPath = yield* bundledMockAgentPath;
9340
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
9341
const instanceId = ProviderInstanceId.make("acp-test");
9342
const adapter = yield* makeAcpAdapterV2({
@@ -9530,11 +9415,8 @@ describe("AcpAdapterV2", () => {
9415
Effect.gen(function* () {
9416
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9417
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9533
- const path = yield* Path.Path;
9418
const selfInvocation = yield* resolveSelfInvocation();
9535
- const mockAgentPath = yield* path.fromFileUrl(
9536
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9537
- );
9419
+ const mockAgentPath = yield* bundledMockAgentPath;
9420
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
9421
const teardownStarted = yield* Deferred.make<void>();
9422
const releaseTeardown = yield* Deferred.make<void>();
@@ -9637,11 +9519,8 @@ describe("AcpAdapterV2", () => {
9519
Effect.gen(function* () {
9520
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9521
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9640
- const path = yield* Path.Path;
9522
const selfInvocation = yield* resolveSelfInvocation();
9642
- const mockAgentPath = yield* path.fromFileUrl(
9643
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9644
- );
9523
+ const mockAgentPath = yield* bundledMockAgentPath;
9524
const protocolEvents = yield* Queue.bounded<EffectAcpProtocol.AcpProtocolLogEvent>(256);
9525
const teardownStarted = yield* Deferred.make<void>();
9526
const releaseTeardown = yield* Deferred.make<void>();
@@ -9729,11 +9608,8 @@ describe("AcpAdapterV2", () => {
9608
Effect.gen(function* () {
9609
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
9610
const idAllocator = yield* IdAllocator.IdAllocatorV2;
9732
- const path = yield* Path.Path;
9611
const selfInvocation = yield* resolveSelfInvocation();
9734
- const mockAgentPath = yield* path.fromFileUrl(
9735
- new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
9736
- );
9612
+ const mockAgentPath = yield* bundledMockAgentPath;
9613
const instanceId = ProviderInstanceId.make("acp-test");
9614
let subagentPhase: "spawn" | "complete" = "spawn";
9615
const promptSettled = yield* Deferred.make<void>();
apps/server/src/vcs/GitVcsDriverCore.test.ts
+71
-17
@@ -6,7 +6,7 @@ import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
6
import * as NodeServices from "@effect/platform-node/NodeServices";
7
import * as HostProcess from "@t3tools/shared/HostProcess";
8
import { assert, it, describe } from "@effect/vitest";
9
-import { vi } from "vite-plus/test";
9
+import { afterAll, vi } from "vite-plus/test";
10
import * as Cause from "effect/Cause";
11
import * as Clock from "effect/Clock";
12
import * as Deferred from "effect/Deferred";
@@ -342,6 +342,15 @@ const git = (
342
return result.stdout.trim();
343
});
344
345
+const gitWithStdin = (
346
+ cwd: string,
347
+ args: ReadonlyArray<string>,
348
+ stdin: string,
349
+): Effect.Effect<string, GitCommandError, GitVcsDriver.GitVcsDriver> =>
350
+ Effect.flatMap(GitVcsDriver.GitVcsDriver, (driver) =>
351
+ driver.execute({ operation: "GitVcsDriver.test.git", cwd, args, stdin, timeoutMs: 10_000 }),
352
+ ).pipe(Effect.map((result) => result.stdout.trim()));
353
+
354
// Git blocks file submodule transports (CVE-2022-39253) despite repo config; local fixtures need env permission.
355
const withGitFileProtocol = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
356
Effect.flatMap(HostProcess.Environment, (env) =>
@@ -358,17 +367,48 @@ const initRepoWithCommit = (
367
GitVcsDriver.GitVcsDriver | FileSystem.FileSystem | Path.Path
368
> =>
369
Effect.gen(function* () {
361
- const driver = yield* GitVcsDriver.GitVcsDriver;
362
- yield* driver.initRepo({ cwd });
363
- yield* git(cwd, ["config", "user.email", "test@test.com"]);
364
- yield* git(cwd, ["config", "user.name", "Test"]);
370
+ const fileSystem = yield* FileSystem.FileSystem;
371
+ const pathService = yield* Path.Path;
372
+ // Git commits whatever already sits in cwd, so only an empty one can take the shared copy.
373
+ const empty =
374
+ !(yield* fileSystem.exists(cwd)) || (yield* fileSystem.readDirectory(cwd)).length === 0;
375
+ if (empty) {
376
+ if (!repoTemplate) {
377
+ const template = yield* fileSystem.makeTempDirectory({
378
+ prefix: "git-vcs-driver-template-",
379
+ });
380
+ yield* commitInitialRepo(template);
381
+ repoTemplate = template;
382
+ }
383
+ yield* fileSystem.copy(repoTemplate, cwd);
384
+ } else {
385
+ yield* commitInitialRepo(cwd);
386
+ }
387
+ const head = yield* fileSystem.readFileString(pathService.join(cwd, ".git", "HEAD"));
388
+ return { initialBranch: head.trim().replace(/^ref: refs\/heads\//, "") };
389
+ });
390
+
391
+const commitInitialRepo = (cwd: string) =>
392
+ Effect.gen(function* () {
393
+ const fileSystem = yield* FileSystem.FileSystem;
394
+ const pathService = yield* Path.Path;
395
+ yield* git(cwd, ["init"]);
396
+ yield* fileSystem.writeFileString(
397
+ pathService.join(cwd, ".git", "config"),
398
+ "[user]\n\temail = test@test.com\n\tname = Test\n",
399
+ { flag: "a" },
400
+ );
401
yield* writeTextFile(cwd, "README.md", "# test\n");
402
yield* git(cwd, ["add", "."]);
403
yield* git(cwd, ["commit", "-m", "initial commit"]);
368
- const initialBranch = yield* git(cwd, ["branch", "--show-current"]);
369
- return { initialBranch };
404
});
405
406
+// Most tests start from the same one-commit repository; they copy it instead of spawning git.
407
+let repoTemplate: string | undefined;
408
+afterAll(() => {
409
+ if (repoTemplate) NodeFS.rmSync(repoTemplate, { recursive: true, force: true });
410
+});
411
+
412
it.effect.each(["root", "nested", "worktree"] as const)(
413
"skips clean filters while the %s index is locked and resumes after unlock",
414
(location) =>
@@ -2503,9 +2543,22 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2543
const { initialBranch } = yield* initRepoWithCommit(cwd);
2544
const driver = yield* GitVcsDriver.GitVcsDriver;
2545
yield* git(cwd, ["checkout", "-b", "feature/commits"]);
2506
- for (let index = 0; index < 102; index++) {
2507
- yield* git(cwd, ["commit", "--allow-empty", "-m", `feature ${index}`]);
2508
- }
2546
+ const parent = yield* git(cwd, ["rev-parse", "HEAD"]);
2547
+ yield* gitWithStdin(
2548
+ cwd,
2549
+ ["fast-import", "--quiet"],
2550
+ Array.from({ length: 102 }, (_, index) => {
2551
+ const message = `feature ${index}`;
2552
+ return [
2553
+ "commit refs/heads/feature/commits",
2554
+ `committer Test <test@test.com> ${1_700_000_000 + index} +0000`,
2555
+ `data ${Buffer.byteLength(message)}`,
2556
+ message,
2557
+ ...(index === 0 ? [`from ${parent}`] : []),
2558
+ "",
2559
+ ].join("\n");
2560
+ }).join(""),
2561
+ );
2562
2563
const result = yield* driver.getReviewBranchCommits({ cwd, baseRef: initialBranch });
2564
assert.strictEqual(result.truncated, true);
@@ -4807,13 +4860,14 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4860
const { initialBranch } = yield* initRepoWithCommit(cwd);
4861
const driver = yield* GitVcsDriver.GitVcsDriver;
4862
const oid = yield* git(cwd, ["rev-parse", "HEAD"]);
4810
- for (let index = 0; index <= 100; index += 1) {
4811
- yield* git(cwd, [
4812
- "update-ref",
4813
- `refs/heads/${index === 0 ? "topic" : `topic-${index}`}`,
4814
- oid,
4815
- ]);
4816
- }
4863
+ yield* gitWithStdin(
4864
+ cwd,
4865
+ ["update-ref", "--stdin"],
4866
+ Array.from(
4867
+ { length: 101 },
4868
+ (_, index) => `create refs/heads/${index === 0 ? "topic" : `topic-${index}`} ${oid}\n`,
4869
+ ).join(""),
4870
+ );
4871
const result = yield* driver
4872
.renameBranch({ cwd, oldBranch: initialBranch, newBranch: "topic" })
4873
.pipe(Effect.result);