Skip to content

Fix terminal tab order when re-running all tasks #252448

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 25, 2025

When using the "Rerun All Running Tasks" command, terminal tabs were getting mixed up because tasks were being restarted in arbitrary dictionary order rather than their original terminal tab order.

Problem

The issue occurred because:

  1. getActiveTasks() returned tasks in dictionary iteration order (arbitrary)
  2. Concurrent task restart using Promise.allSettled() created race conditions
  3. No preservation of original terminal tab sequence

This resulted in terminals being recreated in a different order than they originally appeared in the tabs.

Solution

Modified getActiveTasks() in TerminalTaskSystem:

  • Now sorts active tasks by their terminal instance order using _terminalGroupService.instances
  • Handles edge cases where terminals might not be found in the instances list
  • Benefits all existing usages of getActiveTasks() with consistent ordering

Modified _runRerunAllRunningTasksCommand() in AbstractTaskService:

  • Changed from concurrent to sequential task restart
  • Ensures terminals are recreated in the same order as they appear in tabs
  • Continues processing even if individual tasks fail

Testing

Manual verification confirms that tasks are now correctly ordered by terminal position (Task A, Task B, Task C) instead of dictionary order (Task C, Task A, Task B). Edge cases are handled properly (missing terminals placed at end).

Impact

This fix resolves the specific terminal tab ordering issue while improving overall task ordering consistency throughout the application. All existing getActiveTasks() usages now benefit from predictable, user-friendly ordering.

Fixes #252447.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits June 25, 2025 20:57
Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
Co-authored-by: anthonykim1 <62267334+anthonykim1@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Re-running all task mixes up the original terminal tab order Fix terminal tab order when re-running all tasks Jun 25, 2025
@Copilot Copilot AI requested a review from anthonykim1 June 25, 2025 21:01
Copilot finished work on behalf of anthonykim1 June 25, 2025 21:01
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.

Re-running all task mixes up the original terminal tab order
2 participants