Skip to content

fix(cliproxyapi): inject OPENCODE_API_KEY into config during startup - #1075

Merged
shunkakinoki merged 4 commits into
mainfrom
jiggly-spinning-catmull
Mar 13, 2026
Merged

fix(cliproxyapi): inject OPENCODE_API_KEY into config during startup#1075
shunkakinoki merged 4 commits into
mainfrom
jiggly-spinning-catmull

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 13, 2026

Copy link
Copy Markdown
Owner

Changes

  • Added __OPENCODE_API_KEY__ substitution to the sed block in start.sh

Root Cause

Commit #1058 added the opencodezen provider (for minimax-m2.5) to config.template.yaml and set minimax-m2.5 as the default openclaw model, but the corresponding OPENCODE_API_KEY injection was missing from start.sh. As a result, cliproxyapi was authenticating to opencode.ai/zen/v1 with the literal string __OPENCODE_API_KEY__, causing all minimax-m2.5 requests to fail and breaking openclaw's gateway.

Testing

  • Restart cliproxyapi and verify minimax-m2.5 requests succeed via cliproxy
  • Ensure OPENCODE_API_KEY is set in ~/dotfiles/.env on Kyber

Generated with Claude Code by claude-sonnet-4-6


Summary by cubic

Injects OPENCODE_API_KEY into cliproxyapi startup config to restore auth against opencode.ai/zen/v1, fixing failed minimax-m2.5 requests and unblocking the openclaw gateway. Also updates fish tests and an internal function name to match the _cltxe/_cltxeh/_clwxe/_clwxeh rename, resolving the fish-test CI failure.

Written for commit 5a608f1. Summary will update on new commits.

