@@ -21,13 +21,12 @@ import { buildToolSet } from "./tools.ts";
2121
2222 import type { ThinkingEffort } from "../llm-api/providers.ts";
2323
24-function makeWorktreeBranch(laneId: number): string {
25- return `mc-sub-${laneId}-${Date.now()}`;
24+function makeWorktreeBranch(laneId: string): string {
25+ return `mc-sub-${laneId}`;
2626 }
2727
28-function makeWorktreePath(laneId: number): string {
29- const suffix = crypto.randomUUID().replace(/-/g, "").slice(0, 10);
30- return join(tmpdir(), `mc-wt-${laneId}-${suffix}`);
28+function makeWorktreePath(laneId: string): string {
29+ return join(tmpdir(), `mc-wt-${laneId}`);
3130 }
3231
3332 export function createSubagentRunner(
@@ -36,8 +35,7 @@ export function createSubagentRunner(
3635 getCurrentModel: () => string,
3736 getThinkingEffort: () => ThinkingEffort | null,
3837 ) {
39- let nextLaneId = 1;
40- const activeLanes = new Set<number>();
38+ const activeLanes = new Set<string>();
4139 const worktreesEnabledPromise = isGitRepo(cwd);
4240
4341 let mergeLock: Promise<void> = Promise.resolve();
@@ -57,7 +55,7 @@ export function createSubagentRunner(
5755 modelOverride?: string,
5856 parentLabel?: string,
5957 ): Promise<SubagentOutput> => {
60- const laneId = nextLaneId++;
58+ const laneId = crypto.randomUUID().split("-")[0] as string;
6159 activeLanes.add(laneId);
6260
6361 let subagentCwd = cwd;
@@ -124,7 +122,7 @@ export function createSubagentRunner(
124122 reporter.renderSubagentEvent(event, {
125123 laneId,
126124 ...(parentLabel ? { parentLabel } : {}),
127- ...(worktreeBranch ? { worktreeBranch } : {}),
125+ hasWorktree: !!worktreeBranch,
128126 activeLanes,
129127 });
130128 reporter.startSpinner("thinking");