Repository navigation
fix(ops): the cron rebased whatever branch the shared checkout was on - #120
Merged
Merged
Conversation
diagnostic-cron.sh pulled $REPO unconditionally with --rebase --autostash. The dashboard checkout immediately below it is already guarded, with the comment "only touch it on main — never yank someone's feature branch out from under them". The checkout the cron RUNS FROM had no such guard, where the consequence is worse: a --rebase there does not merely fail, it rewrites whoever's branch is checked out. Measured today. The 06:00 run found /root/AgentGlob_Apps/openclaw on a local feature branch (docs/status-2026-08-10-session, unpushed, 2 commits), rebased it onto main, hit a STATUS.md conflict, and left the repo detached mid-rebase with an unmerged path. The `|| echo WARN` swallowed it, so the run still looked successful. Every later `git pull` there failed with "needs merge" — about 9 hours, until it was aborted by hand. The scripts kept running from a half-rebased tree the whole time. Recovery was non-destructive (git rebase --abort restored the branch with both commits; its STATUS.md turned out to be identical to main, the work having already landed as #115), but nothing about the failure mode guarantees that — the same conflict on genuinely unmerged work is a worse morning. Now: pull only on main; if detached or mid-rebase, print a loud ERROR with the exact recovery command, because that state means every script below is running from an unknown tree; otherwise skip the pull and say which branch blocked it. Verified all three arms, including that an off-main checkout skips rather than rewrites. This is OB-32's mechanism, one level worse than that entry describes: OB-32 records the cron silently SKIPPING work when a shared checkout is off main. This is the cron actively CORRUPTING the checkout, then reporting success. Co-Authored-By: Claude Opus 5 <[email protected]>
cryptolir
added a commit
that referenced
this pull request
Aug 11, 2026
…n it's stale (#122) #120 stopped this cron from rebasing whoever's branch was checked out in the shared repo. That was the bleeding, not the wound: the cron was still RUNNING from a checkout people work in, so it stayed exposed in both directions. The cure was already in this file, 20 lines lower. $DASH_REPO has been a cron-owned detached worktree since the 53-silent-skip incident, precisely so no human action can disable it. The checkout the cron runs from never got the same treatment. So it now points at .openclaw-autoscan, a worktree nobody edits, re-pinned to origin/main by its own 05:40 crontab line — while nothing is executing from it, because rewriting a script under a running bash is its own bug. That leaves this script read-only against git: fetch to learn where main is, never pull, never branch-switch. And the second half of 2026-08-11 — nobody knew for ~9 hours. #120's guard printed to stdout, so the loud ERROR went to /var/log/agentglob-diag.log and the email still looked normal. Identical silence, new wording. This file has had the right mechanism all along: warn_sync() puts a warning in the email body AND the subject (⚠ SYNC FAILED), built after 53 skipped runs went unread in that same log. The guard now calls it, which meant hoisting warn_sync above the check instead of leaving it defined 15 lines below. Also fixes a bug in #120's guard that would have made it useless in the very worktree it protects: `-d .git/rebase-merge` can never be true there, because `.git` is a FILE in a worktree and rebase state lives under .git/worktrees/<name>/. This file already warns about that trap for $DASH_REPO. Now asks git via `rev-parse --git-path`; confirmed resolving to .git/worktrees/wt-dbg/rebase-merge. Verified all three arms in a real worktree, each checked for the warning reaching SYNC_WARNINGS and not just stdout: - detached at origin/main -> clean - one commit behind (pin died) -> stale WARN with both short SHAs - genuine conflicted rebase -> MID-REBASE WARN + recovery command Co-authored-by: Liran Peretz <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened today
diagnostic-cron.shpulls$REPOunconditionally with--rebase --autostash. The dashboard checkout immediately below it is already guarded — "only touch it on main — never yank someone's feature branch out from under them". The checkout the cron runs from had no such guard, where the consequence is worse: a--rebasethere doesn't merely fail, it rewrites whoever's branch is checked out.The 06:00 run found
/root/AgentGlob_Apps/openclawon a local feature branch (docs/status-2026-08-10-session, unpushed, 2 commits), rebased it onto main, hit aSTATUS.mdconflict, and left the repo detached mid-rebase with an unmerged path. The|| echo WARNswallowed it, so the run still looked successful.Every later
git pullthere failed withneeds merge— for ~9 hours, until aborted by hand. The scripts kept running from a half-rebased tree the whole time. I only found it because a verificationgit pullrefused.Recovery was non-destructive this time (
git rebase --abortrestored the branch with both commits; itsSTATUS.mdturned out identical to main, the work having already landed as #115) — but nothing about the failure mode guarantees that. The same conflict on genuinely unmerged work is a much worse morning.The fix
mainERROR+ the exact recovery commandThe detached/mid-rebase arm is deliberately an ERROR, not a warning: in that state every script below is running from an unknown tree, so "success" is meaningless.
Verified all three arms, including that an off-main checkout skips rather than rewrites.
Relation to OB-32
This is OB-32's mechanism one level worse than that entry describes. OB-32 records the cron silently skipping work when a shared checkout is off main. This is the cron actively corrupting the checkout — and then reporting success.
🤖 Generated with Claude Code