Skip to content

Retrospective: expose management version headers and normalize local build metadata#2948

Open
luyuehm wants to merge 14 commits into
router-for-me:devfrom
luyuehm:pr/cors-build-metadata-2026-04-21
Open

Retrospective: expose management version headers and normalize local build metadata#2948
luyuehm wants to merge 14 commits into
router-for-me:devfrom
luyuehm:pr/cors-build-metadata-2026-04-21

Conversation

@luyuehm
Copy link
Copy Markdown

@luyuehm luyuehm commented Apr 21, 2026

Summary

This is a retrospective PR submitted to the upstream repository to document and review backend release-governance changes that were already validated downstream and released as v2026.04.21.

What changed

Browser-readable version headers

Exposed management response headers for browser clients:

  • X-Cpa-Version
  • X-Cpa-Build-Date
  • X-Cpa-Commit

Local compose rebuild metadata normalization

Prevented local docker compose up -d --build from falling back to:

  • dev
  • unknown
  • none

Local runtime version naming normalization

  • Default: vYYYY.MM.DD
  • Special updates: vYYYY.MM.DD-beta

Validation

  • Rebuilt local docker compose service
  • Verified management response headers:
    • X-Cpa-Version: v2026.04.21
    • X-Cpa-Build-Date: normal UTC timestamp
    • X-Cpa-Commit: current short commit
  • Verified cross-origin frontend header access was restored

Suggested labels

  • retrospective
  • release
  • backend

@github-actions
Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@github-actions github-actions Bot changed the base branch from main to dev April 21, 2026 22:33
Copy link
Copy Markdown

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

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.

Reviewed commit: 0b8c74f78a

ℹ️ 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 thread docker-compose.yml
- "11451:11451"
volumes:
- ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml
- ${CLI_PROXY_CONFIG_PATH:-/Users/macbook/cli-proxy-config/config.yaml}:/CLIProxyAPI/config.yaml:rw
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 Revert machine-specific default config bind path

The new default bind mount uses /Users/macbook/cli-proxy-config/config.yaml, which breaks docker compose up for anyone who has not set CLI_PROXY_CONFIG_PATH and does not have that exact host path. In that case Docker either fails the mount or mounts an unexpected directory at /CLIProxyAPI/config.yaml, causing startup/config read failures; the previous ./config.yaml default was portable across environments.

Useful? React with 👍 / 👎.

set -euo pipefail

HEALTH_URL="${CLI_PROXY_HEALTH_URL:-http://127.0.0.1:8317/health}"
SELF_HEAL_SCRIPT="${CLI_PROXY_SELF_HEAL_SCRIPT:-./scripts/self_heal_example.sh}"
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 Make self-heal path independent of current directory

The heartbeat script defaults CLI_PROXY_SELF_HEAL_SCRIPT to ./scripts/self_heal_example.sh, which is resolved against the caller’s working directory, not this script’s directory. This fails when running as documented via an absolute script path in cron or from any non-repo cwd, so self-heal is skipped even though the companion script exists.

Useful? React with 👍 / 👎.

@luyuehm
Copy link
Copy Markdown
Author

luyuehm commented Apr 21, 2026

Retrospective note:

  • This PR corresponds to release v2026.04.21.
  • The changes were validated downstream first, then released, and are submitted upstream here for audit/review traceability.
  • Suggested labels: retrospective, release, backend.

Copy link
Copy Markdown
Contributor

@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 an OpenClaw-compatible autonomy layer, featuring comprehensive documentation, utility scripts for health monitoring and self-healing, and integration guides for local operations. It also updates the CORS middleware to expose versioning headers. The review feedback highlights a portability issue regarding a hardcoded absolute path in the Docker Compose configuration and suggests improving the self-healing script's effectiveness by using a restart command instead of a conditional up command.

Comment thread docker-compose.yml
- "11451:11451"
volumes:
- ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml
- ${CLI_PROXY_CONFIG_PATH:-/Users/macbook/cli-proxy-config/config.yaml}:/CLIProxyAPI/config.yaml:rw
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

docker-compose.yml 中硬编码了特定用户的绝对路径 /Users/macbook/cli-proxy-config/config.yaml。这会降低配置的可移植性,导致其他开发者在本地运行时需要手动修改此文件。建议恢复为相对路径(如 ./config.yaml)或使用更通用的环境变量默认值。

      - ${CLI_PROXY_CONFIG_PATH:-./config.yaml}:/CLIProxyAPI/config.yaml:rw

SERVICE_NAME="${CLI_PROXY_SERVICE_NAME:-cli-proxy-api}"

$COMPOSE_CMD ps "$SERVICE_NAME" >/dev/null 2>&1 || true
$COMPOSE_CMD up -d "$SERVICE_NAME"
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

docker compose up -d 仅在容器停止或配置更改时才会重新启动容器。如果容器正在运行但内部服务已进入不可用状态(例如死锁或响应超时),该命令可能无法起到“自愈”作用。建议考虑使用 docker compose restart "$SERVICE_NAME" 以确保服务能够真正重启恢复。

Suggested change
$COMPOSE_CMD up -d "$SERVICE_NAME"
$COMPOSE_CMD restart "$SERVICE_NAME"

@luyuehm luyuehm changed the title 追溯审计:暴露管理版本头并修正本地构建元信息 Retrospective: expose management version headers and normalize local build metadata Apr 21, 2026
@luyuehm
Copy link
Copy Markdown
Author

luyuehm commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

@luispater luispater left a comment

Choose a reason for hiding this comment

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

Summary:
This PR introduces an OpenClaw “autonomy layer” (docs + example scripts) and updates CORS to expose build/version headers so browser clients can read X-CPA-* management headers.

Blocking:

  • docker-compose.yml now defaults CLI_PROXY_CONFIG_PATH to /Users/macbook/cli-proxy-config/config.yaml. That is a machine-specific path and will break the default compose experience for most users. Please restore a repo-local default (e.g. ./config.yaml) and keep migration-specific paths in LOCAL_OPERATIONS.md or a local override file.
  • Several docs/READMEs are phrased as “This fork …” and hardcode fork-specific repos (luyuehm/...). Since router-for-me/CLIProxyAPI is not a fork, this is misleading for upstream. Please reword to be repo-agnostic and/or point to the canonical upstream repo, not a personal fork.
  • openclaw/MIGRATION_FROM_CLIPROXYAPIPLUS.md hardcodes /Users/macbook/... paths (including OpenClaw workspace script paths). Please replace these with placeholders (e.g. /path/to/...) and/or environment variables.

Non-blocking:

  • Consider aligning Access-Control-Expose-Headers values with the actual management header names (X-CPA-VERSION, X-CPA-BUILD-DATE, X-CPA-COMMIT) for readability.
  • Translate the remaining English sentence in README_CN.md’s OpenClaw section to keep the Chinese README consistent.
  • Optional: add a small safety guard in scripts/install_openclaw_skill.sh to ensure the computed target is sane before rm -rf.

Test plan:

  • Not run locally (review-only; no checkout).
  • Suggested validation after fixes:
    • go build -o test-output ./cmd/server && rm test-output
    • docker compose config (with no env overrides) to ensure defaults work
    • Verify a management response includes X-CPA-* headers and that responses include Access-Control-Expose-Headers: ... so browsers can read them.

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