Skip to content

chore: backup - #448

Merged
shunkakinoki merged 18 commits into
mainfrom
cliproxyapi-proper-backup-v2
Dec 25, 2025
Merged

chore: backup#448
shunkakinoki merged 18 commits into
mainfrom
cliproxyapi-proper-backup-v2

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Dec 25, 2025

Copy link
Copy Markdown
Owner

Enhance configuration and scripts to support AWS CLI2 and S3 backups, improve handling of environment variables, and add support for GLM-4.7 and GLM-4.6 models in the OpenAI compatibility section. Update API key management for clarity and optional usage. Remove deprecated entries and enhance model descriptions for better understanding.


Summary by cubic

Adds AWS CLI v2 and S3 backups for CliproxyAPI config, and expands model support to GLM-4.6 (OpenRouter + Z.AI Coding Plan) and GLM-4.7 (Z.AI Coding Plan). Also hardens service restarts and simplifies API key handling.

  • New Features

    • S3 backup via AWS CLI v2; scripts use variable paths.
    • Added GLM-4.6 (OpenRouter + Z.AI Coding Plan) and GLM-4.7 (Z.AI Coding Plan).
    • Introduced zai-coding-plan provider with optional API key.
  • Bug Fixes

    • Added 5s timeout to launchctl restarts; fixed ENV_FILE and command paths for launchd.
    • Cleaned up API key config and removed deprecated entries.
    • Removed KeepAlive from brew-upgrader; rely on StartInterval to avoid stuck processes.

Written for commit 0b03f2d. Summary will update automatically on new commits.

….7 Coding Plan model support in opencode.jsonc
Copilot AI review requested due to automatic review settings December 25, 2025 09:34
@shunkakinoki
shunkakinoki enabled auto-merge (squash) December 25, 2025 09:34
@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.

@shunkakinoki shunkakinoki self-assigned this Dec 25, 2025
@coderabbitai

coderabbitai Bot commented Dec 25, 2025

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This PR modifies multiple configuration and build files: adds timeout wrappers to launchd restart commands in the Makefile, removes a deprecated model entry from cliproxyapi config, restructures opencode configuration with new Z.AI Coding Plan model sections and API key fields, and removes the KeepAlive setting from the brew-upgrader launchd agent.

Changes

Cohort / File(s) Summary
Makefile command wrappers
Makefile
Added 5-second timeout wrappers (timeout 5s) around launchd kickstart commands for 6 services: brew-upgrader, cliproxyapi, code-syncer, dotfiles-updater, neverssl-keepalive, and ollama. Fallback error handling preserved.
cliproxyapi model configuration
config/cliproxyapi/config.yaml
Removed z-ai/glm-4.7 model entry from openai-compatibility models list; z-ai provider block remains unchanged.
opencode model restructuring
config/opencode/opencode.jsonc
Renamed GLM-4.6 entry to include "Z.AI Coding Plan"; added new z-ai/glm-4.7 model entry; introduced new top-level "zai-coding-plan" section with GLM-4.7 variant; added apiKey configuration fields for z-ai and zai-coding-plan providers; reformatted provider option and include arrays to multiline format.
brew-upgrader service configuration
home-manager/services/brew-upgrader/default.nix
Removed KeepAlive = true setting from launchd.agents.brew-upgrader config; other scheduling and logging fields unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 The configs dance in structured rows,
Timeouts tick and KeepAlives go,
GLM models find new homes to stay,
Zai Coding Plans light up the way!
Five seconds wrap the restart call,
Order reigns throughout it all! 🎯

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "chore: backup" is vague and generic, using a non-descriptive term that does not clearly convey the scope or nature of the changeset. Provide a more specific title that captures the primary change, such as 'Add S3 backup support and model configuration updates' to better reflect the substantial changes made.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description directly addresses the changeset, covering AWS CLI2/S3 backups, model additions (GLM-4.7, GLM-4.6), API key management updates, and operational improvements like timeout additions and KeepAlive removal.
✨ 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 cliproxyapi-proper-backup-v2

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • GLM-4: Entity not found: Issue - Could not find referenced Issue.

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 focuses on enhancing the stability of system service management and refining model configurations. It adds timeouts to launchctl commands for improved resilience, updates the opencode configuration for GLM-4.6 and GLM-4.7 models to clarify their sourcing and introduce a dedicated provider, and adjusts the brew-upgrader service's restart policy.

Highlights

  • Service Restart Robustness: Introduced a 5-second timeout to launchctl kickstart commands across various services in the Makefile to prevent potential indefinite hangs during service restarts.
  • GLM Model Configuration Updates: Refined the configuration for GLM-4.6 and GLM-4.7 models within opencode.jsonc, updating their descriptions, removing a deprecated stream option, and establishing a dedicated zai-coding-plan provider for better organization and clarity.
  • Brew-Upgrader Service Behavior: Modified the brew-upgrader launchd agent configuration to remove the KeepAlive setting, meaning the service will no longer automatically restart if it exits unexpectedly.

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

@mesa-dot-dev

mesa-dot-dev Bot commented Dec 25, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Adds AWS CLI v2 and S3 backups for CliproxyAPI, expands AI model support (GLM-4.6/4.7), hardens service restarts, and simplifies API key handling.

