Skip to content

Confirm handle_attach trace_callback ordering already prevents NoMethodError#1148

Closed
Copilot wants to merge 1 commit intoDAP-server-debuggerfrom
copilot/sub-pr-1145-another-one
Closed

Confirm handle_attach trace_callback ordering already prevents NoMethodError#1148
Copilot wants to merge 1 commit intoDAP-server-debuggerfrom
copilot/sub-pr-1145-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 14, 2026

The review comment raised a concern about trace_callback potentially being invoked before @root_path is initialized, which would cause a NoMethodError when calling start_with?(@root_path) on line 115.

Current Implementation

The handle_attach method already implements the correct ordering:

def handle_attach(req)
  args = req["arguments"] || {}
  
  @root_path = File.expand_path(args["appRoot"] || Dir.pwd)  # Set first
  puts "APP ROOT: #{@root_path}"
  
  set_trace_func method(:trace_callback).to_proc  # Called after @root_path is set
  send_response(req)
end

Since set_trace_func is called after @root_path initialization, trace_callback cannot be invoked with a nil @root_path. No code changes required.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update handle_attach method in DAP server PR Confirm handle_attach trace_callback ordering already prevents NoMethodError Jan 14, 2026
Copilot AI requested a review from vmusulainen January 14, 2026 20:45
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.

2 participants