Skip to content

fix: cliproxyapi services - #446

Merged
shunkakinoki merged 4 commits into
mainfrom
fix/cliproxyapi-services
Dec 25, 2025
Merged

fix: cliproxyapi services#446
shunkakinoki merged 4 commits into
mainfrom
fix/cliproxyapi-services

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Dec 25, 2025

Copy link
Copy Markdown
Owner
  • fix(cliproxyapi): add objectstore to .gitignore and update PATH in default.nix
  • fix(cliproxyapi): update start script path and add new start.sh script
  • fix(cliproxyapi): set HOME environment variable and remove backup auth scripts from start.sh
  • fix(cliproxyapi): ensure config is copied to objectstore for persistence

Summary by cubic

Fix cliproxyapi service startup and config persistence by correcting script paths, environment variables, and copying config to objectstore. Prevents launch failures and ensures config survives restarts.

  • Bug Fixes
    • Point service to scripts/start.sh for ProgramArguments and ExecStart.
    • Set HOME and expand PATH (add coreutils, include /usr/bin).
    • Generate config and copy to objectstore/config/config.yaml for persistence.
    • Remove backup/recover auth script calls from start.sh.
    • Ignore objectstore in .gitignore.

Written for commit 9811f22. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings December 25, 2025 07:31
@mesa-dot-dev

mesa-dot-dev Bot commented Dec 25, 2025

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Dec 25, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Reorganized service startup script structure and updated script references
    • Enhanced environment configuration for service initialization across different operating systems
    • Streamlined file handling and configuration management in the startup process

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Reorganizes cliproxyapi service startup by relocating start script to a scripts subdirectory, updating environment configurations for Darwin and Linux, removing backup/recovery logic, and introducing objectstore directory and config file handling.

Changes

Cohort / File(s) Summary
Git configuration
.gitignore
Added objectstore entry to AI section.
Service configuration
home-manager/services/cliproxyapi/default.nix
Updated start script reference from ./start.sh to ./scripts/start.sh in Darwin (launchd) and Linux (systemd) configs. Expanded Darwin PATH to include pkgs.coreutils and /usr/bin via lib.makeBinPath with pkgs.gnused and pkgs.coreutils. Added HOME environment variable for Darwin.
Startup script
home-manager/services/cliproxyapi/scripts/start.sh
Removed backup/recovery steps (backup-auth.sh, recover-auth.sh) and race-condition handling. Introduced objectstore directory creation (CONFIG_DIR/objectstore/config) and config file copying logic after template processing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Scripts are moved with careful care,
Paths now point to scripts with flair,
Backup steps hop away, goodbye!
Objectstore directories multiply,
Config files copy on the sly!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cliproxyapi-services

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 19a769c and 9811f22.

📒 Files selected for processing (3)
  • .gitignore
  • home-manager/services/cliproxyapi/default.nix
  • home-manager/services/cliproxyapi/scripts/start.sh

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, 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 implements several fixes for the cliproxyapi service, enhancing its stability and configuration management. The changes involve refining the service's environment setup, ensuring critical configuration files are persistently stored, and streamlining the startup process by removing redundant authentication backup mechanisms. These adjustments aim to improve the reliability and maintainability of the cliproxyapi service.

Highlights

  • Script Relocation: The start.sh script for the cliproxyapi service has been moved into a new scripts subdirectory, and all references to its path have been updated accordingly.
  • Environment Configuration: The default.nix configuration for cliproxyapi now explicitly sets the HOME environment variable to /Users/shunkakinoki and expands the PATH to include pkgs.coreutils and /usr/bin.
  • Configuration Persistence: The generated cliproxyapi configuration file is now copied to an objectstore directory ($CONFIG_DIR/objectstore/config/config.yaml) to ensure its persistence across service restarts.
  • Auth Script Removal: The start.sh script has been streamlined by removing calls to backup-auth.sh and recover-auth.sh, indicating these authentication backup/recovery mechanisms are no longer part of the startup process.
  • Git Ignore Update: The .gitignore file has been updated to include objectstore, preventing this directory, which now holds persistent configuration, from being tracked by Git.

🧠 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 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.

@shunkakinoki
shunkakinoki merged commit 8a38e34 into main Dec 25, 2025
27 of 29 checks passed
@shunkakinoki
shunkakinoki deleted the fix/cliproxyapi-services branch December 25, 2025 07:32
@mesa-dot-dev

mesa-dot-dev Bot commented Dec 25, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixes issues with cliproxyapi services by updating configuration, startup scripts, and ensuring persistent storage of configuration.

