vscode: Default build task gets wrongly launched again, after reconnecting

  1. Hit Ctrl Shift B to start the default build

๐Ÿ›

image


This happened right after something strange, which might be the underlying cause. I had the build running already, the one with two terminals open. But I still pressed Ctrl Shift B and noticed another two terminals showed up with the same build tasks! I closed them all. Then I pressed Ctrl Shift B and ended up where the screenshot above shows.

cc @alexr00 @Tyriar

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (27 by maintainers)

Commits related to this issue

Most upvoted comments

Some notes from debugging:

  • When comparing tasks that come out of the recently used task list, they must be compared by their recently used key as this is the only stable id value (map key and task id can change).
  • Instead of having a separate code path for reconnect, which is what is causing some state to be lost (like the _activeTasks), if possible, it would be better to try the reconnect in the same place that we currently create a terminal. This would hook up all the needed state again and re-attach problem matchers.

Iโ€™ve made an example PR here that starts to address the above points. Note that this is relatively untested, I just checked whether it fixes the problem described in this issue. https://github.com/microsoft/vscode/pull/156283

Other notes:

  • Using the recent tasks from the task service for re-connecting is problematic since users can use task.quickOpen.history to entirely disable recent tasks. Instead, you will probably need a separate LRU that functions exactly like _recentlyUsedTasks but is only used for reconnection.
  • Tangentially related: you also need to nudge/rerun problem matchers on terminal lines that have already been written so that they can find their start pattern and the task doesnโ€™t have a spinner forever.

๐Ÿ‘I will take some time tomorrow to dig into it.

might still be the same root cause, but iโ€™ll try to investigate for a bit