Skip to content

Use AHKPP_DEBUG instead of DEBUG env variable to avoid conflicts with other extensions#702

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-debug-env-check
Draft

Use AHKPP_DEBUG instead of DEBUG env variable to avoid conflicts with other extensions#702
Copilot wants to merge 2 commits intomainfrom
copilot/fix-debug-env-check

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 28, 2026

Any VS Code extension setting DEBUG to a non-empty string (e.g., OpenAI Codex sets DEBUG=release) causes AHK++ to resolve out/server.js instead of dist/server.js, crashing on startup due to JavaScript's truthy semantics.

Changes proposed in this pull request:

  • ahk2/client/src/extension.ts: Replace process.env.DEBUG with process.env.AHKPP_DEBUG in server path resolution and debug mode log
  • ahk2/client/src/browserClientMain.ts: Replace process.env.DEBUG with process.env.AHKPP_DEBUG in extension URI determination
// Before
server/${process.env.DEBUG ? 'out' : 'dist'}/server.js

// After
server/${process.env.AHKPP_DEBUG ? 'out' : 'dist'}/server.js
Original prompt

This section details on the original issue you should resolve

<issue_title>process.env.DEBUG truthy check causes wrong server path when other extensions set DEBUG variable</issue_title>
<issue_description>## Description

AHK++ fails to start when another VS Code extension sets DEBUG environment variable to a non-empty string (e.g. OpenAI Codex sets DEBUG=release).
The extension resolves the server path using:

process.env.DEBUG ? "out" : "dist"

Since any non-empty string is truthy in JavaScript, AHK++ picks out/server.js instead of dist/server.js, which doesn't exist, causing the server to crash on startup.

Reproduction steps

Steps to reproduce the behavior:

  1. Install OpenAI Codex extension
  2. Restart VS Code
  3. AHK++ server fails to start with Cannot find module '...server/out/server.js'

Fix suggestion

Replace the truthy check with a strict comparison:

process.env.DEBUG === "true" ? "out" : "dist"

</issue_description>

<agent_instructions>Change the variable to ahkpp_debug, choose whatever casing makes the most sense, and see if there's a way to add automated checks. If there isn't, that's fine, only add them if you're highly confident they'll work</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@mark-wiemer Ah, that makes sense, I didn't think about other extensions! I should have a fix for this in a couple weeks, extremely busy right now. But I am working on some Windows-specific projects now so it's easy for me to pop over to AHK++ again :)

💡 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] Fix server path resolution for DEBUG environment variable Use AHKPP_DEBUG instead of DEBUG env variable to avoid conflicts with other extensions Feb 28, 2026
@ewerybody
Copy link
Copy Markdown

was copilot doing this on it's own?!! :D

@mark-wiemer
Copy link
Copy Markdown
Owner

@ewerybody I asked Copilot to do this, yes, to save me some time :) I don't have time to review it this weekend but do plan to start coding a lot more in April. March is looking to be extremely busy for me!

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.

process.env.DEBUG truthy check causes wrong server path when other extensions set DEBUG variable

3 participants