Skip to content

fix(ruby): apply launchConfig.cwd to the debuggee spawn options (#320) - #322

Merged
debugmcpdev merged 1 commit into
mainfrom
fix/320-ruby-launch-cwd
Aug 12, 2026
Merged

debugmcpdev merged 1 commit into
mainfrom
fix/320-ruby-launch-cwd

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Fixes #320. Sibling of #318 (env, PR #321) — completes the family of spawn-time launch options for ruby.

Problem

cwd passed via dapLaunchArgs was silently dropped on the ruby launch path: with rdbg --open -c -- ruby <script> the debuggee starts at adapter-spawn time, so the cwd carried in the later DAP launch request is never applied and the debuggee inherits the proxy worker's working directory instead. The spawn layer already supported cwd (dap-proxy-adapter-manager.ts sets spawnOptions.cwd when provided) — nothing delivered the value to it.

Fix

Route launchConfig.cwd through the same channel as the #318 env fix:

  • AdapterCommand gains an optional cwd field (packages/shared/src/interfaces/debug-adapter.ts), mirrored on AdapterSpawnPayload.adapterCommand.
  • RubyDebugAdapter.buildAdapterCommand sets it from launchConfig.cwd.
  • The ruby policy's spawn config passes it through (adapter-policy-ruby.ts); the AdapterSpawnConfig union already declared cwd?.

Optional field end to end — no other adapter or policy changes behavior (their debuggees get cwd via the DAP launch request as before). Attach mode untouched.

Tests

🤖 Generated with Claude Code

Sibling of the #318 env fix: rdbg -c starts the debuggee at
adapter-spawn time, so cwd in the DAP launch request is a dead letter
and the debuggee silently inherited the proxy's working directory.
Route launchConfig.cwd through a new optional AdapterCommand.cwd field
into the ruby policy's spawn config — the spawn layer already supported
cwd, nothing delivered it.

Covered by unit tests (adapter command carries cwd, policy routes it)
and a hard e2e test launching with dapLaunchArgs.cwd and evaluating the
working directory at a breakpoint. The e2e evaluates only the path tail
because the #237 redaction masks home-rooted paths as
<redacted:sensitive-name>.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@debugmcpdev
debugmcpdev merged commit fdb8b31 into main Aug 12, 2026
10 checks passed
@debugmcpdev
debugmcpdev deleted the fix/320-ruby-launch-cwd branch August 12, 2026 18:44
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.

[BUG] ruby launch ignores launchConfig.cwd — debuggee runs in the proxy's working directory

2 participants