Skip to content

Fix: LLM API key configuration and Windows path compatibility (Issues #322, #320)#412

Open
hobostay wants to merge 1 commit intoagentscope-ai:mainfrom
hobostay:main
Open

Fix: LLM API key configuration and Windows path compatibility (Issues #322, #320)#412
hobostay wants to merge 1 commit intoagentscope-ai:mainfrom
hobostay:main

Conversation

@hobostay
Copy link
Copy Markdown
Contributor

Summary

This PR fixes two distinct issues that affect the Manager Agent initialization:

Issue #322: Fix LLM API key configuration for OpenAI-compatible providers

Problem: The start-manager-agent.sh script was using HICLAW_MANAGER_GATEWAY_KEY as the LLM provider's API key in openclaw.json. This is incorrect - HICLAW_MANAGER_GATEWAY_KEY is meant for authenticating with the HiClaw Gateway service itself, while HICLAW_LLM_API_KEY is the API key for the actual LLM provider (Zhipu, OpenAI, etc.).

Impact: Users configuring OpenAI-compatible services (like Zhipu GLM-5-Turbo) would get HTTP 401 errors because the wrong API key was being used.

Fix: Changed both places where the LLM provider's apiKey is set to use HICLAW_LLM_API_KEY first, with HICLAW_MANAGER_GATEWAY_KEY as a fallback:

  • In the existing openclaw.json update flow (line ~464)
  • In the cloud mode overlay (line ~526)
# Before
--arg key "${HICLAW_MANAGER_GATEWAY_KEY}"

# After  
LLM_API_KEY="${HICLAW_LLM_API_KEY:-${HICLAW_MANAGER_GATEWAY_KEY}}"
--arg key "${LLM_API_KEY}"

Issue #320: Fix Windows path format in HOST_ORIGINAL_HOME

Problem: On Windows hosts, the HOST_ORIGINAL_HOME environment variable contains Windows path format like D:\Users\xxx. Linux containers cannot use Windows paths directly when creating symlinks, causing failures like:

ln: failed to create symbolic link 'D:\Users\xxx': No such file or directory

Fix: Added Windows path detection and conversion before symlink creation:

  • Detects Windows paths (drive letter + backslash pattern: C:\, D:\, etc.)
  • Converts to Linux-compatible format: D:\Users\xxx/d/Users/xxx
  • Logs the conversion for debugging

Testing

Both fixes have been validated:

  • LLM API key: Tested with Zhipu GLM-5-Turbo (should work for all OpenAI-compatible providers)
  • Windows path: Verified conversion logic handles edge cases (empty paths, root paths, etc.)

Files Changed

  • manager/scripts/init/start-manager-agent.sh: +20 lines, -2 lines

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

This commit fixes two issues:

1. Issue agentscope-ai#322: Fix LLM API key configuration
   - Previously used HICLAW_MANAGER_GATEWAY_KEY for LLM provider's apiKey
   - Now correctly uses HICLAW_LLM_API_KEY (with fallback to HICLAW_MANAGER_GATEWAY_KEY)
   - This fixes 401 errors when using OpenAI-compatible services like Zhipu GLM-5-Turbo
   - The two keys serve different purposes:
     * HICLAW_LLM_API_KEY: API key for the actual LLM provider
     * HICLAW_MANAGER_GATEWAY_KEY: Auth key for HiClaw Gateway service

2. Issue agentscope-ai#320: Fix Windows path format in HOST_ORIGINAL_HOME
   - Windows paths like "D:\Users\xxx" are invalid in Linux containers
   - Added detection for Windows path format (drive letter + backslash)
   - Convert Windows paths to Linux format: "D:\Users\xxx" → "/d/Users/xxx"
   - This prevents symlink creation failures on Windows hosts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Copy Markdown
Contributor

📊 CI Metrics Report

Summary

Metric Current Baseline Change
LLM Calls 108 178 -70 ↓ -39.3%
Input Tokens 3928749 4375537 -446788 ↓ -10.2%
Output Tokens 19105 43659 -24554 ↓ -56.2%
Total Tokens 3947854 4419196 -471342 ↓ -10.7%

By Role

Role Metric Current Baseline Change
🧠 Manager LLM Calls 108 139 -31 ↓ -22.3%
Input Tokens 3928749 3612053 +316696 ↑ +8.8%
Output Tokens 19105 27064 -7959 ↓ -29.4%
Total Tokens 3947854 3639117 +308737 ↑ +8.5%
🔧 Workers LLM Calls 0 39 -39 ↓ -100.0%
Input Tokens 0 763484 -763484 ↓ -100.0%
Output Tokens 0 16595 -16595 ↓ -100.0%
Total Tokens 0 780079 -780079 ↓ -100.0%

Per-Test Breakdown

Test Mgr Calls Wkr Calls Δ Calls Mgr In Wkr In Mgr Out Wkr Out Δ Tokens Trend
02-create-worker 15 0 +3 ↑ +25.0% 331416 0 1814 0 +90239 ↑ +37.1% ⚠️ regressed
03-assign-task 10 0 -17 ↓ -63.0% 285406 0 1394 0 -259909 ↓ -47.5% ✅ improved
04-human-intervene 14 0 -32 ↓ -69.6% 379731 0 2429 0 -537297 ↓ -58.4% ✅ improved
05-heartbeat 8 0 -4 ↓ -33.3% 261080 0 1988 0 -61979 ↓ -19.1% ✅ improved
06-multi-worker 43 0 +13 ↑ +43.3% 1682365 0 7086 0 +848582 ↑ +100.9% ⚠️ regressed
14-git-collab 18 0 -33 ↓ -64.7% 988751 0 4394 0 -550978 ↓ -35.7% ✅ improved

Trends

4 test(s) improved (fewer LLM calls)
⚠️ 2 test(s) regressed (more LLM calls)


Generated by HiClaw CI on 2026-03-23 13:23:44 UTC


📦 Download debug logs & test artifacts

KNOWN_MODELS=$(cat /opt/hiclaw/configs/known-models.json 2>/dev/null || echo '[]')
# Use HICLAW_LLM_API_KEY for LLM provider API key, fallback to HICLAW_MANAGER_GATEWAY_KEY
# HICLAW_LLM_API_KEY is the actual LLM provider key (e.g., Zhipu, OpenAI), while HICLAW_MANAGER_GATEWAY_KEY
# is for authenticating with the HiClaw Gateway service itself
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

HICLAW_MANAGER_GATEWAY_KEY is also the consumer key configured for the manager on Higress, and it does not need to be changed to the LLM API key

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.

4 participants