fix: handle missing attachment paths gracefully#3063
Open
chindris-mihai-alexandru wants to merge 3 commits intotailcallhq:mainfrom
Open
fix: handle missing attachment paths gracefully#3063chindris-mihai-alexandru wants to merge 3 commits intotailcallhq:mainfrom
chindris-mihai-alexandru wants to merge 3 commits intotailcallhq:mainfrom
Conversation
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
There was a problem hiding this comment.
Pull request overview
This PR improves Forge’s attachment handling by validating attachment paths early and returning a clearer, attachment-scoped error when a referenced path is missing (including truncated display-style paths ending in ...), rather than leaking raw filesystem errors.
Changes:
- Added explicit attachment path resolution (relative →
cwd-joined) and existence validation prior to any directory listing or file reads. - Introduced a dedicated missing-attachment error with a user-facing message explaining truncated display paths must be pasted in full.
- Added regression tests for missing and truncated attachment paths.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: ForgeCode <noreply@forgecode.dev>
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
Handle missing attachment paths gracefully so invalid
@[...]tags no longer surface raw filesystem errors.Context
When Forge receives an attachment tag pointing to a truncated or nonexistent path, attachment loading currently falls through into lower-level file reads and bubbles up generic OS errors such as
No such file or directory. This makes the failure confusing, especially for shortened display paths that end in....Changes
Key Implementation Details
Validation now happens at the start of attachment population, before directory listing or text/image reads. That keeps attachment failures within the attachment service boundary and avoids leaking raw file-open errors from lower layers.
Use Cases
@[/Volumes/.../forgecode-fork/...]now returns a clear attachment-specific errorTesting
cargo test -p forge_services attachment -- --nocapture cargo check -p forge_services cargo clippy -p forge_services --all-targets -- -D warningsLinks