Skip to content

Conversation

@claudio-pi
Copy link
Collaborator

@claudio-pi claudio-pi commented Feb 9, 2026

Summary

  • claudio_save_env now reads existing unmanaged variables (e.g. HASS_TOKEN, ALEXA_SKILL_ID) before rewriting service.env, and re-appends them at the end
  • Prevents silently deleting manually-added env vars during reinstall or update

Test plan

  • Add a custom variable to ~/.claudio/service.env (e.g. HASS_TOKEN="test")
  • Run claudio reinstall or update
  • Verify custom variable survives in service.env

@gemini-code-assist
Copy link

Summary of Changes

Hello @claudio-pi, 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 introduces a crucial improvement to how environment variables are managed within the system. It ensures that any custom, unmanaged environment variables set by the user are retained across configuration updates, thereby preventing unintended data loss and improving the robustness of the system's configuration handling. The change specifically targets the claudio_save_env function to intelligently merge user-defined variables with system-managed ones.

Highlights

  • Environment Variable Preservation: The claudio_save_env function has been enhanced to identify and preserve existing unmanaged environment variables (e.g., HASS_TOKEN, ALEXA_SKILL_ID) from the service.env file before it is rewritten.
  • Prevention of Data Loss: This update prevents the silent deletion of manually added environment variables when the service.env configuration file is regenerated, such as when switching models via commands like /opus or /sonnet.
Changelog
  • lib/config.sh
    • Introduced a managed_keys array to explicitly list environment variables controlled by the system.
    • Added logic within claudio_save_env to read the existing CLAUDIO_ENV_FILE, filter out managed variables, and collect any unmanaged lines.
    • Modified claudio_save_env to append the collected unmanaged variables back to the CLAUDIO_ENV_FILE after all managed variables have been written, ensuring their persistence.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
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.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 implements the preservation of unmanaged environment variables in claudio_save_env, preventing accidental data loss when configuration is updated. The approach of identifying managed keys and preserving everything else is sound. I've added one suggestion to refine the implementation to also preserve user-added comments and blank lines, which improves the user experience and prevents loss of contextual information in the environment file, aligning with our guidelines on preserving user settings in configuration files.

@edgarjs
Copy link
Owner

edgarjs commented Feb 9, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces a mechanism to preserve unmanaged environment variables, comments, and blank lines in service.env when claudio_save_env is executed. The implementation correctly reads the existing file, filters out managed variables, and appends the remaining content back after writing the managed variables. This is a good improvement to prevent accidental data loss during updates or reinstalls.

I have one suggestion to simplify the logic for filtering lines, which will improve code clarity and maintainability.

claudio_save_env previously overwrote the entire service.env with only
its hardcoded list of managed variables, silently deleting any extra
vars (like HASS_TOKEN, ALEXA_SKILL_ID) that were added manually or by
other integrations. Now it reads and preserves unmanaged variables.
Also filter only managed key assignments; keep all other content
(comments, blank lines, custom variables) intact.
The pattern ^(PORT|MODEL|...)= already excludes empty lines and
comments, so the explicit checks for those are redundant.
@claudio-pi claudio-pi force-pushed the fix/preserve-unmanaged-env-vars branch from 6f6467d to e6e43f0 Compare February 9, 2026 09:06
@claudio-pi claudio-pi merged commit 556fcc6 into main Feb 9, 2026
3 checks passed
@claudio-pi claudio-pi deleted the fix/preserve-unmanaged-env-vars branch February 9, 2026 09:12
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.

2 participants