fix(openclaw): one failed registration no longer costs the others

#915 made registration failures visible (main swallowed them with `|| true` and
reported success). But it returned at the first failure, so every agent after it
went unregistered. In real OpenClaw 2026.9.6 with one registration forced to fail,
batch 2 registered only 1 of the 2 agents that could have succeeded.

Keep registering the rest, name every failure in one message at the end, and
still exit non-zero. Verified against real OpenClaw (node:24, official npm
package): the failure case now registers both good agents and exits 1; the
normal install and the re-run are unchanged. #915's own test still passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael SitarzewskiandClaude Opus 5.5 committed 2026-09-29 17:53:28 -05:00
1 parent a9feb4285f
commit 23d0a68d7b
1 file changed
+8 -1
+8 -1
View File
@@ -954,6 +954,7 @@ install_openclaw() {
local dest; dest="$(resolve_dest openclaw "${HOME}/.openclaw/agency-agents")"
local count=0
local existing_agents=""
local failed_names="" # a string, not an array: bash 3.2 + set -u rejects "${empty[@]}"
[[ -d "$src" ]] || { err "integrations/openclaw missing. Run convert.sh first."; return 1; }
mkdir -p "$dest"
if command -v openclaw >/dev/null 2>&1; then
@@ -980,7 +981,9 @@ install_openclaw() {
if [[ "$existing_agents" != *$'\n'"$name"$'\n'* ]]; then
if ! openclaw agents add "$name" --workspace "$dest/$name" --non-interactive; then
err "OpenClaw: failed to register '$name'; the copied workspace is not active."
return 1
# Keep registering the rest: one bad registration must not cost the others.
failed_names="${failed_names:+$failed_names }$name"
continue
fi
fi
fi
@@ -994,6 +997,10 @@ install_openclaw() {
if command -v openclaw >/dev/null 2>&1; then
warn "OpenClaw: run 'openclaw gateway restart' to activate new agents"
fi
if [[ -n "$failed_names" ]]; then
err "OpenClaw: not registered: $failed_names. Their workspaces are copied; re-run to retry registration."
return 1
fi
}
install_cursor() {