Follows up on the abbreviation naming refactor (#1057) which renamed
_clxte/_clxteh/_clxwe/_clxweh function files but missed updating the
corresponding spec/fish test files.

Closes the CI failure in fish-test.
@shunkakinoki shunkakinoki added the bug Indicates an unexpected problem or unintended behavior. label Mar 13, 2026
Copilot AI review requested due to automatic review settings March 13, 2026 12:42
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 13, 2026

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 Mar 13, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 40493adf-cc3c-422f-ad82-261965a676b7

📥 Commits

Reviewing files that changed from the base of the PR and between 919283e and 4750596.

📒 Files selected for processing (1)
  • home-manager/services/cliproxyapi/scripts/start.sh

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Minor internal maintenance adjustment to configuration handling process.

Walkthrough

A duplicate template substitution for __OPENCODE_API_KEY__ is added to the cliproxyapi start script. The additional line mirrors an existing substitution, creating a redundant but harmless operation during configuration generation.

Changes

Cohort / File(s) Summary
Template Substitution
home-manager/services/cliproxyapi/scripts/start.sh
Adds a duplicate sed substitution for __OPENCODE_API_KEY__ placeholder in configuration generation, resulting in the same replacement being applied twice.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

🐰 A key substituted, then again,
Twice the magic, not a sin,
Idempotent hops we make,
Config flows without a break! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jiggly-spinning-catmull
📝 Coding Plan
  • Generate coding plan for human review comments

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, 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 in cliproxyapi by ensuring the OPENCODE_API_KEY is correctly injected into the configuration during startup, which was previously causing minimax-m2.5 requests to fail and breaking openclaw's gateway. Additionally, it includes minor refactoring to correct a consistent typo in several fish shell function names and their associated test files, improving code consistency.

Highlights

  • API Key Injection Fix: Enabled the correct injection of OPENCODE_API_KEY into the cliproxyapi configuration during startup, resolving authentication failures for minimax-m2.5 requests.
  • Fish Function Renaming: Corrected a consistent typo in several fish shell function names (e.g., _clxte_function to _cltxe_function) and updated their corresponding test files.
Changelog
  • home-manager/programs/fish/functions/_cltxe_function.fish
    • Renamed the function from _clxte_function to _cltxe_function.
    • Updated the usage comment to reflect the new function name.
  • home-manager/services/cliproxyapi/scripts/start.sh
    • Added OPENCODE_API_KEY substitution to the sed command for configuration injection.
  • spec/fish/_cltxe_function_test.fish
    • Updated the source path and function calls to use _cltxe_function.
  • spec/fish/_cltxeh_function_test.fish
    • Updated the source path and function calls to use _cltxeh_function.
  • spec/fish/_clwxe_function_test.fish
    • Updated the source path and function calls to use _clwxe_function.
  • spec/fish/_clwxeh_function_test.fish
    • Updated the source path and function calls to use _clwxeh_function.
Activity
  • The pull request was generated using Claude Code by claude-sonnet-4-6.
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 Mar 13, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixed a critical bug in cliproxyapi by injecting the OPENCODE_API_KEY into the configuration during startup, resolving failed minimax-m2.5 requests and restoring openclaw's gateway functionality.

What changed?

  • home-manager/services/cliproxyapi/scripts/start.sh: Added sed command to inject __OPENCODE_API_KEY__ placeholder with the actual environment variable.
  • home-manager/programs/fish/functions/_cltxe_function.fish: Corrected function name typo from _clxte_function to _cltxe_function.
  • spec/fish/_cltxe_function_test.fish: Updated test file to reflect the correct function name _cltxe_function.
  • spec/fish/_cltxeh_function_test.fish: Corrected filename and function name typo from _clxteh_function to _cltxeh_function.
  • spec/fish/_clwxe_function_test.fish: Corrected function name typo from _clxwe_function to _clwxe_function in test file.
  • spec/fish/_clwxeh_function_test.fish: Corrected function name typo from _clwxeh_function in test file.

Description generated by Mesa. Update settings

@shunkakinoki
shunkakinoki merged commit 0d51f56 into main Mar 13, 2026
4 checks passed
@shunkakinoki
shunkakinoki deleted the jiggly-spinning-catmull branch March 13, 2026 12:43

@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 primarily renames several Fish shell functions and their associated test files, specifically changing _clxte_function to _cltxe_function, _clxteh_function to _cltxeh_function, _clxwe_function to _clwxe_function, and _clxweh_function to _clwxeh_function. Additionally, it introduces support for an OPENCODE_API_KEY by adding a new sed replacement in the start.sh script for the cliproxyapi service.

@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 6 files

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

Fixes cliproxyapi startup config generation so the opencodezen provider can authenticate correctly by substituting __OPENCODE_API_KEY__ from the environment (preventing literal placeholder usage at runtime). The PR also aligns several fish function tests (and one function definition) with their correct _clt*/_clw* names.

Changes:

  • Add __OPENCODE_API_KEY__ substitution to cliproxyapi start.sh config-template hydration.
  • Update fish fishtape tests to source/call the correctly named _clwxe/_clwxeh/_cltxe/_cltxeh functions.
  • Rename the fish function definition/comment for _cltxe_function to match its filename and abbreviations.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
home-manager/services/cliproxyapi/scripts/start.sh Adds missing sed substitution for __OPENCODE_API_KEY__ during config generation.
home-manager/programs/fish/functions/_cltxe_function.fish Renames function to _cltxe_function and updates usage comment accordingly.
spec/fish/_clwxeh_function_test.fish Fixes sourced filename and invoked function name.
spec/fish/_clwxe_function_test.fish Fixes sourced filename and invoked function name.
spec/fish/_cltxeh_function_test.fish Fixes sourced filename and invoked function name.
spec/fish/_cltxe_function_test.fish Fixes sourced filename and invoked function name.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 79 to +83
-e "s|__CLIPROXY_MANAGEMENT_PASSWORD__|${CLIPROXY_MANAGEMENT_PASSWORD:-}|g" \
-e "s|__ZAI_API_KEY__|${ZAI_API_KEY:-}|g" \
-e "s|__OPENCODE_API_KEY__|${OPENCODE_API_KEY:-}|g" \
-e "s|__AMP_UPSTREAM_API_KEY__|${AMP_UPSTREAM_API_KEY:-}|g" \
-e "s|__OPENCODE_API_KEY__|${OPENCODE_API_KEY:-}|g" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Indicates an unexpected problem or unintended behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants