Skip to content

Fix plugin cache panic when cwd is unavailable#18499

Merged
etraut-openai merged 1 commit intomainfrom
etraut/plugin-cache-panic
Apr 19, 2026
Merged

Fix plugin cache panic when cwd is unavailable#18499
etraut-openai merged 1 commit intomainfrom
etraut/plugin-cache-panic

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented Apr 18, 2026

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 consulted current_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 use AbsolutePathBuf::join() instead of re-absolutizing derived absolute paths.

Copy link
Copy Markdown
Collaborator

@xl-openai xl-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@etraut-openai
Copy link
Copy Markdown
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 absolutize(). The fix in that function is the most important part of this PR.

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.

@etraut-openai etraut-openai merged commit e3f44ca into main Apr 19, 2026
35 of 36 checks passed
@etraut-openai etraut-openai deleted the etraut/plugin-cache-panic branch April 19, 2026 02:04
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic: plugin cache root resolution fails when running in a git worktree

2 participants