What changed?

  • Makefile: Added 5-second timeouts to launchctl kickstart commands for various services.
  • config/cliproxyapi/config.yaml: Removed z-ai/glm-4.7 from openrouter models in the openai-compatibility section.
  • config/opencode/opencode.jsonc: Integrated z-ai/glm-4.7, renamed z-ai/glm-4.6 to "Z.AI Coding Plan", and restructured zai-coding-plan configuration with a top-level apiKey and explicit model definitions.
  • home-manager/services/brew-upgrader/default.nix: Removed KeepAlive = true from the brew-upgrader service, relying on RunAtLoad and StartInterval for execution.

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 introduces several configuration updates. It improves the robustness of launchctl service restarts in the Makefile by adding timeouts. It refactors the AI model configurations in opencode.jsonc and cliproxyapi/config.yaml to add support for new GLM models and clarify API key management. Additionally, it corrects a launchd service configuration for brew-upgrader by removing a conflicting key. My review includes a suggestion to make the new timeouts in the Makefile configurable and points out an inconsistency in a model description in opencode.jsonc.

Comment thread Makefile
launchctl-brew-upgrader: ## Restart brew-upgrader launchd agent.
@echo "🔄 Restarting brew-upgrader..."
@launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true
@timeout 5 launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true

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

Adding a timeout is a good way to prevent the command from hanging. However, hardcoding the timeout value 5 in multiple places makes it harder to maintain. Consider defining a variable for the timeout at the top of the Makefile. This would allow for easy adjustment and ensure consistency across all launchctl targets.

For example:

# At the top of the file
LAUNCHCTL_TIMEOUT ?= 5

# ... in the target
	@timeout $(LAUNCHCTL_TIMEOUT) launchctl kickstart ...

This change would apply to all similar launchctl commands modified in this PR.

"name": "GLM-4.6 (via OpenRouter and Z.AI Coding Plan)"
},
"z-ai/glm-4.7": {
"name": "GLM-4.7 (via OpenRouter and Z.AI Coding Plan)"

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 model description here states that GLM-4.7 is available via OpenRouter. However, the change in config/cliproxyapi/config.yaml removes the z-ai/glm-4.7 model from the openrouter provider configuration. This creates an inconsistency and could be misleading. Please update the description to accurately reflect that the model is available via the Z.AI Coding Plan only.

					"name": "GLM-4.7 (via Z.AI Coding Plan)"

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

1 issue found across 4 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="Makefile">

<violation number="1" location="Makefile:611">
P1: `timeout` is not available by default on macOS. These launchd targets are macOS-specific, but `timeout` is a GNU coreutils command. Consider using `gtimeout` (requires `brew install coreutils`) or a portable alternative like `perl -e &#39;alarm 5; exec @ARGV&#39; launchctl kickstart ...`.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Comment thread Makefile
launchctl-brew-upgrader: ## Restart brew-upgrader launchd agent.
@echo "🔄 Restarting brew-upgrader..."
@launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true
@timeout 5 launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true

@cubic-dev-ai cubic-dev-ai Bot Dec 25, 2025

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.

P1: timeout is not available by default on macOS. These launchd targets are macOS-specific, but timeout is a GNU coreutils command. Consider using gtimeout (requires brew install coreutils) or a portable alternative like perl -e 'alarm 5; exec @ARGV' launchctl kickstart ....

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 611:

<comment>`timeout` is not available by default on macOS. These launchd targets are macOS-specific, but `timeout` is a GNU coreutils command. Consider using `gtimeout` (requires `brew install coreutils`) or a portable alternative like `perl -e &#39;alarm 5; exec @ARGV&#39; launchctl kickstart ...`.</comment>

<file context>
@@ -608,37 +608,37 @@ launchctl: launchctl-brew-upgrader launchctl-cliproxyapi launchctl-code-syncer l
 launchctl-brew-upgrader: ## Restart brew-upgrader launchd agent.
 	@echo &quot;🔄 Restarting brew-upgrader...&quot;
-	@launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true
+	@timeout 5 launchctl kickstart -k gui/$$(id -u)/org.nix-community.home.brew-upgrader || true
 	@echo &quot;✅ brew-upgrader restarted&quot;
 
</file context>
Fix with Cubic

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
config/opencode/opencode.jsonc (1)

210-230: Run Biome formatter to address trailing commas.

Lines 212 and 229 contain trailing commas before closing braces. While JSONC generally allows trailing commas, these specific placements may cause parsing issues in some contexts.

Run the formatter to ensure consistency:

#!/bin/bash
# Format the opencode.jsonc file using Biome
biome format --write config/opencode/opencode.jsonc
📜 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 c31787d and bbde1bd.

📒 Files selected for processing (4)
  • Makefile
  • config/cliproxyapi/config.yaml
  • config/opencode/opencode.jsonc
  • home-manager/services/brew-upgrader/default.nix
💤 Files with no reviewable changes (2)
  • home-manager/services/brew-upgrader/default.nix
  • config/cliproxyapi/config.yaml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx,json,jsonc,md}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Use Biome for code formatting as configured in biome.json

