ClawRouter icon indicating copy to clipboard operation
ClawRouter copied to clipboard

Fix updater cleanup for stale OpenClaw install metadata

Open 0xCheetah1 opened this issue 5 months ago • 1 comments

Summary

  • clean stale ClawRouter records from OpenClaw's legacy plugin install index after a successful update
  • compare legacy metadata against the current ClawRouter package across old and project-scoped npm install layouts
  • leave unrelated legacy plugin metadata untouched

Testing

  • bash -n scripts/update.sh
  • validated on testbed: stale legacy ClawRouter metadata was removed and subsequent openclaw doctor archived the legacy install index without the conflicting metadata warning

Summary by CodeRabbit

  • Bug Fixes
    • Improved the plugin update process with automatic cleanup of stale legacy install metadata to keep local install records consistent with the current installed state.
    • Reaffirmed fixes for safer handling of non-ASCII routing reasoning in proxy debug headers after payment settlement.
    • Reaffirmed upstream proxy fallback behavior (including NO_PROXY/loopback handling) when BLOCKRUN_UPSTREAM_PROXY is unset.
  • Tests
    • Strengthened header sanitization and debug-header parsing test assertions for clarity and robustness.
  • Documentation
    • Refreshed formatting/alignment of “Environment Variables” tables in the main README and configuration docs (content unchanged).

0xCheetah1 avatar Jun 16 '26 10:06 0xCheetah1

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7472f7df-1be7-4674-82d9-02890fc25897

📥 Commits

Reviewing files that changed from the base of the PR and between 9f0374d62bd0d22269fbbcaedf40a38fe4738bff and ea885238a75b9f09dbdf1c0069bb5419f3975b67.

📒 Files selected for processing (1)
  • src/proxy.reasoning-header.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/proxy.reasoning-header.test.ts

📝 Walkthrough

Walkthrough

scripts/update.sh gains a post-cleanup step that runs an inline Node.js snippet to locate and clean stale ClawRouter entries in OpenClaw's legacy plugin install index (~/.openclaw/plugins/installs.json). It scans candidate directories for the current package, compares versions and paths, and atomically rewrites the JSON with outdated records removed. The PR also includes release notes entries confirming proxy fallback and header encoding features, and applies formatting consistency to configuration documentation and proxy-related test code.

Changes

ClawRouter Metadata Cleanup with Supporting Documentation and Formatting

Layer / File(s) Summary
Stale metadata detection and removal
scripts/update.sh
New cleanup step reads ~/.openclaw/plugins/installs.json, identifies the newest ClawRouter package.json by mtime across several candidate directories, and if the legacy installRecords entry has a mismatched path or version, deletes the clawrouter install record and matching plugin array items, updates refreshReason and generatedAtMs, and writes the file back atomically. Exits without modification if the index is absent, no package is found, or the record already matches; any error logs a "Skipped" message.
Release notes and configuration documentation
CHANGELOG.md, README.md, docs/configuration.md
CHANGELOG entries affirm v0.12.208 fix for non-ASCII routing reasoning header crashes via percent-encoding and v0.12.207 support for HTTPS_PROXY/HTTP_PROXY/ALL_PROXY fallback with undici proxy agent. README and docs/configuration environment variable tables are reformatted for alignment consistency while preserving all variable names, defaults, and descriptions.
Proxy and reasoning header code formatting
src/upstream-proxy.ts, src/proxy.reasoning-header.test.ts, test/upstream-proxy.test.ts
Proxy fallback environment variable selection in applyEnvProxyFallback is reformatted to multiline argument list; reasoning header test precondition check is updated from regex to code-point assertion and test callback is reformatted to multiline style; upstream proxy test assertions are wrapped across multiple lines. No functional logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Fix updater cleanup for stale OpenClaw install metadata' directly describes the main change: adding a post-update cleanup step to remove stale ClawRouter records from OpenClaw's install metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

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.

coderabbitai[bot] avatar Jun 16 '26 10:06 coderabbitai[bot]