fix(extension): don't abort hub tasks when configure precedes execute - #618
Open
apakkhalin-sudo wants to merge 1 commit into
Open
fix(extension): don't abort hub tasks when configure precedes execute#618apakkhalin-sudo wants to merge 1 commit into
apakkhalin-sudo wants to merge 1 commit into
Conversation
When the hub receives an execute message with a config payload, onExecute awaits configure() and then calls execute(). configure()'s setConfig re-renders useAgent, and the [config] effect cleanup disposes the current agent — the very agent the caller is about to run (execute still resolves agentRef to it). Its AbortController fires and every MCP task instantly fails with 'Task aborted' (alibaba#570). Two changes in useAgent.configure(): - Skip the agent rebuild entirely when the merged config is value-equal to the current one (the common MCP case: env config matches saved settings). Storage writes still happen. - When config genuinely changed, resolve configure()'s promise only after the [config] effect has installed the new agent, so callers execute on the new agent instead of the disposed one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
3 tasks
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.
Fixes #570
Problem
Every task sent through the MCP server fails instantly with "Task aborted" whenever any of
LLM_BASE_URL/LLM_API_KEY/LLM_MODEL_NAMEis set — even when those values are identical to the extension's saved settings. The extension popup works fine, and the hub makes zero network requests before failing.Root cause
packages/mcpattaches aconfigobject to everyexecutemessage when LLM env vars are set. In the hub,useHubWs.onExecutethen does:configure()callssetConfig()inuseAgent, which re-renders and re-runs theuseEffect([config]). That effect's cleanup disposes the current agent and installs a new one — butexecute()resolvesagentRefbefore React commits the new agent, so the task starts (or is about to start) on the agent being disposed.dispose()fires itsAbortController, andPageAgentCorereturns the literal"Task aborted".Observable in the hub tab's console on every MCP run:
init→Disposing PageAgent...→dispose.Fix (in
useAgent.configure())setConfigat all — no re-render, no dispose. Storage writes still happen.configure()now resolves only after the[config]effect has installed the new agent, so callers neverexecute()on an agent whose dispose is already scheduled.Verification
npm run typecheck,npm test(17/17),npm run lint,npm run build:extall pass.execute_taskcompletes successfully through hub → extension → LLM → page (previously 100% instant abort).🤖 Generated with Claude Code