Files:

  • config/opencode/opencode.jsonc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Agent
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: nix-nixos
  • GitHub Check: nix-linux
  • GitHub Check: nix-darwin
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: shellspec
  • GitHub Check: shellcheck
  • GitHub Check: lua-hammerspoon
  • GitHub Check: lua-neovim
  • GitHub Check: lua-neovim-test
🔇 Additional comments (2)
Makefile (1)

611-611: LGTM: Timeout wrapper improves resilience.

Adding 5-second timeouts to launchctl kickstart commands is a good defensive practice that prevents indefinite hangs during service restarts. The timeout duration is reasonable for these operations, and the || true fallback ensures graceful continuation.

Also applies to: 617-617, 623-623, 629-629, 635-635, 641-641

config/opencode/opencode.jsonc (1)

45-50: LGTM: Clear model naming.

The GLM model entries are well-structured with descriptive names that clearly indicate the dual provider support (OpenRouter and Z.AI Coding Plan).

@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 45 to +49
"z-ai/glm-4.6": {
"name": "GLM-4.6 (via OpenRouter)",
"options": {
"stream": false
}
"name": "GLM-4.6 (via OpenRouter and Z.AI Coding Plan)"
},
"z-ai/glm-4.7": {
"name": "GLM-4.7 (via OpenRouter and Z.AI Coding Plan)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add missing openrouter allowlist entry for z-ai/glm-4.7

The new z-ai/glm-4.7 entry is added under the CLIProxyAPI provider, but CLIProxyAPI’s openai-compatibility config only allowlists z-ai/glm-4.6 for the openrouter backend (see config/cliproxyapi/config.yaml under openai-compatibilityopenroutermodels). With that config, selecting z-ai/glm-4.7 via the proxy will be rejected as an unknown model unless you also add it to the openrouter model list or point this entry at the Z-AI provider (glm-4.7).

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 performs maintenance tasks including removing the deprecated KeepAlive property from the brew-upgrader service, reorganizing GLM model configurations to separate standard and coding plan variants, adding timeout protection to launchctl commands, and applying consistent JSON formatting. The changes improve service reliability and model organization.

Key changes:

  • Removed KeepAlive=true from brew-upgrader launchd service configuration
  • Reorganized GLM-4.6 and GLM-4.7 models into separate providers (z-ai and zai-coding-plan)
  • Added 5-second timeout protection to launchctl kickstart commands

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
home-manager/services/brew-upgrader/default.nix Removed deprecated KeepAlive property from launchd service configuration
config/opencode/opencode.jsonc Split z-ai provider into z-ai and zai-coding-plan providers, updated model descriptions, and applied consistent JSON formatting
config/cliproxyapi/config.yaml Removed z-ai/glm-4.7 from OpenRouter configuration as it's now handled by the z-ai provider
Makefile Added timeout protection to all launchctl kickstart commands to prevent hanging

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

Comment on lines +218 to 226
"zai-coding-plan": {
"models": {
"glm-4.6": {
"name": "GLM-4.6 Coding Plan (via Z-AI)"
},
"glm-4.7": {
"name": "GLM-4.7 Coding Plan (via Z-AI)"
}
},

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 zai-coding-plan provider is missing required configuration fields. Based on the pattern used by other providers like cliproxyapi, lmstudio, and ollama, it should include an npm package specification and a baseURL in the options section. Without these fields, the provider may not function correctly.

Copilot uses AI. Check for mistakes.
@@ -198,7 +210,17 @@
"glm-4.6": {
"name": "GLM-4.6 (via Z-AI)",
},

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.

Trailing comma after the last property in the JSON object. This will cause a JSON parsing error in most parsers, although JSONC typically allows trailing commas in arrays and objects.

Copilot uses AI. Check for mistakes.
"name": "GLM-4.6 (via Z-AI)",
},
"zai-coding-plan/glm-4.7": {
},

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.

Trailing comma after the last property in the models object. This will cause a JSON parsing error in most parsers, although JSONC typically allows trailing commas in arrays and objects.

Copilot uses AI. Check for mistakes.
"name": "GLM-4.6 (via OpenRouter and Z.AI Coding Plan)"
},
"z-ai/glm-4.7": {
"name": "GLM-4.7 (via OpenRouter and Z.AI Coding Plan)"

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 model name mentions "via OpenRouter and Z.AI Coding Plan", but z-ai/glm-4.7 was removed from the OpenRouter configuration in config/cliproxyapi/config.yaml. The name should be updated to reflect that this model is only available via Z.AI Coding Plan, not OpenRouter.

Suggested change
"name": "GLM-4.7 (via OpenRouter and Z.AI Coding Plan)"
"name": "GLM-4.7 (via Z.AI Coding Plan)"

Copilot uses AI. Check for mistakes.
Comment on lines +215 to +216
"apiKey": "{env:ZAI_API_KEY}",
}

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.

Trailing comma after the last property in the options object. This will cause a JSON parsing error in most parsers, although JSONC typically allows trailing commas in arrays and objects.

Copilot uses AI. Check for mistakes.
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