Skip to content

Commit d08efe3

Browse files
author
codejunkie99
committed
fix(openclaw): surface .openclaw-system.md fallback when agents add fails
Addresses codex review P2 on install.sh:103-111. When `openclaw` is on PATH but `agents add --workspace` fails (older forks that don't support the subcommand or flag), the previous failure message told the user to retry the same unsupported command. That left users on older OpenClaw builds without a working setup even though install.sh had already written `.openclaw-system.md` — the exact backward-compat include those builds can use. Now when registration fails (not "already exists"), the installer points at `.openclaw-system.md` with `openclaw --system-prompt-file <abs>` as the fallback, and keeps the retry command as a secondary option. Same change on the "CLI not on PATH" branch, since we can't know what fork the user is about to install. Mirrored in install.ps1 (success, failure, catch, and not-on-PATH branches).
1 parent 192341e commit d08efe3

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

install.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,24 @@ switch ($Adapter) {
117117
} elseif ($ocOutJoined -match '(?i)already exists') {
118118
Write-Host " ✓ already registered (idempotent re-run). run: openclaw --agent $ocAgentName"
119119
} else {
120-
Write-Host " ! 'openclaw agents add' failed (details above). retry manually:"
121-
Write-Host " openclaw agents add `"$ocAgentName`" --workspace `"$ocAbs`""
120+
Write-Host " ! 'openclaw agents add' failed (details above)."
121+
Write-Host " if your OpenClaw fork does not support 'agents add --workspace',"
122+
Write-Host " fall back to the system-prompt include we wrote:"
123+
Write-Host " openclaw --system-prompt-file `"$ocAbs\.openclaw-system.md`""
124+
Write-Host " otherwise retry: openclaw agents add `"$ocAgentName`" --workspace `"$ocAbs`""
122125
}
123126
} catch {
124127
Write-Host " ! 'openclaw agents add' errored: $_"
125-
Write-Host " retry manually:"
126-
Write-Host " openclaw agents add `"$ocAgentName`" --workspace `"$ocAbs`""
128+
Write-Host " fall back to the system-prompt include:"
129+
Write-Host " openclaw --system-prompt-file `"$ocAbs\.openclaw-system.md`""
130+
Write-Host " or retry: openclaw agents add `"$ocAgentName`" --workspace `"$ocAbs`""
127131
}
128132
} else {
129-
Write-Host " ! 'openclaw' CLI not found on PATH. after installing OpenClaw, run:"
133+
Write-Host " ! 'openclaw' CLI not found on PATH. after installing OpenClaw, try:"
130134
Write-Host " openclaw agents add `"$ocAgentName`" --workspace `"$ocAbs`""
131-
Write-Host " then: openclaw --agent $ocAgentName"
135+
Write-Host " openclaw --agent $ocAgentName"
136+
Write-Host " or, on forks without 'agents add', use the system-prompt include:"
137+
Write-Host " openclaw --system-prompt-file `"$ocAbs\.openclaw-system.md`""
132138
}
133139
}
134140
'hermes' {

install.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,18 @@ case "$ADAPTER" in
107107
elif printf '%s' "$OC_OUT" | grep -qi "already exists"; then
108108
echo " ✓ already registered (idempotent re-run). run: openclaw --agent $OC_AGENT_NAME"
109109
else
110-
echo " ! 'openclaw agents add' failed (details above). retry manually:"
111-
echo " openclaw agents add \"$OC_AGENT_NAME\" --workspace \"$OC_ABS\""
110+
echo " ! 'openclaw agents add' failed (details above)."
111+
echo " if your OpenClaw fork does not support 'agents add --workspace',"
112+
echo " fall back to the system-prompt include we wrote:"
113+
echo " openclaw --system-prompt-file \"$OC_ABS/.openclaw-system.md\""
114+
echo " otherwise retry: openclaw agents add \"$OC_AGENT_NAME\" --workspace \"$OC_ABS\""
112115
fi
113116
else
114-
echo " ! 'openclaw' CLI not found on PATH. after installing OpenClaw, run:"
117+
echo " ! 'openclaw' CLI not found on PATH. after installing OpenClaw, try:"
115118
echo " openclaw agents add \"$OC_AGENT_NAME\" --workspace \"$OC_ABS\""
116-
echo " then: openclaw --agent $OC_AGENT_NAME"
119+
echo " openclaw --agent $OC_AGENT_NAME"
120+
echo " or, on forks without 'agents add', use the system-prompt include:"
121+
echo " openclaw --system-prompt-file \"$OC_ABS/.openclaw-system.md\""
117122
fi
118123
;;
119124
hermes)

0 commit comments

Comments
 (0)