Skip to content

fix(ops): the cron stops sharing a checkout with humans, and says when it is stale - #122

Merged
cryptolir merged 1 commit into
mainfrom
fix/cron-own-worktree
Aug 11, 2026
Merged

cryptolir merged 1 commit into
mainfrom
fix/cron-own-worktree

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

fix(ops): the cron stops sharing a checkout with humans, and says when it's stale

#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//. 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: Claude Opus 5 [email protected]

…n it's stale

#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: Claude Opus 5 <[email protected]>
@cryptolir
cryptolir merged commit 9842d22 into main Aug 11, 2026
7 of 9 checks passed
@cryptolir
cryptolir deleted the fix/cron-own-worktree branch August 11, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant