t1266: Add daily OpenClaw auto-update to housekeeping routine#1995
t1266: Add daily OpenClaw auto-update to housekeeping routine#1995marcusquinn merged 2 commits intomainfrom
Conversation
Add check_openclaw_freshness() to auto-update-helper.sh with the same 24h-gated pattern as skill freshness checks. When openclaw CLI is installed, runs 'openclaw update --yes --no-restart' daily, respecting the user's configured channel (beta/dev/stable). - New env vars: AIDEVOPS_OPENCLAW_AUTO_UPDATE, AIDEVOPS_OPENCLAW_FRESHNESS_HOURS - State tracked in auto-update-state.json (last_openclaw_check) - Status display shows OpenClaw version and last check time - Silently skips if openclaw is not installed
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates an automated daily update routine for the OpenClaw CLI into the existing housekeeping script. It ensures OpenClaw stays current by checking for updates every 24 hours, respecting user preferences for update channels and providing configurable options for disabling or adjusting the update frequency. The update status is also made visible through the 'aidevops auto-update status' command. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThis PR adds automated daily OpenClaw update checking to the auto-update-helper script. It implements a 24-hour freshness gate, timestamp tracking, environment-variable configuration for opt-out and freshness interval, and integrates the check into existing update flows while updating status outputs. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Feb 20 02:05:21 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
There was a problem hiding this comment.
Code Review
The pull request introduces daily OpenClaw auto-update functionality to the housekeeping routine, mirroring the existing skill freshness check. The changes include adding a new function check_openclaw_freshness, updating the cmd_check function to call it, and adding relevant environment variables and status output. The implementation generally follows the established patterns for auto-updates within the script. I've identified a few areas for improvement regarding error handling and adherence to the shell scripting style guide.
| # Read last openclaw check timestamp from state file | ||
| local last_openclaw_check="" | ||
| if [[ -f "$STATE_FILE" ]] && command -v jq &>/dev/null; then | ||
| last_openclaw_check=$(jq -r '.last_openclaw_check // empty' "$STATE_FILE" 2>/dev/null || true) |
There was a problem hiding this comment.
The jq command is used here to parse JSON, but its output is then used in a shell if condition. If jq fails (e.g., due to malformed JSON or if the key doesn't exist and // empty is not sufficient), the last_openclaw_check variable might contain an unexpected value or be empty, which could lead to incorrect logic or runtime errors later. While || true is used to guard against set -e, it doesn't ensure the content is valid for subsequent operations. It's better to explicitly check the output of jq for validity.
| last_openclaw_check=$(jq -r '.last_openclaw_check // empty' "$STATE_FILE" 2>/dev/null || true) | |
| last_openclaw_check=$(jq -r '.last_openclaw_check // empty' "$STATE_FILE" 2>/dev/null) | |
| if [[ -z "$last_openclaw_check" || "$last_openclaw_check" == "null" ]]; then | |
| last_openclaw_check="" | |
| fi |
| local -a update_cmd=(openclaw update --yes --no-restart) | ||
| # Check if user has a channel preference in openclaw config | ||
| local openclaw_channel="" | ||
| openclaw_channel=$(openclaw update status 2>/dev/null | grep "Channel" | sed 's/[^a-zA-Z]*Channel[^a-zA-Z]*//' | awk '{print $1}' || true) |
There was a problem hiding this comment.
The sed command used here is quite complex and relies on specific output formatting from openclaw update status. Parsing human-readable output from another command is generally fragile and can break if the output format changes. While the general rules state this is acceptable as a temporary measure with a robust fallback, the current implementation might be brittle. Consider if there's a more robust way to get the channel, perhaps openclaw has a machine-readable output option (e.g., JSON) or a dedicated command for this.
| openclaw_channel=$(openclaw update status 2>/dev/null | grep "Channel" | sed 's/[^a-zA-Z]*Channel[^a-zA-Z]*//' | awk '{print $1}' || true) | |
| openclaw_channel=$(openclaw update status --json 2>/dev/null | jq -r '.channel // empty' || true) |
References
- Parsing human-readable output from another script is acceptable as a temporary measure if a robust fallback mechanism is implemented to mitigate the risk of the output format changing.
| jq --arg ts "$timestamp" \ | ||
| '. + {last_openclaw_check: $ts}' \ | ||
| "$STATE_FILE" >"$tmp_state" 2>/dev/null && mv "$tmp_state" "$STATE_FILE" |
There was a problem hiding this comment.
The jq command here uses 2>/dev/null && mv "$tmp_state" "$STATE_FILE". If the jq command fails (e.g., due to malformed JSON in $STATE_FILE), the mv command will not execute, leaving the $STATE_FILE unchanged. However, the tmp_state file will still be created and then removed by the trap. This is generally fine, but it might be clearer to explicitly handle the jq failure and log a warning if the state file couldn't be updated.
| jq --arg ts "$timestamp" \ | |
| '. + {last_openclaw_check: $ts}' \ | |
| "$STATE_FILE" >"$tmp_state" 2>/dev/null && mv "$tmp_state" "$STATE_FILE" | |
| if jq --arg ts "$timestamp" \ | |
| '. + {last_openclaw_check: $ts}' \ | |
| "$STATE_FILE" >"$tmp_state" 2>/dev/null; then | |
| mv "$tmp_state" "$STATE_FILE" | |
| else | |
| log_warn "Failed to update OpenClaw check timestamp in $STATE_FILE" | |
| fi |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
.agents/scripts/auto-update-helper.sh (4)
350-363: Minor follow-up:update_state()initial document omitslast_openclaw_check: null.When
update_statefirst creates the state file, it seedslast_skill_check: nullbut has no corresponding entry forlast_openclaw_check. All readers handle the missing key gracefully (// empty,// "never"), so this is not a runtime bug — just a small inconsistency worth closing out.♻️ One-liner fix in `update_state` else-branch
'{ enabled: true, last_action: $action, last_version: $version, last_status: $status, last_timestamp: $ts, last_skill_check: null, - skill_updates_applied: 0 + skill_updates_applied: 0, + last_openclaw_check: null }' >"$STATE_FILE"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/auto-update-helper.sh around lines 350 - 363, The initial state document created by update_state is missing the last_openclaw_check key; update the else-branch that writes to STATE_FILE (the jq -n JSON block) to include "last_openclaw_check: null" alongside last_skill_check: null so the seeded document contains both fields (refer to the update_state function and STATE_FILE write site).
350-363: Minor follow-up:update_state()initial document omitslast_openclaw_check: null.When
update_statecreates the state file from scratch (first ever run), it seedslast_skill_check: nullbut has no corresponding entry forlast_openclaw_check. All readers handle the missing key gracefully (// empty,// "never"), so this is not a runtime bug, but it's inconsistent with the pattern established for the skill check.♻️ Optional one-liner fix in `update_state` else-branch
'{ enabled: true, last_action: $action, last_version: $version, last_status: $status, last_timestamp: $ts, last_skill_check: null, - skill_updates_applied: 0 + skill_updates_applied: 0, + last_openclaw_check: null }' >"$STATE_FILE"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/auto-update-helper.sh around lines 350 - 363, The initial state document created by update_state() omits last_openclaw_check, creating an inconsistency with the seeded last_skill_check field; update the else-branch that writes to STATE_FILE so the JSON object also includes "last_openclaw_check": null alongside last_skill_check: null (keep the other keys unchanged) to ensure the initial state is consistent for readers expecting that key.
958-965: Alignment nit —Last OpenClaw check:has one trailing space where peers use three.Last skill check: $last_skill_check ← 3 spaces Skill updates: $skill_updates … ← 6 spaces Last OpenClaw check: $last_openclaw_check ← 1 space ⚠️ OpenClaw version: $openclaw_ver ← 3 spaces🎨 Proposed fix
- echo " Last OpenClaw check: $last_openclaw_check" + echo " Last OpenClaw check: $last_openclaw_check"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/auto-update-helper.sh around lines 958 - 965, Summary: The "Last OpenClaw check:" echo is misaligned (one space) compared to peers which use three spaces; update the echo that prints last_openclaw_check to use the same spacing/column alignment as other status lines. Locate the echo that references the variable last_openclaw_check in the auto-update-helper.sh snippet and change its formatting so there are three spaces after the colon (match the spacing used by "Last skill check:" and "OpenClaw version:"), or switch to a printf-based fixed-width field for consistent alignment across status lines.
958-965: Alignment nit —Last OpenClaw check:has one trailing space where peers use three.Last skill check: $last_skill_check ← 3 spaces Skill updates: $skill_updates … ← 6 spaces Last OpenClaw check: $last_openclaw_check ← 1 space ⚠️ OpenClaw version: $openclaw_ver ← 3 spaces🎨 Proposed fix — pad to match existing column
- echo " Last OpenClaw check: $last_openclaw_check" + echo " Last OpenClaw check: $last_openclaw_check"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/scripts/auto-update-helper.sh around lines 958 - 965, Adjust the spacing in the echo that prints the Last OpenClaw check so the column lines up with the other entries: update the echo using the variable last_openclaw_check (the line that currently reads `echo " Last OpenClaw check: $last_openclaw_check"`) to use three spaces after the colon like the other labels so it aligns with `Last skill check:` and `OpenClaw version:` output.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.agents/scripts/auto-update-helper.sh:
- Around line 541-545: The current channel extraction for openclaw
(openclaw_channel) is brittle and may pass arbitrary tokens to update_cmd;
change the parsing to explicitly whitelist only "stable", "beta", or "dev"
(case-insensitive) when reading output from `openclaw update status`, e.g.,
extract with a regex that matches only those three values and assign to
openclaw_channel; only set update_cmd=(openclaw update --channel
"$openclaw_channel" --yes --no-restart) when openclaw_channel is exactly "beta"
or "dev" (or non-empty and in the whitelist), otherwise leave update_cmd without
--channel so the persisted config is used; also ensure
update_openclaw_check_timestamp is not called unconditionally after a failed
parse — call it only after a successful update invocation or when you
intentionally decided to skip passing a channel.
- Around line 541-545: The channel extraction is fragile and may pass invalid
tokens to update_cmd; modify the logic around the openclaw_channel variable to
validate the extracted value against a whitelist of the three supported channels
("stable", "beta", "dev") before assigning update_cmd, so only those exact
values will set update_cmd=(openclaw update --channel "$openclaw_channel" --yes
--no-restart); if the extracted token is empty or not one of the three, leave
update_cmd unset (fall back to default) and do not call
update_openclaw_check_timestamp based on a bad parse. Use the existing
openclaw_channel variable and update_cmd symbol names to locate and change the
parsing/validation block.
---
Nitpick comments:
In @.agents/scripts/auto-update-helper.sh:
- Around line 350-363: The initial state document created by update_state is
missing the last_openclaw_check key; update the else-branch that writes to
STATE_FILE (the jq -n JSON block) to include "last_openclaw_check: null"
alongside last_skill_check: null so the seeded document contains both fields
(refer to the update_state function and STATE_FILE write site).
- Around line 350-363: The initial state document created by update_state()
omits last_openclaw_check, creating an inconsistency with the seeded
last_skill_check field; update the else-branch that writes to STATE_FILE so the
JSON object also includes "last_openclaw_check": null alongside
last_skill_check: null (keep the other keys unchanged) to ensure the initial
state is consistent for readers expecting that key.
- Around line 958-965: Summary: The "Last OpenClaw check:" echo is misaligned
(one space) compared to peers which use three spaces; update the echo that
prints last_openclaw_check to use the same spacing/column alignment as other
status lines. Locate the echo that references the variable last_openclaw_check
in the auto-update-helper.sh snippet and change its formatting so there are
three spaces after the colon (match the spacing used by "Last skill check:" and
"OpenClaw version:"), or switch to a printf-based fixed-width field for
consistent alignment across status lines.
- Around line 958-965: Adjust the spacing in the echo that prints the Last
OpenClaw check so the column lines up with the other entries: update the echo
using the variable last_openclaw_check (the line that currently reads `echo "
Last OpenClaw check: $last_openclaw_check"`) to use three spaces after the colon
like the other labels so it aligns with `Last skill check:` and `OpenClaw
version:` output.
Prevents garbage from a parse failure being passed to --channel flag, which would fail and burn the 24h gate. Only beta and dev need the explicit flag; stable is the default.
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Fri Feb 20 02:14:58 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |



Summary
check_openclaw_freshness()toauto-update-helper.sh— daily 24h-gated OpenClaw update check, same pattern as the existing skill freshness checkopenclawCLI is not installed (no-op for users without it)openclaw update statusAIDEVOPS_OPENCLAW_AUTO_UPDATE=false; frequency viaAIDEVOPS_OPENCLAW_FRESHNESS_HOURSauto-update-state.json(last_openclaw_check); visible inaidevops auto-update statusTesting
bash -n: syntax OKopenclaw update --yes --no-restartworks correctly (updated 2026.2.15 -> 2026.2.19-2)openclaw update statustable outputCloses #1994
Summary by CodeRabbit
New Features
Documentation