Skip to content

fix(#497): give the real reason when rejecting statement addressing on attach sessions - #505

Merged
debugmcpdev merged 2 commits into
mainfrom
fix/497-attach-statement-reason
Aug 27, 2026
Merged

fix(#497): give the real reason when rejecting statement addressing on attach sessions#505
debugmcpdev merged 2 commits into
mainfrom
fix/497-attach-statement-reason

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Summary

Fixes #497 — rejecting statement:/expectedContent addressing on an attach session is the documented contract, but the error claimed the file "is a class name or remote path" even for a readable local file the server had just echoed contents from. That sends the agent chasing a path problem that does not exist.

Root cause

resolveBreakpointFile returned contentAddressable: false for two distinct causes — a policy-declared non-file source identifier (Java FQCN) and an attach session — and the single rejection message in readLinesForContentAddressing was written for the first.

Fix

  • resolveBreakpointFile now returns a discriminated nonAddressableReason: 'non-file-identifier' | 'attach' (other callers read only .path — unchanged).
  • The throw site branches on it. Attach sessions get the actual rule: "statement addressing is not supported for attach sessions — the debuggee's loaded source may not match the file on the mcp-debugger host. Use line addressing instead." The FQCN wording is byte-for-byte unchanged. expectedContent on attach flows through the same throw site and gets the corrected message automatically.

Tests

In tests/core/unit/server/server-statement-anchor.test.ts (written first, confirmed red on the current wording):

  • attach + statement → asserts the attach-specific reason and that the message no longer claims "class name or remote path" — red → green
  • attach + expectedContent → same — red → green
  • FQCN (isNonFileSourceIdentifier: () => true) keeps the "class name or remote path" wording — previously asserted nowhere, now pinned (green throughout)

Full unit suite green (229 files, 4182 tests); server-coverage, server-expected-content, and server-bp-addressing-gating suites verified unaffected.

🤖 Generated with Claude Code

cynarlab and others added 2 commits August 26, 2026 20:46
…n attach sessions

resolveBreakpointFile conflated two causes of contentAddressable: false
— a policy-declared non-file source identifier (Java FQCN) and an attach
session — and the single rejection message was written for the first, so
an attach session with a perfectly readable local file was told it "is a
class name or remote path". The resolver now returns a discriminated
nonAddressableReason and the attach case states the actual rule: content
addressing is unavailable because the debuggee's loaded source, not the
host's copy, is the authority. The FQCN wording is unchanged (and now
pinned by a test); expectedContent on attach gets the same corrected
message via the shared throw site.

Closes #497

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

codecov Bot commented Aug 27, 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 c988633 into main Aug 27, 2026
10 checks passed
@debugmcpdev
debugmcpdev deleted the fix/497-attach-statement-reason branch August 27, 2026 00:57
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.

Attach-mode statement-addressing rejection gives a false reason ("is a class name or remote path") for a readable local file

2 participants