Repository navigation
fix(server): run_scheduled_task_now returns the thread the run launched - #17458
Open
sbansal1999 wants to merge 1 commit into
Open
sbansal1999 wants to merge 1 commit into
sbansal1999 wants to merge 1 commit into
Conversation
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a contained scheduler bug fix that propagates the actual launched thread ID through an existing response field without changing task execution, schemas, defaults, or deployment behavior. Existing bound-thread, failure, scheduled, and webhook paths remain accounted for, with coverage for new and existing threads. You can add or adjust custom eligibility rules. Learn more. |
Fresh-thread-per-run tasks have no bound thread, so the tool returned threadId: null. runTask now reports the thread it posted to or launched, and runNow surfaces it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sbansal1999
force-pushed
the
fix/run-scheduled-task-now-thread-id
branch
from
October 9, 2026 12:23
07cb1a7 to
e16fab3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
run_scheduled_task_nowreturnsthreadId: nullfor scheduled tasks that launch a fresh thread per run: unbound tasks, created withbindToCurrentThread=falseor scheduled into another project. The handler returnedtask.threadId, which is the task's bound thread. So the caller can't tell which thread the run created, and can'tt3_thread_waiton it, read it, or link it.t3_thread_listdoesn't exposescheduledTaskId, so there's no reliable way to find it afterwards.Expected: the tool returns the thread the run posted to or launched. For a bound task that's the bound thread. For a fresh-thread task it's the thread the run created.
Change
runTaskinScheduledTaskServicenow returns{ task, threadId }, wherethreadIdis the bound thread or the threadThreadLaunchService.launchcreated (null if the launch failed).runNowpasses it through.threadIdfield. The tool's output schema andpackages/contractsare unchanged; only the server-siderunNowtype gainedthreadId.Scope and approval
There's no prior issue. This is a small fix for an obvious bug: the tool's
threadIdoutput never carried information the caller didn't already have. For bound tasks it echoed the known binding, and for fresh-thread tasks it was always null. The closed #8731, which first proposed this tool, meant it to return the launched thread's identity. The change is limited to the server's scheduled-task service and this one MCP tool, with no client or contract changes.Verification
ThreadLaunchService.test.tsnow asserts thatrunNowreturns the thread the run posted to, for new-thread and bound-thread tasks (each with user- and agent-created tasks).expected undefined to equal 'thread:project:…'for new threads andexpected undefined to equal 'thread:existing'for bound threads. With the fix, they pass.vp test runonThreadLaunchService.test.tsplussrc/scheduledTasks/(8 files, 107 tests), and onOrchestratorMcpToolkit.integration.test.tsandClaudeAutomaticDelivery.integration.test.ts(2 files, 5 tests): all pass.apps/servertypecheck: no errors.Implemented by Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code