fix(#497): give the real reason when rejecting statement addressing on attach sessions - #505
Merged
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #497 — rejecting
statement:/expectedContentaddressing 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
resolveBreakpointFilereturnedcontentAddressable: falsefor two distinct causes — a policy-declared non-file source identifier (Java FQCN) and an attach session — and the single rejection message inreadLinesForContentAddressingwas written for the first.Fix
resolveBreakpointFilenow returns a discriminatednonAddressableReason: 'non-file-identifier' | 'attach'(other callers read only.path— unchanged).statement addressingis 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.expectedContenton 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):statement→ asserts the attach-specific reason and that the message no longer claims "class name or remote path" — red → greenexpectedContent→ same — red → greenisNonFileSourceIdentifier: () => 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, andserver-bp-addressing-gatingsuites verified unaffected.🤖 Generated with Claude Code