Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/clawdbot/clawdbot.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-opus-4-5"
"primary": "cliproxy/claude-opus-4-5",

Copilot AI Jan 26, 2026

Copy link

Choose a reason for hiding this comment

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

primary references cliproxy/claude-opus-4-5, but the cliproxy provider model list in this same template only defines claude-opus-4-5-20251101 and claude-opus-4-5-thinking (no claude-opus-4-5). Unless the runtime does aliasing, this will fail model resolution. Update primary (and any related defaults) to use an ID that actually exists in the provider list.

Suggested change
"primary": "cliproxy/claude-opus-4-5",
"primary": "cliproxy/claude-opus-4-5-20251101",

Copilot uses AI. Check for mistakes.
"fallbacks": [
"cliproxy/glm-4.7"
]
},
"workspace": "__HOME__/.clawdbot/workspace",
"thinkingDefault": "high",
Expand Down
2 changes: 1 addition & 1 deletion config/pi/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"providers": {
"cli-proxy-api": {
"baseUrl": "http://localhost:8317/v1",
"apiKey": "dummy",
"apiKey": "CLIPROXY_API_KEY",
"api": "openai-responses",
"models": [
{
Expand Down
33 changes: 29 additions & 4 deletions scripts/update-local-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,35 @@ update_repo() {

# Git pull
log_step " Pulling latest changes..."
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
log_warn " Working tree dirty; resetting to remote (destructive)..."
if ! (
cd "$repo_dir" &&
git fetch --prune 2>&1 &&
upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2>/dev/null || true)" &&
if [ -n "$upstream_ref" ]; then
git reset --hard "$upstream_ref" 2>&1
else
git reset --hard HEAD 2>&1
fi &&
Comment on lines +164 to +174

Copilot AI Jan 26, 2026

Copy link

Choose a reason for hiding this comment

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

The dirty-working-tree path performs a destructive reset/clean even when the repo has no upstream configured (it falls back to git reset --hard HEAD). In that case the script can delete local changes but still fail on the subsequent git pull, and the log message “resetting to remote” becomes inaccurate. Consider only doing the hard reset when an upstream exists; otherwise abort with an explicit error (or require an opt-in flag/env var) before discarding changes.

Copilot uses AI. Check for mistakes.
git clean -fd 2>&1
); then
Comment on lines +164 to +176

Copilot AI Jan 26, 2026

Copy link

Choose a reason for hiding this comment

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

This new “dirty tree → fetch/reset/clean” behavior is significant and currently isn’t covered by the existing shellspec tests for this script (they only grep for git pull). Add a test using a temporary git repo to verify the intended behavior (e.g., dirty tree with upstream gets reset/cleaned, and dirty tree without upstream does not silently discard changes).

Copilot uses AI. Check for mistakes.
log_error " Reset to remote failed"
FAILURES+=("$repo_name (reset failed)")
return 1
Comment on lines +164 to +179

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.

high

The script now performs a destructive reset (git reset --hard and git clean -fd) if the working tree is dirty. While this ensures a clean update, it can lead to data loss for users with uncommitted local changes. It might be beneficial to add an option to skip this destructive step or prompt the user before proceeding, especially since the log_warn message is just a warning and doesn't require user confirmation. Consider making this behavior configurable or adding an interactive prompt.

fi

if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
fi
else
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
Comment on lines +164 to +191

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add an explicit opt‑in before destructive reset/clean.

This change now discards uncommitted changes and untracked files automatically when a repo is dirty. That’s a data‑loss risk for anyone who runs the script without realizing there are local changes. Please gate the reset behind an explicit flag/env var (or prompt) and fail otherwise.

🛡️ Suggested guard
-  if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
-    log_warn "  Working tree dirty; resetting to remote (destructive)..."
+  if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
+    if [ "${UPDATE_LOCAL_BINARIES_FORCE:-}" != "1" ]; then
+      log_warn "  Working tree dirty; skipping reset (set UPDATE_LOCAL_BINARIES_FORCE=1 to discard changes)"
+      FAILURES+=("$repo_name (dirty tree)")
+      return 1
+    fi
+    log_warn "  Working tree dirty; resetting to remote (destructive)..."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
log_warn " Working tree dirty; resetting to remote (destructive)..."
if ! (
cd "$repo_dir" &&
git fetch --prune 2>&1 &&
upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2>/dev/null || true)" &&
if [ -n "$upstream_ref" ]; then
git reset --hard "$upstream_ref" 2>&1
else
git reset --hard HEAD 2>&1
fi &&
git clean -fd 2>&1
); then
log_error " Reset to remote failed"
FAILURES+=("$repo_name (reset failed)")
return 1
fi
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
fi
else
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
if [ "${UPDATE_LOCAL_BINARIES_FORCE:-}" != "1" ]; then
log_warn " Working tree dirty; skipping reset (set UPDATE_LOCAL_BINARIES_FORCE=1 to discard changes)"
FAILURES+=("$repo_name (dirty tree)")
return 1
fi
log_warn " Working tree dirty; resetting to remote (destructive)..."
if ! (
cd "$repo_dir" &&
git fetch --prune 2>&1 &&
upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2>/dev/null || true)" &&
if [ -n "$upstream_ref" ]; then
git reset --hard "$upstream_ref" 2>&1
else
git reset --hard HEAD 2>&1
fi &&
git clean -fd 2>&1
); then
log_error " Reset to remote failed"
FAILURES+=("$repo_name (reset failed)")
return 1
fi
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
fi
else
if ! (cd "$repo_dir" && git pull 2>&1); then
log_error " Git pull failed"
FAILURES+=("$repo_name (git pull failed)")
return 1
fi
🤖 Prompt for AI Agents
In `@scripts/update-local-binaries.sh` around lines 164 - 191, The current logic
in the block that runs inside the repo_dir performs destructive operations (git
reset --hard, git clean -fd) whenever the working tree is dirty; add an explicit
opt-in guard (e.g., an env var like ALLOW_DESTRUCTIVE_RESET or a CLI flag)
before performing the reset/clean in the function that checks repo_dir, and if
the opt-in is not set, skip the destructive steps, log a clear warning via
log_warn/log_error, append the repo to FAILURES (e.g., "$repo_name (dirty, reset
skipped)") and return failure; ensure both the dirty-branch (where reset/clean
currently runs) and the non-dirty branch (git pull) respect this guard so no
destructive action runs without the opt-in.

fi
fi
Comment on lines +164 to 193

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

The git pull command is duplicated in both the if and else branches of the dirty working tree check. This can be refactored to reduce duplication and improve readability by moving the git pull to a single block after the dirty check and reset logic.

  if (cd "$repo_dir" && [ -n "$(git status --porcelain)" ]); then
    log_warn "  Working tree dirty; resetting to remote (destructive)..."
    if ! (
      cd "$repo_dir" &&
        git fetch --prune 2>&1 &&
        upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2>/dev/null || true)" &&
        if [ -n "$upstream_ref" ]; then
          git reset --hard "$upstream_ref" 2>&1
        else
          git reset --hard HEAD 2>&1
        fi &&
        git clean -fd 2>&1
    ); then
      log_error "  Reset to remote failed"
      FAILURES+=("$repo_name (reset failed)")
      return 1
    fi
  fi

  # Attempt git pull after handling dirty state
  if ! (cd "$repo_dir" && git pull 2>&1); then
    log_error "  Git pull failed"
    FAILURES+=("$repo_name (git pull failed)")
    return 1
  fi


# Build
Expand Down
Loading