Fix plugin cache panic when cwd is unavailable#18499
Merged
etraut-openai merged 1 commit intomainfrom Apr 19, 2026
Merged
Conversation
xl-openai
approved these changes
Apr 19, 2026
Collaborator
xl-openai
left a comment
There was a problem hiding this comment.
Stamp to unblock, but I wonder if the root cause (current_dir() being unavailable) affects more than just plugins. Are we okay with that state?
Collaborator
Author
|
Yes, unavailable cwd can surface elsewhere, but this PR covers the accidental dependency on cwd for already-absolute paths. I think we should be resilient to a panic in this case. The plugin code was a victim of this bug in I also added additional hardening and error reporting specifically for the plugin code. That's less important, but it's useful for diagnosing any issue related to invalid plugin cache paths. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #16637. (I hit this bug after 11h of work on a long-running task.)
Plugin cache initialization could panic when an already-absolute cache path was normalized through
AbsolutePathBuf::from_absolute_path, because that path still consultedcurrent_dir().This changes absolute-path normalization so already-absolute paths do not depend on cwd, and makes plugin cache root construction available as a fallible path through
PluginStore::try_new(). Plugin cache subpaths now useAbsolutePathBuf::join()instead of re-absolutizing derived absolute paths.