Repository navigation
Replies: 1 comment
|
Note 🤖 GPT-6.1 Terra [1m] responding on behalf of Theo The launch handler now derives the thread and command IDs from the caller’s retry key and replays the accepted launch. Tests verify repeated keys reuse IDs and calls without a key create separate launches. #16654 handlers.ts |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Let agents pass a
clientRequestIdtot3_thread_launchso that retrying a launch after an error or lost response returns the thread already created instead of launching another one, matching the retry contract of the other mutating orchestration tools.Problem to solve
t3_thread_launchis the tool agents use for user-requested independent work in its own worktree. Its description says "Each call creates a new launch with no retry key; retain threadId and use t3_thread_read/t3_thread_wait to follow preparation. After errors or lost responses, inspect t3_thread_list before retrying." When a launch response is lost (client timeout, transport error, server restart), the agent cannot tell whether the thread exists. A blind retry creates a second thread, a second worktree and branch, and a second agent working on the same task. Inspectingt3_thread_listfirst is a manual, racy check while the first launch is still in itspreparingstate, and agents frequently skip it.delegate_task,create_threads,schedule_task,t3_thread_send,t3_thread_interrupt, and thread metadata updates already acceptclientRequestId, so launch is the outlier.Proposed behavior
t3_thread_launchaccepts an optionalclientRequestId. Calls without it behave as today. A call that repeats the sameclientRequestIdwith the same caller scope returns the samethreadIdand launch state as the first call and creates no additional thread, worktree, branch, message, or provider run. A repeated key with different launch input is either rejected with a clear error or returns the original launch, consistent with how the other tools treat key reuse. The tool description and injected agent instructions describe the key the same way as for the other tools.Acceptance criteria
t3_thread_launchcalls with identical input and the sameclientRequestIdfrom the same thread produce one thread, one workspace, and one first message; both responses carry the samethreadId.preparingreturns that launch rather than starting a second preparation.clientRequestIdstill create a new thread each time.clientRequestIdstring used from two different calling threads creates two independent launches.t3_thread_launchtool description no longer says it has no retry key, and documents the new parameter.Affected area
apps/server/src/mcp/toolkits/project/tools.ts(t3_thread_launchdefinition, L105),apps/server/src/mcp/toolkits/project/handlers.ts(ids derived from a freshnewCommandId()at L60-62), and the launch path inapps/server/src/orchestration-v2/ThreadLaunchService.ts, which already reads a command receipt before creating and has a replay path for accepted creates (L706-722). Whether that replay path applies when the handler passes an explicitthreadIdwas not verified.Non-goals
run_scheduled_task_now, which could be considered separately.Alternatives considered
t3_thread_listbefore retrying: it is racy during preparation and depends on every agent following it.threadId: shifts id allocation to agents and diverges from the other tools'clientRequestIdpattern.Supporting context
Tool and retry text are pinned at project/tools.ts:105. Searches for existing issues or discussions about a launch retry key found none; #11168 is the same class of lost-response duplication for
delegate_task.All reactions