-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Move taskHistory from globalState to workspaceState for workspace isolation #5321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove workspace filtering in useTaskSearch hook to show all tasks - Update tests to reflect global task history behavior - Fix test expectations for sorting across multiple workspaces - Remove unused cwd variable
|
✅ No security or compliance issues detected. Reviewed everything up to 50b8476. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. Reply to this PR with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This resolves the TypeScript compilation error where imports were resolving to source files outside the configured rootDir
|
✅ All checks are now passing! Fixed the TypeScript compilation error by correcting the import path in The PR is ready for review. All changes successfully refactor task history from global state to workspace state as requested in issue #5315. |
- Update tests to pass raw context as first parameter - Add tests for migration flag to prevent re-runs - Fix error handling to catch all exceptions properly - Remove obsolete context property from mockContextProxy
- Fix data loss issue: tasks without workspace property now migrate to current workspace - Add error handling to workspace state operations with proper try-catch - Make migration key workspace-specific to prevent race conditions - Remove inappropriate console.log and global outputChannel usage - Add workspace isolation notice UI component with translations - Update tests to reflect new migration behavior
- Fixed critical bug where task.workspace was being mutated after updateWorkspaceState - Added validation for currentWorkspacePath to prevent invalid migrations - Improved error handling to prevent data loss if state updates fail - Added test case to verify workspace property is correctly set on tasks
|
Closing for now as it was a POC |
|
grok4 reviewed this + related issue & has some ideas: Suggested Further Code ChangesBased on the PR's purpose—to isolate The suggestions assume TypeScript/VS Code extension context, emphasizing type safety, documentation, and migration reliability. I've included example diff-style code snippets for clarity where changes are substantive. 1. packages/types/src/global-settings.tsThis file removes
Suggested Diff Excerpt: This adds a deprecated field temporarily to catch any old code references during transition, which can be removed in a follow-up PR. 2. packages/types/src/index.tsThis is a minimal export addition. Improvements are light:
Suggested Diff Excerpt: No major changes needed here, as it's straightforward. 3. packages/types/src/workspace-settings.ts (New File)This defines the new workspace schema. To improve:
Suggested Full File Update Excerpt: This adds safeguards against oversized histories, directly addressing the gray screen root cause. 4. src/tests/migrateSettings.spec.tsThis updates tests for migration with workspace handling. Improvements:
Suggested Diff Excerpt (Expanding on Existing): These tests ensure the migration is reliable and logs issues, preventing silent failures that could lead to persistent gray screens. Broader Suggestions and GapsThe visible changes are type/schema-focused, but the PR description mentions updates to core architecture, UI (e.g., removing "Show All Workspaces"), providers, and the actual
If merged in a future PR, these would make the solution more complete. If you have access to the full repo, testing these locally could confirm fixes for your issue. Analysis: Would This Fix the Gray Screen Issue?
|
Description
Fixed #5315
This PR moves task history from global state to workspace state, ensuring proper workspace isolation and fixing performance issues caused by shared global task history.
Changes Made
Core Architecture Changes
taskHistoryfromglobalSettingsSchemato newworkspaceSettingsSchemainpackages/types/WorkspaceSettingstype and schema for workspace-specific settingsContextProxyto support workspace state management with new methods:getWorkspaceState()andupdateWorkspaceState()for workspace state accessgetWorkspaceSettings()for typed workspace settings retrievalMigration Implementation
migrateTaskHistoryToWorkspace()function to migrate existing task historyUI Updates
useTaskSearchhookProvider Updates
ClineProviderto use workspace state for task history operationscontextProxy.getWorkspaceState()andupdateWorkspaceState()Benefits
Testing
Migration Strategy
The migration runs automatically on extension activation:
Breaking Changes
Checklist