-
Notifications
You must be signed in to change notification settings - Fork 0
chore(deps): upgrade clawdbot to v2026.1.20 and add automatic pnpmDepsHash computation #637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -83,6 +83,37 @@ sed_inplace() { | |||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| compute_pnpm_deps_hash() { | ||||||||||||||||||||||||||
| local fake_hash="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" | ||||||||||||||||||||||||||
| local current_hash | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Get current pnpmDepsHash | ||||||||||||||||||||||||||
| current_hash=$(grep 'pnpmDepsHash = "' "$OVERLAY_FILE" | head -1 | sed 's/.*pnpmDepsHash = "\([^"]*\)".*/\1/') | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo " Computing pnpmDepsHash (this requires a build attempt)..." | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Temporarily set fake hash | ||||||||||||||||||||||||||
| sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$fake_hash\";|" "$OVERLAY_FILE" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Run nix build and capture the correct hash from error output | ||||||||||||||||||||||||||
| local build_output correct_hash | ||||||||||||||||||||||||||
| build_output=$(nix build ".#darwinConfigurations.aarch64-darwin.system" --no-link 2>&1 || true) | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Extract the correct hash from "got: sha256-..." line | ||||||||||||||||||||||||||
| correct_hash=$(echo "$build_output" | grep -o 'got:[[:space:]]*sha256-[A-Za-z0-9+/=]*' | head -1 | sed 's/got:[[:space:]]*//') | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ -n "$correct_hash" ]; then | ||||||||||||||||||||||||||
| echo " pnpmDepsHash: $correct_hash" | ||||||||||||||||||||||||||
| sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$correct_hash\";|" "$OVERLAY_FILE" | ||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| # Restore original hash if we couldn't get a new one | ||||||||||||||||||||||||||
| log_warn " Could not determine pnpmDepsHash, restoring original" | ||||||||||||||||||||||||||
| sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$current_hash\";|" "$OVERLAY_FILE" | ||||||||||||||||||||||||||
|
Comment on lines
+109
to
+112
|
||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||
|
Comment on lines
+86
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scope pnpmDepsHash updates to clawdbotSourceOverride only. Line 91 and Lines 96–112 use global 🛠️ Proposed fix (scoped read/write + guard)- current_hash=$(grep 'pnpmDepsHash = "' "$OVERLAY_FILE" | head -1 | sed 's/.*pnpmDepsHash = "\([^"]*\)".*/\1/')
+ current_hash=$(awk '
+ /clawdbotSourceOverride = \{/ { in_src=1 }
+ in_src && /pnpmDepsHash = "/ {
+ match($0, /pnpmDepsHash = "([^"]+)"/, m)
+ print m[1]
+ exit
+ }
+ in_src && /\}/ { in_src=0 }
+ ' "$OVERLAY_FILE")
+ if [ -z "$current_hash" ]; then
+ log_error " pnpmDepsHash not found in clawdbotSourceOverride"
+ return 1
+ fi
@@
- sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$fake_hash\";|" "$OVERLAY_FILE"
+ awk -v new_hash="$fake_hash" '
+ /clawdbotSourceOverride = \{/ { in_src=1 }
+ in_src && /pnpmDepsHash = "sha256-/ {
+ sub(/pnpmDepsHash = "[^"]*"/, "pnpmDepsHash = \"" new_hash "\"")
+ in_src=0
+ }
+ { print }
+ ' "$OVERLAY_FILE" >"$OVERLAY_FILE.tmp" && mv "$OVERLAY_FILE.tmp" "$OVERLAY_FILE"
@@
- sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$correct_hash\";|" "$OVERLAY_FILE"
+ awk -v new_hash="$correct_hash" '
+ /clawdbotSourceOverride = \{/ { in_src=1 }
+ in_src && /pnpmDepsHash = "sha256-/ {
+ sub(/pnpmDepsHash = "[^"]*"/, "pnpmDepsHash = \"" new_hash "\"")
+ in_src=0
+ }
+ { print }
+ ' "$OVERLAY_FILE" >"$OVERLAY_FILE.tmp" && mv "$OVERLAY_FILE.tmp" "$OVERLAY_FILE"
@@
- sed_inplace "s|pnpmDepsHash = \"[^\"]*\";|pnpmDepsHash = \"$current_hash\";|" "$OVERLAY_FILE"
+ awk -v new_hash="$current_hash" '
+ /clawdbotSourceOverride = \{/ { in_src=1 }
+ in_src && /pnpmDepsHash = "sha256-/ {
+ sub(/pnpmDepsHash = "[^"]*"/, "pnpmDepsHash = \"" new_hash "\"")
+ in_src=0
+ }
+ { print }
+ ' "$OVERLAY_FILE" >"$OVERLAY_FILE.tmp" && mv "$OVERLAY_FILE.tmp" "$OVERLAY_FILE"🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+86
to
+115
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # --- Clawdbot upgrade --- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| upgrade_clawdbot() { | ||||||||||||||||||||||||||
|
|
@@ -155,24 +186,43 @@ upgrade_clawdbot() { | |||||||||||||||||||||||||
| sed_inplace "s|# Override clawdbot source to v[^ ]*|# Override clawdbot source to v$version|" "$OVERLAY_FILE" | ||||||||||||||||||||||||||
| sed_inplace "s|# Override clawdbot-app to v[^ ]* |# Override clawdbot-app to v$version |" "$OVERLAY_FILE" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| log_info "✅ clawdbot upgraded from $current_version to $version" | ||||||||||||||||||||||||||
| log_warn "⚠️ Note: pnpmDepsHash may need manual update after first build failure" | ||||||||||||||||||||||||||
| log_warn " Run 'make build' and check for hash mismatch errors" | ||||||||||||||||||||||||||
| # Update pnpmDepsHash automatically | ||||||||||||||||||||||||||
| if compute_pnpm_deps_hash; then | ||||||||||||||||||||||||||
| log_info "✅ clawdbot upgraded from $current_version to $version" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| log_info "✅ clawdbot upgraded from $current_version to $version" | ||||||||||||||||||||||||||
| log_warn "⚠️ pnpmDepsHash may need manual verification" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
+190
to
+195
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The success message "✅ clawdbot upgraded..." is printed twice, once inside the
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+191
to
+196
|
||||||||||||||||||||||||||
| log_info "✅ clawdbot upgraded from $current_version to $version" | |
| else | |
| log_info "✅ clawdbot upgraded from $current_version to $version" | |
| log_warn "⚠️ pnpmDepsHash may need manual verification" | |
| fi | |
| : | |
| else | |
| log_warn "⚠️ pnpmDepsHash may need manual verification" | |
| fi | |
| log_info "✅ clawdbot upgraded from $current_version to $version" |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message was changed from "Unknown overlay:" to "Unknown command:", but the corresponding test in spec/upgrade_overlays_spec.sh (line 45) expects "Unknown overlay: unknown-overlay". This change will cause existing tests to fail. The tests should be updated to match this change in error messaging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compute_pnpm_deps_hash function lacks a comment or docstring explaining its purpose, how it works, and what it returns. Consider adding a header comment similar to other utility functions in the file to improve code documentation and maintainability.