Skip to content

Fix stale rejected custom editor model cache on reopen#293395

Open
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
murataslan1:fix/issue-268301-custom-editor-retry
Open

Fix stale rejected custom editor model cache on reopen#293395
murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
murataslan1:fix/issue-268301-custom-editor-retry

Conversation

@murataslan1
Copy link
Copy Markdown
Contributor

@murataslan1 murataslan1 commented Feb 6, 2026

Fixes #268301.

Summary

  • clear cached model entries when model creation promise rejects in CustomEditorModelManager.add
  • allow subsequent open attempts to recreate custom editor models after transient failures (for example missing file at first open)
  • add a regression test covering reject-then-recover behavior

Test Plan

  • npx tsx ./node_modules/mocha/bin/mocha --ui tdd src/vs/workbench/contrib/customEditor/test/common/customEditorModelManager.test.ts --timeout 10000

Copilot AI review requested due to automatic review settings February 6, 2026 12:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #268301 where custom editors would cache rejected model creation promises and never retry, even after the underlying issue (e.g., missing file) was resolved.

Changes:

  • Modified CustomEditorModelManager.add() to clear cached model entries when model creation promises reject
  • Added a regression test verifying that rejected models can be recreated on subsequent open attempts

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/customEditor/common/customEditorModelManager.ts Adds error handling to clear rejected model entries from the cache
src/vs/workbench/contrib/customEditor/test/common/customEditorModelManager.test.ts Adds a new test suite with regression test for reject-then-recover behavior

Comment on lines +62 to +64
if (retained) {
await assert.rejects(retained, error);
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test logic is inconsistent. Lines 62-64 check if retained exists and then assert it rejects, but line 65 then asserts that retained is undefined. If retained is undefined (line 65), then lines 62-64 will never execute. The assertion on line 65 should come first, or the entire if block should be removed since we expect retained to be undefined after the model is cleared from the cache.

Suggested change
if (retained) {
await assert.rejects(retained, error);
}

Copilot uses AI. Check for mistakes.
@murataslan1 murataslan1 force-pushed the fix/issue-268301-custom-editor-retry branch from f4af514 to fd12abe Compare February 20, 2026 19:13
@murataslan1
Copy link
Copy Markdown
Contributor Author

Rebased/refreshed this PR and force-pushed the branch to current main.

Still contains the same intended fix:

  • clear cached custom editor model entries when model creation rejects
  • add a regression test that verifies reject-then-recover behavior

Please re-review when convenient.

@murataslan1
Copy link
Copy Markdown
Contributor Author

Friendly follow-up — this PR fixes stale rejected custom editor model cache on reopen. Would appreciate a review when available.

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.

Custom editor retains previous error on reopen even when it no longer applies

3 participants