Skip to content

Crons tab actions: run, pause, resume and schedule - #228

Merged
yourconscience merged 2 commits into
mainfrom
feat/cron-actions
Nov 13, 2026
Merged

yourconscience merged 2 commits into
mainfrom
feat/cron-actions

Conversation

@yourconscience

@yourconscience yourconscience commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

The Crons tab could only report. This adds the actions people kept doing by hand with launchctl and cron apply.

What changes

  • Crons tab: a launchd job's detail row gets Run now, Pause and Resume. An owned job on the machine the view runs on also gets a schedule field.
  • CLI verbs for the same actions, so scripts and other clients (the Herdr mod in the next PR) don't need the web session:
    tackroom cron run|pause|resume [--host HOST] [--config PATH] ID
    tackroom cron schedule [--config PATH] ID "MIN HOUR DOM MON DOW"
    
  • Scan records carry unit, plist, owned and declared_schedule.
  • docs/crons.md gains a "View actions" section; the non-goal that said the view never changes a job is narrowed.

How it acts

  • Only on a job the last scan reported (view: cached scan, stale_crons otherwise; CLI: collects that host first). Label and plist path come from the scan, never from the request.
  • Run: launchctl kickstart. Pause: disable + bootout, so it stays off across logins and shows as disabled. Resume: enable + bootstrap when not loaded. Remote hosts get the same script through ssh -o BatchMode=yes HOST sh -s, with every argument single-quoted.
  • Schedule: validated like apply, written to crons.jobs.<id>.schedule in the file that declares the job (local overlay first), then cron apply. A paused owned job must be resumed first.
  • Mutations go through the existing authorizeAPI(..., true) CSRF and origin check.
  • launchd only for now; crontab, systemd and the harness schedulers stay read-only.

Verified

  • go build, go vet, go test ./internal/app/ pass.
  • Browser, against a view of this build on m4: Run now (run count 878 to 879), Pause (row shows Paused, leaves the 24-hour strip, Resume offered), Resume (back on the strip).
  • CLI on m1: run on a local job, pause and resume, run on m4 over SSH, and refusals for a remote or non-owned schedule, an invalid expression and an unknown id.
  • Schedule edit on m1's owned x-research with its current expression: manifest rewritten, cron apply reports up to date, plist unchanged.
  • YAML round-trip of a real tackroom.local.yaml: comments and flow lists kept; one blank line dropped.

Not covered

  • The expanded detail row at phone width was not checked; the browser window would not resize. The Crons tab itself was checked at iPhone width.
  • Under a load average around 100 the local probe hits its 2-minute timeout and the host shows not_scanned. That is existing collect behavior, not changed here.

Summary by Sourcery

Enable controlled launchd job management from the Crons view and command line while keeping other scheduler types read-only.

New Features:

  • Add Run now, Pause, Resume, and owned-job schedule editing to the Crons view for launchd jobs.
  • Add CLI commands for running, pausing, resuming, and scheduling supported launchd jobs locally or over SSH.

Enhancements:

  • Extend cron scan records with launchd addressing, ownership, and declared schedule metadata.
  • Restrict mutations to jobs reported by a scan and protect web actions with CSRF and origin checks.

Documentation:

  • Document Crons view actions, CLI verbs, schedule editing, and the narrowed read-only scope.

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Extend cron scan records with launchd targeting metadata and owned-job schedule information, and populate those fields during manifest merging and launchd scanning.

  • internal/app/crons.go L36-60 (+3 small edits)

API

Expose the cron action CLI forms and register the new verbs and web action route.

  • internal/app/app.go L246-248, L572-573
  • internal/app/config_web.go L255-256

Implementation

Implement scan-validated launchd actions locally and over SSH, plus locked schedule edits to the declaring config followed by cron apply.

  • internal/app/crons_actions.go L1-277

UI

Add action controls and owned-job schedule editing to cron detail rows, with styles for the controls and schedule field.

  • internal/app/web/app.js L895-896, L905-933
  • internal/app/web/style.css L275-278

Documentation

Document the new CLI verbs, Crons tab actions, targeting and scheduling behavior, and the narrowed read-only guarantee.

  • README.md L139-140, L145
  • docs/crons.md L3, L110-124, L240
  • skills/tackroom/SKILL.md L41-42, L202

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44d45683-4e7f-4198-b4dd-01500c127fe7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-11T11:44:51.851837Z
We couldn’t complete this review. Comment @codex review to try again.
0fc34e4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 security issue, and 5 other issues

Security issues:

  • Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user data can reach this call site, this is a code injection vulnerability. A malicious actor can inject a malicious script to execute arbitrary code. (link)
Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="internal/app/crons_actions.go" line_range="206" />
<code_context>
+	if err != nil {
+		return "", err
+	}
+	if err := writeFileReplacing(path, string(data)); err != nil {
+		return "", err
+	}
</code_context>
<issue_to_address>
**Private configs become readable**

