Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions apps/server/src/orchestration-v2/ThreadLaunchService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,7 @@ it.effect("starts the agent of a new worktree thread only after its branch is re
yield* Effect.gen(function* () {
const launches = yield* ThreadLaunch.ThreadLaunchService;
const tracker = yield* WorktreeSetupTracker.WorktreeSetupTracker;
const threads = yield* ThreadManagement.ThreadManagementService;
const outbox = yield* EffectOutbox.EffectOutboxV2;
const input = launchInput({
command: "launch:release-after-rename",
Expand All @@ -3002,7 +3003,17 @@ it.effect("starts the agent of a new worktree thread only after its branch is re
),
Stream.runHead,
);
yield* TestClock.adjust("30 seconds");
yield* Deferred.succeed(allowBranchName, undefined);
yield* tracker.stream(launched.threadId).pipe(
Stream.filter((snapshot) => snapshot?.phase === "done"),
Stream.runHead,
);
const projection = yield* threads.getThreadProjection(launched.threadId);
assert.equal(projection.thread.branch, "generated-branch");
assert.equal(harness.renameBranch.mock.calls.length, 1);
assert.equal(projection.runs[0]?.status, "starting");
assert.isUndefined(projection.turnItems.find((item) => item.type === "system_notice"));
assert.isFalse(
yield* Deferred.await(releasedAtRename),
"the agent's run was released while its branch still had the temporary name",
Expand Down Expand Up @@ -3070,7 +3081,7 @@ it.effect("starts the agent on the temporary branch when branch naming hangs", (
}),
);
yield* Deferred.await(branchNameStarted);
yield* TestClock.adjust("20 seconds");
yield* TestClock.adjust("45 seconds");
yield* tracker.stream(launched.threadId).pipe(
Stream.filter((snapshot) => snapshot?.phase === "done"),
Stream.runHead,
Expand All @@ -3080,7 +3091,7 @@ it.effect("starts the agent on the temporary branch when branch naming hangs", (
const notice = projection.turnItems.find((item) => item.type === "system_notice");
assert.include(
notice?.type === "system_notice" ? notice.message : "",
`stays ${projection.thread.branch}. Text generation failed in generateBranchName: Timed out after 20 seconds.`,
`stays ${projection.thread.branch}. Text generation failed in generateBranchName: Timed out after 45 seconds.`,
);
}).pipe(Effect.provide(harness.layer));
}),
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/orchestration-v2/ThreadLaunchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import * as ThreadManagement from "./ThreadManagementService.ts";
import * as WorktreeBranches from "./WorktreeBranches.ts";

// The agent waits for its branch name; a rate-limited provider would hold it for minutes.
const BRANCH_NAME_TIMEOUT = "20 seconds";
const BRANCH_NAME_TIMEOUT = "45 seconds";

export type ThreadLaunchWorkspaceStrategy =
| { readonly type: "root"; readonly branch?: string | undefined }
Expand Down
Loading