brew.sh: work around non-writable cache for lgtm commands.#21791
Merged
MikeMcQuaid merged 1 commit intomainfrom Mar 22, 2026
Merged
brew.sh: work around non-writable cache for lgtm commands.#21791MikeMcQuaid merged 1 commit intomainfrom
MikeMcQuaid merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a workaround in brew.sh for environments where HOMEBREW_CACHE is not writable (e.g., some sandboxed/AI environments), automatically falling back to a repository-local cache and copying any existing API cache to avoid permission-related failures in brew lgtm-related workflows.
Changes:
- Add a cache-writability check in
brew.shforaudit/lgtm/style/tests, falling back to$HOMEBREW_REPOSITORY/tmp/cacheand copyingapi/cache contents. - Add an RSpec integration-style test covering the cache fallback behavior and warning output.
- Remove sandbox setup instructions from
AGENTS.mdthat are now intended to be handled automatically.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Library/Homebrew/brew.sh | Implements the cache fallback + warning + best-effort API cache copy for selected commands. |
| Library/Homebrew/test/dev-cmd/lgtm_spec.rb | Adds a spec that exercises the fallback path by invoking an isolated brew lgtm --help. |
| AGENTS.md | Removes manual sandbox cache-copy instructions now superseded by the script behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Under some e.g. AI sandboxes HOMEBREW_CACHE is not accessible but the current working directory's `tmp` is instead. In those cases, print a warning and automatically copy and use the other cache.
9b5df11 to
884fa74
Compare
Bo98
approved these changes
Mar 21, 2026
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.
Under some e.g. AI sandboxes HOMEBREW_CACHE is not accessible but the current working directory's
tmpis instead. In those cases, print a warning and automatically copy and use the other cache.brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex and manual review/testing/usage.