-
Notifications
You must be signed in to change notification settings - Fork 489
fix: add OpenCode cache volume for version file persistence #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add OpenCode cache volume for version file persistence #465
Conversation
OpenCode stores a version file in ~/.cache/opencode/ which was causing EACCES permission errors. This adds: - Volume mount for ~/.cache/opencode - Entrypoint script to set correct ownership/permissions on the cache directory
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @thesobercoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where the OpenCode CLI was failing due to a missing cache volume, leading to permission errors when trying to access its version file. The solution involves extending the Docker Compose configuration to include the previously overlooked cache directory as a persistent volume and updating the entrypoint script to correctly initialize its permissions. This ensures the OpenCode CLI can operate without encountering file access problems within the containerized environment. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the EACCES error by adding a persistent volume for the OpenCode cache directory. The changes in docker-compose.yml to add the volume and the mount are correct. The docker-entrypoint.sh script is also updated to ensure the directory has the right permissions. I've added one suggestion to simplify the entrypoint script by removing a redundant check, which also helps with maintainability by reducing code duplication.
| if [ ! -d "/home/automaker/.cache/opencode" ]; then | ||
| mkdir -p /home/automaker/.cache/opencode | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if [ ! -d ... ] check is redundant because mkdir -p is idempotent and will not return an error if the directory already exists. You can simplify this block by removing the conditional check. This pattern is repeated multiple times in this script, and applying this simplification would improve readability and maintainability.
| if [ ! -d "/home/automaker/.cache/opencode" ]; then | |
| mkdir -p /home/automaker/.cache/opencode | |
| fi | |
| mkdir -p /home/automaker/.cache/opencode |
Problem
After PR #460 was merged, OpenCode CLI was failing with:
OpenCode uses three XDG directories but PR #460 only mounted two:
~/.local/share/opencode✅ Mounted~/.config/opencode✅ Mounted~/.cache/opencode❌ Missing - stores version fileSolution
automaker-opencode-cachevolume mount for~/.cache/opencode