Skip to content
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

Bring launch sequencing in line with DAP sec #2191

Open
2 tasks done
JustinGrote opened this issue Oct 15, 2024 · 0 comments
Open
2 tasks done

Bring launch sequencing in line with DAP sec #2191

JustinGrote opened this issue Oct 15, 2024 · 0 comments
Labels
Issue-Enhancement A feature request (enhancement). Needs: Triage Maintainer attention needed!

Comments

@JustinGrote
Copy link
Collaborator

JustinGrote commented Oct 15, 2024

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been requested.

Summary

Currently, our DAP conversation doesn't follow the spec explicitly in terms of conversation.

What is supposed to happen:

  1. Initialize is sent and server responds, then responds with capabilities
  2. Launch is sent by client after receiving capabilities. should be held and deferred until configurationDone
  3. Server sends initialized event (preferably when ready to receive launch requests)
  4. Client does config after initialized
  5. Configuration is done (breakpoints etc.)
  6. launch request is now responded to after configuration is completed

In actuality, we respond to the launch request immediately before configuration
image

The spec states:

Once the debug adapter is ready to receive configuration from the client, it sends an initialized event to the client. As described above, the client sends zero or more configuration-related requests before sending a configurationDone request.

After the response to configurationDone is sent, the debug adapter may respond to the launch or attach request, and then the debug session has started.

Proposed Design

We need to hold the launch response until after configurationDone is completed. Fixing this would likely be part of a larger refactor to fix the odd behavior of scripts being started directly within configurationDone handler, rather than configurationDone triggering an event or otherwise to start/release any pending launch messages.

As part of this, because the spec currently does not allow multiplexing requests over a single adapter channel, the launch/attach should singleton and throw an error if any additional launch/attach requests are made until the existing one completes.

Implementation Idea

When a launch task is started, a TaskCompletionSource or otherwise should be started and awaited, and the configurationDone handler will complete that task, enabling the launch task to resume and return its startup response.

@JustinGrote JustinGrote added Issue-Enhancement A feature request (enhancement). Needs: Triage Maintainer attention needed! labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement A feature request (enhancement). Needs: Triage Maintainer attention needed!
Projects
None yet
Development

No branches or pull requests

1 participant