Repository navigation
fix(routines): crontab lines short enough for cron to actually run - #827
Merged
Merged
Conversation
The cron line inlined the invoking shell's entire $PATH, producing 2,000+ char lines that macOS (Vixie) cron silently drops. PATH now lives in a per-routine wrapper script (<state dir>/cron-run.sh) that execs `ty run`, and the crontab line just invokes it; lines over 900 chars are refused. Also create the routine's state dir at schedule time — cron.log/launchd.log redirect into it, and a missing dir failed the job before ty started. PATH is deduplicated (and XML-escaped) in the launchd plist too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… raw PATH CI's PATH has duplicate entries, which the plist now collapses. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Root cause
renderCronLineinlined the invoking shell's entire$PATHinto every crontab line, making them 2,000–2,400 chars, and macOS (Vixie) cron silently drops command lines over ~1,000 chars — so those routines never fired. Separately, the line redirected into<state dir>/cron.logwithout ensuring that directory exists, so a missing dir also failed the job beforetyever ran.Fix
InstallSchedulewrites<state dir>/cron-run.sh(0755) that setsPATH(deduplicated) andexecsty run <name>. The crontab line is now<expr> /bin/sh '<wrapper>' >> '<log>' 2>&1 # ty:routine:<name>— ~150 chars regardless of PATH.mkdir -pthe routine state dir at schedule time (both backends; launchd logs there too).ty routines schedule --printnow also prints the wrapper for the cron backend.Tests
PATH→ line stays under the limit, contains noPATH=, points at the wrapper; wrapper carries the PATH./bin/sh: sets PATH (deduped, with a'in it) and execs ty withrun scout.go test ./internal/routine/passes. Ingo test ./..., the only failure isinternal/executorTestEnsureTaskWindow_ExportedEnvVarsReachLiveShellPane. It also fails on this host without this change (it depends on tmux) and is unrelated.After merge: re-run
ty routines schedulefor ayla-scholarships, ayla-volunteering and ik-board-sweep. I did not touch the live crontab.🤖 Generated with Claude Code