Skip to content

Herdr mod: tackroom Crons panel - #229

Merged
yourconscience merged 8 commits into
mainfrom
feat/herdr-mod
Nov 13, 2026
Merged

yourconscience merged 8 commits into
mainfrom
feat/herdr-mod

Conversation

@yourconscience

@yourconscience yourconscience commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #228 (the cron action verbs). Retarget to main after #228 merges.

Herdr mods can't host a web view, so the web Crons tab can't be embedded. This adds a native Herdr panel that reads the same tackroom cron collect JSON and acts through the same tackroom cron run|pause|resume code, so both windows show and do the same things.

What's here

  • herdr/mods/tackroom/: the mod (main.js, mod.json, crons.svg) and its RECIPE.md in Herdr's sharing format. It shows host health, needs attention, per-host job lists, details with Run now / Pause / Resume, and a button that opens the web view with its saved token.
  • docs/herdr.md: the design. One contract, two renderers, no session or token in the mod. Phase 2 moves health, names and schedule wording into the collect JSON so both sides stop duplicating them, then adds schedule editing and tackroom herdr install. Phase 3 brings the other tabs.

Verified

Not covered yet

  • Clicking a row and the buttons inside the Herdr window: herdr-app can screenshot but not click, so expand and Run now in the panel are untested. The commands underneath are tested.
  • No preview.png: my only screenshots show a real machine's job names. One from demo data is needed before tagging the repo herdr-mod.

Summary by Sourcery

Add a native Herdr Crons panel backed by the same collected data and actions as the web view.

New Features:

  • Add a native Herdr Crons panel and layout integration for viewing scheduled jobs across hosts and running, pausing, or resuming supported jobs.
  • Provide Herdr installation recipes and configuration guidance for integrating the panel into custom or bundled layouts.

Enhancements:

  • Centralize cron health classification, short names, and human-readable schedules in collected JSON so the web view and Herdr panel share one data contract.

Documentation:

  • Document the Herdr integration, layout design, usage, and planned phases.
  • Expand the project README and website to describe the Crons functionality and Herdr panel.

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add shared health, short-name and schedule-text fields to cron collection results so both renderers use the same derived job data.

  • internal/app/crons.go L64-68, L143-145
  • internal/app/crons_words.go L1-299

API

Expose the enriched cron data through the existing web Crons interface and use the CLI action verbs for Herdr panel actions.

  • herdr/mods/tackroom/main.js L1-207
  • internal/app/web/app.js L746-749 (+16 small edits)

UI

Add a Herdr Crons toggle, layout, and panel presentation for host status, job details, actions, and opening the web view.

  • herdr/layouts/tackroom.json L1-219
  • herdr/layouts/tackroom.svg L1-14
  • herdr/mods/tackroom-toggle/main.js L1-34
  • herdr/mods/tackroom-toggle/mod.json L1
  • herdr/mods/tackroom/crons.svg L1
  • herdr/mods/tackroom/mod.json L1

Configuration

Ignore generated or local Herdr artifacts introduced by the panel work.

  • .gitignore L19-22

Documentation

Document the Herdr panel design, installation recipes, user-facing integration, and the cron feature on the project site.

  • README.md L163-176, L269-270
  • docs/herdr.md L1-31
  • docs/site/index.html L232-235, L569-580
  • herdr/RECIPE.md L1-36
  • herdr/mods/tackroom/RECIPE.md L1-42

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: 59e9c170-ba16-4554-88e2-0ef3dd790311
  • 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:51:12.322200Z