When a schedule is edited in a config with permissions stricter than 0644, `writeFileReplacing` creates the replacement with mode `0644` and renames it over the original, so other local users can read previously private config contents, including secrets.

Preserve the original file permissions when creating the replacement.
</issue_to_address>

### Comment 2
<location path="internal/app/crons_actions.go" line_range="206" />
<code_context>
+	if err != nil {
+		return "", err
+	}
+	if err := writeFileReplacing(path, string(data)); err != nil {
+		return "", err
+	}
</code_context>
<issue_to_address>
**Concurrent edits lose config changes**

When a config save or schedule edit overlaps another write to the same config, `setOwnedCronSchedule` writes a YAML document it read earlier, so a concurrent config save or schedule edit can overwrite the other change; separate processes can also collide on the same `.tmp` path and make a write fail.

Coordinate all writers across processes and use a unique temporary file for each write.
</issue_to_address>

### Comment 3
<location path="internal/app/crons_actions.go" line_range="37" />
<code_context>
+const launchdActionScript = `d="gui/$(id -u)"
+case "$1" in
+run) launchctl kickstart "$d/$2" ;;
+pause) launchctl disable "$d/$2" && { launchctl bootout "$d/$2" 2>/dev/null || true; } ;;
+resume) launchctl enable "$d/$2" && { launchctl print "$d/$2" >/dev/null 2>&1 || launchctl bootstrap "$d" "$3"; } ;;
+*) echo "unknown action: $1" >&2; exit 2 ;;
</code_context>
<issue_to_address>
**Paused jobs keep running**

When `launchctl disable` succeeds but `launchctl bootout` fails while the job is still loaded, `launchdActionScript` suppresses the `bootout` error, so `runLaunchdAction` reports success and the view reports the job paused even though it remains loaded and can keep running.

Return the `bootout` failure unless the job is already unloaded.
</issue_to_address>

### Comment 4
<location path="internal/app/crons_actions.go" line_range="192-193" />
<code_context>
+	if err != nil {
+		return "", err
+	}
+	if node == nil {
+		path = shared
+		if root, node, err = cronScheduleNode(path, id); err != nil {
+			return "", err
</code_context>
<issue_to_address>
**Schedule edits miss local overrides**

When a local overlay contains the job ID but omits its schedule while the shared config declares it, `setOwnedCronSchedule` falls back to editing the shared entry, but `loadCronsManifest` lets the local entry override it. The effective schedule remains unset, so `cron apply` rejects the edit or omits and can remove the installed job.

Edit or complete the local entry that overrides the shared job instead of editing the shared entry.
</issue_to_address>

### Comment 5
<location path="internal/app/app.go" line_range="572-573" />
<code_context>
 	"  tackroom hook remove [--dry-run] [--agents ...] <query>",
 	"  tackroom cron collect [--hosts local,HOST...] [--table] [--config PATH]",
 	"  tackroom cron apply [--dry-run] [--config PATH]",
+	"  tackroom cron run|pause|resume [--host HOST] [--config PATH] ID",
+	"  tackroom cron schedule [--config PATH] ID \"MIN HOUR DOM MON DOW\"",
 }

</code_context>
<issue_to_address>
**Action commands missing from quick references**

When the new cron action CLI verbs are added while the README and skill command lists remain unchanged, the CLI help and Crons documentation list the new action verbs, but the README and skill quick-reference still list only `collect` and `apply`, so users following those references won't find the new commands.

Add the new cron action forms to the README and skill command lists, keeping the public command references consistent.

Also at `docs/crons.md:117-118`.
</issue_to_address>

### Comment 6
<location path="internal/app/crons_actions.go" line_range="215" />
<code_context>
	out, err := exec.CommandContext(ctx, exe, "cron", "apply", "--config", shared).CombinedOutput()
</code_context>
<issue_to_address>
**security (go.lang.security.audit.dangerous-exec-command):** Detected non-static command inside Command. Audit the input to 'exec.Command'. If unverified user data can reach this call site, this is a code injection vulnerability. A malicious actor can inject a malicious script to execute arbitrary code.

*Source: opengrep*
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 6 findings to address first, and a run action can execute an existing job immediately, and a schedule change is written to config and applied to launchd, so a wrong action or schedule can trigger job effects that persist beyond reverting this code. Reverting would remove the controls, but it cannot undo a run or any effects the job already produced.

Blocking findings: internal/app/crons_actions.go:206, internal/app/crons_actions.go:206, internal/app/crons_actions.go:37, internal/app/crons_actions.go:193, internal/app/app.go:573, and 1 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread internal/app/crons_actions.go Resolved
Comment thread internal/app/crons_actions.go Resolved
Comment thread internal/app/crons_actions.go Resolved
Comment thread internal/app/crons_actions.go Resolved
Comment thread internal/app/app.go Resolved
Comment thread internal/app/crons_actions.go Resolved
@yourconscience
yourconscience merged commit 0544149 into main Nov 13, 2026
6 of 8 checks passed
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