Skip to content

Conversation

@0xMink
Copy link
Contributor

@0xMink 0xMink commented Feb 10, 2026

Closes #11362

Summary

  • DiffViewProvider.open() closes existing editor tabs for the file being edited before opening the diff view. The tabGroups.close(tab) call is unguarded — if the tab reference becomes invalid between lookup and close, it throws "Tab close: Invalid tab not found!" and aborts the entire edit operation.
  • This is best-effort cleanup; failure should not block the edit flow.
  • Wraps the tabGroups.close(tab) call in a try-catch, matching the existing defensive pattern in closeAllDiffViews() in the same file.
  • The documentWasOpen flag assignment remains unconditional and outside the close success path (it tracks whether the file had an open tab, not whether the close succeeded).
  • VS Code has an upstream regression producing the same error string (Tab list gets corrupted when a new webview is opened (extension API) microsoft/vscode#228270); this change treats close failures defensively regardless of trigger.

Test plan

  • Existing: 15/15 DiffViewProvider tests passing
  • Manual: open a file in the editor, trigger a Roo edit on that file, verify the diff view opens and editing proceeds normally
  • Manual (WSL/remote): same flow in a remote environment where the race window is wider

Important

Wrap tabGroups.close(tab) in DiffViewProvider.open() with try-catch to prevent aborting edit operation on tab close failure.

  • Behavior:
    • Wraps tabGroups.close(tab) in DiffViewProvider.open() with try-catch to prevent aborting edit operation on tab close failure.
    • documentWasOpen flag remains outside try-catch to track if file had an open tab.
  • Context:
  • Testing:
    • 15/15 existing tests passing.
    • Manual tests for local and remote environments confirm normal operation.

This description was created by Ellipsis for 7053813. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Feb 10, 2026
@roomote
Copy link
Contributor

roomote bot commented Feb 10, 2026

Rooviewer Clock   See task

Reviewed the change. No issues found -- this is a clean, minimal defensive fix. The try-catch around tabGroups.close(tab) in open() correctly matches the existing pattern in closeAllDiffViews(), and the documentWasOpen flag stays outside the error-handling block as intended. All 15 existing tests pass.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@0xMink
Copy link
Contributor Author

0xMink commented Feb 10, 2026

Related work

Note for reviewers: PR #11327 (preserve pinned tab state) modifies the same for (const tab of tabs) loop in DiffViewProvider.open(). If both PRs merge, they should be reconciled — the try-catch from this PR should wrap the tabGroups.close() call, while the pin-state capture from #11327 should happen before it.

Precedent: the defensive close pattern used here matches the existing posture in closeAllDiffViews(), introduced in PR #4578.

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

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DiffViewProvider.open can throw "Tab close: Invalid tab not found!" and abort edits

1 participant