We couldn’t complete this review. Comment @codex review to try again.
34576fa 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 7 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="herdr/mods/tackroom/main.js" line_range="154" />
<code_context>
+    this.busy = key(job);
+    cx.notify();
+    cx.spawn(async (cx) => {
+      const r = await this.tackroom(["cron", verb, "--host", job.host, "--source", job.source, job.id], 120000);
+      this.busy = "";
+      if (r.code === 0) notify({ title: `${DONE[verb]} ${shortName(job)}`, level: "success", timeout: 3000 });
</code_context>
<issue_to_address>
**Action failures leave buttons disabled**

When the action command rejects, such as when it cannot start or times out, `act` exits before clearing `this.busy`, notifying the user, or refreshing the panel, so the action buttons remain disabled and the failure is not reported.

Handle rejected actions with a catch and clear `this.busy` and refresh the panel in a finally block.
</issue_to_address>

### Comment 2
<location path="herdr/mods/tackroom/main.js" line_range="133" />
<code_context>
+  }
+
+  load(cx) {
+    if (this.loading) return;
+    this.loading = true;
+    cx.notify();
</code_context>
<issue_to_address>
**Panel keeps pre-action job state**

When a collect started before an action is still running when the action completes, `act` calls `load`, but `load` returns at the `this.loading` guard; the in-flight collect can then commit its pre-action result, leaving the panel stale until a later refresh.

Queue a follow-up collect when a refresh is requested while another collect is running.

Also at `herdr/mods/tackroom/main.js:158`.
</issue_to_address>

### Comment 3
<location path="herdr/mods/tackroom/main.js" line_range="62" />
<code_context>
+// which launchd may have expanded into many entries.
+function describe(j) {
+  if (j.state === "service") return "Always on";
+  const s = j.declared_schedule || j.schedule || "";
+  const every = /^every (\d+)s$/.exec(s);
+  if (every) return `Every ${duration(Number(every[1]))}`;
</code_context>
<issue_to_address>
**Schedules omit their time zone**

When a job's time zone differs from the viewer's local time zone, `describe` formats the scheduled time without the zone suffix that the web view adds, so the Herdr panel shows an ambiguous time that users can mistake for local time.

Append the job's time zone to Herdr schedule descriptions when it differs from the viewer's local time zone.

Also at `herdr/mods/tackroom/main.js:20-26`, `herdr/mods/tackroom/main.js:28-33`, `herdr/mods/tackroom/main.js:78-80`.
</issue_to_address>

### Comment 4
<location path="herdr/mods/tackroom/main.js" line_range="62" />
<code_context>
+// which launchd may have expanded into many entries.
+function describe(j) {
+  if (j.state === "service") return "Always on";
+  const s = j.declared_schedule || j.schedule || "";
+  const every = /^every (\d+)s$/.exec(s);
+  if (every) return `Every ${duration(Number(every[1]))}`;
</code_context>
<issue_to_address>
**Panels show different schedules**

When an owned job's declared schedule differs from the schedule reported by launchd, `describe` prefers `declared_schedule`, while the web view formats `schedule`, so the panels show different schedule text for the same job.

Format `schedule` in `describe` to match the web view.
</issue_to_address>

### Comment 5
<location path="herdr/mods/tackroom/main.js" line_range="164" />
<code_context>
+
+  // The running `tackroom view`, signed in with the token it saved.
+  openWeb() {
+    exec("/bin/sh", ["-c", 'd="${XDG_STATE_HOME:-$HOME/.local/state}/tackroom"; open "http://$(tr -d "\\n" < "$d/view.addr")/?token=$(tr -d "\\n" < "$d/view.token")#crons"']);
+  }
+
</code_context>
<issue_to_address>
**Web button opens the wrong view**

When the running view was started with a non-default `--token-file`, `openWeb` reads `view.addr` and `view.token` only from the default state directory, so the button uses a missing or stale address or token instead of opening the running view.

Have `openWeb` read the address and token paths associated with the running view, including its configured token-file path.

Also at `herdr/mods/tackroom/main.js:165`.
</issue_to_address>

### Comment 6
<location path="herdr/mods/tackroom/main.js" line_range="250-251" />
<code_context>
+      ["Schedule", j.declared_schedule || j.schedule], ["Last run", j.last_run], ["Result", result]].filter(([, v]) => v);
+    const busy = this.busy === key(j) || this.busy !== "" || this.loading;
+    const acts = j.source === "launchd" && j.unit
+      ? (PAUSED.includes(j.state) ? [["resume", "Resume"]] : [["run", "Run now"], ["pause", "Pause"]])
+      : [];
+    const lines = [
+      ...(j.problems ?? []).map((p) => div().text_color(t.ansi1).child(p)),
</code_context>
<issue_to_address>
**Paused jobs offer different actions**

When a job's state is `paused`, `PAUSED.includes(j.state)` offers only Resume for paused jobs, while the web Crons tab offers Run now and Pause for that same state; callers therefore see different available actions in the two panels.

Match the web tab's action eligibility for `paused`, or update both renderers to the intended shared behavior.
</issue_to_address>

### Comment 7
<location path="herdr/mods/tackroom/main.js" line_range="51" />
<code_context>
+  if (field === "*") return [0, 1, 2, 3, 4, 5, 6];
+  const out = [];
+  for (const part of field.split(",")) {
+    const m = /^(\d+)(?:-(\d+))?$/.exec(part);
+    if (!m) return null;
+    for (let d = Number(m[1]); d <= Number(m[2] ?? m[1]); d++) out.push(d % 7);
</code_context>
<issue_to_address>
**Stepped weekdays stay as cron text**

When a schedule uses a stepped weekday field, `weekdays` rejects stepped fields, so `describe` falls back to raw cron text instead of naming the run days as the web formatter does.

Extend `weekdays` to parse stepped weekday fields consistently with the web formatter.

Also at `herdr/mods/tackroom/main.js:62-80`, `herdr/mods/tackroom/main.js:246`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 7 findings to address first, and the panel can run configured launchd jobs, whose external effects may already have happened before a mistaken run is noticed; reverting the mod cannot undo them. The Web button also puts the saved view token in the URL, so any exposure through browser history survives removing the panel.

Blocking findings: herdr/mods/tackroom/main.js:154, herdr/mods/tackroom/main.js:133, herdr/mods/tackroom/main.js:62, herdr/mods/tackroom/main.js:62, herdr/mods/tackroom/main.js:164, and 2 more


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

Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
Comment thread herdr/mods/tackroom/main.js Resolved
@yourconscience
yourconscience changed the base branch from feat/cron-actions to main November 13, 2026 08:53
@yourconscience
yourconscience merged commit ee7a7d7 into main Nov 13, 2026
8 checks passed
@yourconscience
yourconscience deleted the feat/herdr-mod branch November 13, 2026 10:11
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