What changed?

  • fix(cliproxyapi): add objectstore to .gitignore and update PATH in default.nix
  • fix(cliproxyapi): update start script path and add new start.sh script
  • fix(cliproxyapi): set HOME environment variable and remove backup auth scripts from start.sh
  • fix(cliproxyapi): ensure config is copied to objectstore for persistence

Description generated by Mesa. Update settings

@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 aims to fix the cliproxyapi services by updating script paths, environment variables, and configuration handling. The changes are generally moving in the right direction, but I've identified a critical portability issue with a hardcoded home directory path in the Nix configuration for launchd. Additionally, the systemd service configuration is missing a necessary dependency (coreutils), which will likely cause failures on Linux. I've also left a comment regarding a potentially ineffective .gitignore entry for clarity.

];
Environment = {
PATH = "${lib.makeBinPath [ pkgs.gnused ]}:/opt/homebrew/bin:/usr/local/bin";
HOME = "/Users/shunkakinoki";

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.

critical

Hardcoding the HOME environment variable to a specific user's path (/Users/shunkakinoki) makes this configuration non-portable and will cause it to fail for any other user or on a different machine. You should use a variable to dynamically set the correct home directory. In a home-manager module, config.home.homeDirectory is the standard way to reference the user's home directory.

        HOME = config.home.homeDirectory;

]
}";
ExecStart = "${pkgs.bash}/bin/bash ${./start.sh}";
ExecStart = "${pkgs.bash}/bin/bash ${./scripts/start.sh}";

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.

high

The start.sh script uses mkdir and cp, which are provided by coreutils. The PATH for this systemd service doesn't include coreutils, which will likely cause the script to fail on Linux systems. For consistency with the launchd configuration and to ensure the script runs correctly, you should add pkgs.coreutils to the lib.makeBinPath list in the Environment setting for this service.

Comment thread .gitignore
# AI
.claude
.devenv.nix
objectstore

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 objectstore directory appears to be created within $HOME/.cli-proxy-api, which is typically outside the scope of this Git repository. Consequently, this .gitignore entry may not have any effect. If this entry is intended for a local development workflow where an objectstore directory is created at the repository root, consider adding a comment to clarify its purpose. Otherwise, it could be removed to avoid confusion.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +36
# Also copy to objectstore config location (cliproxyapi uses this for persistence)
mkdir -p "$CONFIG_DIR/objectstore/config"
cp "$CONFIG" "$CONFIG_DIR/objectstore/config/config.yaml"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ensure coreutils are in PATH for Linux service

On Linux, systemd.user.services.cliproxyapi sets PATH to only gnused and bash in home-manager/services/cliproxyapi/default.nix, so the new mkdir/cp calls added here will fail with command not found (and set -e will abort startup) unless the template is missing. This regression only affects the systemd service because launchd’s PATH was updated to include coreutils, but the Linux PATH was not, so the service can’t create/copy the objectstore config.

Useful? React with 👍 / 👎.

Copilot AI 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.

Pull request overview

This PR fixes several configuration and path issues in the cliproxyapi service. The changes improve the service's config persistence mechanism by replacing backup/recover auth scripts with direct config copying to an objectstore location, while also updating file paths and environment variables.

  • Updates script paths from ./start.sh to ./scripts/start.sh in service definitions
  • Adds objectstore directory to .gitignore for local development
  • Replaces backup/recover auth script calls with direct config persistence to objectstore

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
.gitignore Adds objectstore directory to prevent tracking local objectstore data
home-manager/services/cliproxyapi/default.nix Updates script paths, adds HOME environment variable, expands PATH with coreutils and /usr/bin for Darwin service
home-manager/services/cliproxyapi/scripts/start.sh Removes backup/recover auth script calls and adds direct config copying to objectstore location for persistence
Comments suppressed due to low confidence (1)

home-manager/services/cliproxyapi/scripts/start.sh:36

  • The config is copied to the objectstore location without checking if the source config file was successfully created or if the copy operation succeeds. If the sed command fails or produces an empty/invalid config, this could silently copy a corrupted config to the persistence location. Consider adding error checking or validation after the sed command and the cp operation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

];
Environment = {
PATH = "${lib.makeBinPath [ pkgs.gnused ]}:/opt/homebrew/bin:/usr/local/bin";
HOME = "/Users/shunkakinoki";

Copilot AI Dec 25, 2025

Copy link

Choose a reason for hiding this comment

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

The HOME environment variable is hardcoded to a specific user path '/Users/shunkakinoki'. This makes the service configuration non-portable and will fail for any other user or system. Consider using a variable or configuration option that can be set per-user or per-deployment, or remove this if it's not strictly necessary.

Suggested change
HOME = "/Users/shunkakinoki";

Copilot uses AI. Check for mistakes.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

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