This repository was archived by the owner on Jul 16, 2026. It is now read-only.
Repository navigation
Conversation
…are queued Cron jobs like `check-pending-questions.py` and `sync-memory.sh` should not interrupt owner-task processing. `cron-gate.sh` defers the wrapped command when `$SUTANDO_WORKSPACE/tasks/*.txt` exists, then exits 0 so the scheduler sees success and the next scheduled fire retries. Usage (from crons.json prompts): bash scripts/cron-gate.sh <name> <command> [args...] - Empty task queue → exec the command - Tasks queued → log a defer message, exit 0 (retry next fire) - No command given → exit 1 with error Resolves SUTANDO_WORKSPACE the same way workspace_default.py does (env var → ~/.sutando/workspace default). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gate in example Now that scripts/cron-gate.sh ships with the repo, the canonical crons.example.json should demonstrate its use for the two crons that compete with owner-task processing. Users who copy this example get deferred execution out of the box. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bassilkhilo-ag2
approved these changes
Jun 5, 2026
bassilkhilo-ag2
left a comment
There was a problem hiding this comment.
Good script. Logic is correct: resolve workspace from SUTANDO_WORKSPACE (with home fallback), count .txt files at depth-1 in tasks/, exec the command if queue is empty or defer with exit 0. The crons.example.json updates demonstrate the usage pattern cleanly. Per CLAUDE.md: this gate correctly targets sub-daily crons only (pending-questions */30, sync-memory */30, cross-node-sync) — daily crons like morning-briefing aren't gated since a skipped daily is unrecoverable until the next day. Approved.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Cron jobs like
check-pending-questions.pyandsync-memory.shshould not compete with owner-task processing.cron-gate.shacts as a gate: if the task queue is non-empty, it defers the wrapped command and exits 0 (so the scheduler sees success and the next scheduled fire retries automatically).Usage (from
crons.jsonprompt strings):Behavior:
execthe wrapped command (transparent pass-through)"N owner task(s) queued — deferring", exit 0Workspace resolution mirrors
workspace_default.py: reads$SUTANDO_WORKSPACE, falls back to~/.sutando/workspace.Test plan
🤖 Generated with Claude Code