Fix task polling blocking the Run button#1134
Open
herakles-dev wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
Fix task polling blocking the Run button#1134herakles-dev wants to merge 1 commit intomodelcontextprotocol:mainfrom
herakles-dev wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
Extract the blocking while-loop task polling from callTool into a separate pollTaskInBackground function that runs asynchronously. callTool now returns immediately after task creation, keeping the Run button enabled for concurrent tool calls during task execution. Changes: - Add pollTaskInBackground() that polls task status in the background - callTool returns initial task result immediately instead of blocking - Remove isPollingTask from Run button disabled condition and label Closes modelcontextprotocol#1077
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.
Summary
The Run button in the Tools Tab is disabled while a task is polling, which prevents users from making concurrent tool calls during long-running task execution. This PR extracts the blocking polling loop into a background async function so
callToolreturns immediately after task creation.Type of Change
Changes Made
client/src/App.tsx:while-loop fromcallToolinto a newpollTaskInBackground()functionpollTaskInBackgroundruns asynchronously viavoid(fire-and-forget), updatingtoolResultstate as the task progressescallToolnow returns the initial task result immediately after task creation, so the caller is not blockedclient/src/components/ToolsTab.tsx:isPollingTaskfrom the Run button'sdisabledconditionisPollingTaskfrom the button label conditional — button shows "Running..." only during the initialcallToolinvocation, not during background pollingNet effect: The Run button stays enabled while tasks poll in the background, allowing concurrent tool calls. Task status updates still appear in the result pane via the existing
setToolResultstate updates.Related Issues
Fixes #1077
Testing
Test Results and/or Instructions
202 Acceptedwith task ID)Local verification:
npx tsc --noEmit --skipLibCheck— no errors)npx prettier --check— all files pass)Checklist
npm run prettier-fix)Breaking Changes
None. The
isPollingTaskstate variable is still maintained in App.tsx and passed to ToolsTab.tsx — it's just no longer used to disable the Run button. Any code that readsisPollingTaskfor other purposes is unaffected.Methodology
Built with Hercules Agentic Architecture — a human-supervised, 10-phase contribution framework:
All outputs are human-reviewed and verified before submission.
Stack: Claude Code (Anthropic) · V11 Protocol · gh CLI · project CI suites