feat(mcp): add t3_thread_start for handing work to a new thread #11360
Closedmimen(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/11360/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/server/src/mcp/toolkits/threads/handlers.ts line 139Resolvedby mimen(GitHub profile, opens in a new tab)@@ -0,0 +119,21 @@119+ if (Option.isNone(caller)) {120+ return yield* new ThreadStartCallerNotFoundError({ threadId: scope.threadId });121+ }122+ if (caller.value.archivedAt !== null) {123+ return yield* new ThreadStartCallerArchivedError({ threadId: scope.threadId });124+ }125+ const project = yield* snapshots126+ .getProjectShellById(caller.value.projectId)127+ .pipe(Effect.mapError((cause) => new ThreadStartFailedError({ cause })));128+ if (Option.isNone(project)) {129+ return yield* new ThreadStartProjectNotFoundError({ projectId: caller.value.projectId });130+ }131+132+ const requestKey = input.clientRequestId;133+ const threadId = ThreadId.make(134+ requestKey === undefined135+ ? yield* randomUUID136+ : yield* deterministicUUID(`${scope.threadId}\n${requestKey}`),137+ );138+ if (requestKey !== undefined) {139+ const existing = yield* readThread(threadId);
- @@ -0,0 +183,21 @@183+ runtimeMode,184+ interactionMode,185+ bootstrap: {186+ createThread,187+ ...(prepareWorktree ? { prepareWorktree, runSetupScript: true } : {}),188+ },189+ createdAt,190+ })191+ .pipe(192+ Effect.catchCause((cause) =>193+ Cause.hasInterruptsOnly(cause)194+ ? Effect.failCause(cause as Cause.Cause<never>)195+ : Effect.fail(new ThreadStartFailedError({ cause })),196+ ),197+ Effect.as(false),198+ requestKey === undefined199+ ? (effect) => effect200+ : Effect.catchTag("ThreadStartFailedError", (error) =>201+ readThread(threadId).pipe(202+ Effect.flatMap((thread) =>203+ Option.isSome(thread) ? Effect.succeed(true) : Effect.fail(error),
juliusmarminge closed this
Sign in to join this conversation.
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.