Skip to content

fix: change log path to user home and force uvx refresh in install scripts - #443

Merged
julienld merged 2 commits into
masterfrom
fix-log-path-and-install-scripts
Jan 17, 2026
Merged

fix: change log path to user home and force uvx refresh in install scripts#443
julienld merged 2 commits into
masterfrom
fix-log-path-and-install-scripts

Conversation

@julienld

Copy link
Copy Markdown
Member

Description

Fixes issues where users encounter 'Read-only file system' errors because the default log path was relative to the current working directory, which can be read-only in restricted environments like uvx caches.

Also updates installation scripts to force 'uvx' to refresh the package version, ensuring users are not stuck on stale cached versions.

Changes

  • Changed default log file path in UsageLogger to ~/.ha-mcp/logs/mcp_usage.jsonl
  • Added --refresh flag to uvx commands in scripts/install-macos.sh and scripts/install-windows.ps1
  • Added unit test for default log path behavior

Related Issues

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @julienld, 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 critical reliability issues by preventing 'Read-only file system' errors during logging and ensuring that installation processes consistently retrieve the most current package versions. These changes enhance the robustness of the application in diverse deployment environments and improve the user experience by avoiding common installation and runtime failures.

Highlights

  • Log Path Relocation: The default log file path for UsageLogger has been changed to ~/.ha-mcp/logs/mcp_usage.jsonl. This resolves 'Read-only file system' errors encountered in restricted environments by ensuring logs are written to a user-writable location.
  • Forced UVX Refresh: Installation scripts (install-macos.sh and install-windows.ps1) now include the --refresh flag when calling uvx. This guarantees that ha-mcp@latest is always fetched and updated, preventing users from being stuck on stale cached versions.
  • Unit Test for Log Path: A new unit test has been added to verify that the UsageLogger correctly defaults its log file path to the user's home directory when no specific path is provided.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 effectively addresses two distinct issues: ensuring the usage logger can write to a file in restricted environments, and forcing a refresh of the ha-mcp package during installation to prevent using stale cached versions. The changes are well-implemented. The log path is now defaulted to the user's home directory, which is a much safer default. The installation scripts for both macOS and Windows are correctly updated to include the --refresh flag. A new unit test is also added to verify the new default log path, which is great. I have one suggestion to make the new test assertion more precise.

Comment on lines +176 to +177
assert str(logger.log_file_path).startswith(str(Path.home()))
assert ".ha-mcp" in str(logger.log_file_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The assertions here are a bit loose. Using startswith and in could potentially pass for incorrect paths. A direct equality check against the expected Path object would be more precise and robust. This ensures the path is exactly what's expected, including all components.

Suggested change
assert str(logger.log_file_path).startswith(str(Path.home()))
assert ".ha-mcp" in str(logger.log_file_path)
expected_path = Path.home() / ".ha-mcp" / "logs" / "mcp_usage.jsonl"
assert logger.log_file_path == expected_path

@julienld
julienld merged commit f9a5b39 into master Jan 17, 2026
36 checks passed
@julienld
julienld deleted the fix-log-path-and-install-scripts branch January 17, 2026 11:02
cj-elevate pushed a commit to cj-elevate/ha-mcp that referenced this pull request Apr 2, 2026
…ripts (homeassistant-ai#443)

* fix: change default log path to user home dir to avoid read-only errors

* fix: force uvx refresh in install scripts to ensure latest version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OSError: [Errno 30] Read-only file system: 'logs' Read-only file system errors from Claude (macOS)

1 participant