Skip to content

fix(desktop): isolate MCP catalog refresh by project - #201

Merged
Zongwei9888 merged 1 commit into
HKUDS:mainfrom
imshunsuke:fix/mcp-catalog-project-race
Sep 3, 2026
Merged

fix(desktop): isolate MCP catalog refresh by project#201
Zongwei9888 merged 1 commit into
HKUDS:mainfrom
imshunsuke:fix/mcp-catalog-project-race

Conversation

@imshunsuke

Copy link
Copy Markdown
Contributor

Description

Fix a project-switch race in the Desktop MCP catalog. If a probe or mutation started in project A finished after the user switched to project B, its captured refresh could increment the shared generation and invalidate the in-flight B load. The UI then remained in a loading state with no B catalog.

The hook now records the active catalog owner and ignores refreshes captured by an inactive project before they can mutate shared state.

Related Issues

No matching open issue or PR was found.

Changes Made

  • guard catalog loads with the currently active project key
  • clear ownership during effect cleanup
  • add a deferred-promise hook regression test for the A-to-B race

Checklist

  • Changes tested locally
  • Code reviewed
  • Documentation updated (not necessary; behavior-only bug fix)
  • Unit tests added

Validation

Using Node v22.23.2:

  • Desktop test suite: 31 files, 195 tests passed
  • npm run typecheck
  • npm run lint with zero warnings
  • npm run build
  • uvx pre-commit run --all-files
  • git diff --check

@Zongwei9888
Zongwei9888 merged commit 5dfa89c into HKUDS:main Sep 3, 2026
@Zongwei9888

Copy link
Copy Markdown
Collaborator

Merged on 2026-09-03 as 5dfa89c. The deferred-promise regression test for the A-to-B switch was what made this easy to verify (typecheck, lint and all 195 Desktop tests green on the merged tree). Ten lines of fix, a real race, a test that pins it — this is the ideal shape for a contribution. Thank you, and welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants