Repository navigation
Herdr mod: tackroom Crons panel - #229
Conversation
Reviewer's GuideData structuresAdd shared health, short-name and schedule-text fields to cron collection results so both renderers use the same derived job data.
APIExpose the enriched cron data through the existing web Crons interface and use the CLI action verbs for Herdr panel actions.
UIAdd a Herdr Crons toggle, layout, and panel presentation for host status, job details, actions, and opening the web view.
ConfigurationIgnore generated or local Herdr artifacts introduced by the panel work.
DocumentationDocument the Herdr panel design, installation recipes, user-facing integration, and the cron feature on the project site.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
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
… entries; README and site
…try; pause fails if the job stays loaded
…nd Herdr panel only draw them
…action always runs, Resume matches the web view
Stacked on #228 (the cron action verbs). Retarget to
mainafter #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 collectJSON and acts through the sametackroom cron run|pause|resumecode, so both windows show and do the same things.What's here
herdr/mods/tackroom/: the mod (main.js,mod.json,crons.svg) and itsRECIPE.mdin 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 andtackroom herdr install. Phase 3 brings the other tabs.Verified
herdr-app check mods/tackroompasses on m1.herdr-app shotshows both hosts, the same health counts and attention list as the web tab, and schedules worded like the web ("Weekdays 11:00", "Mon, Thu 09:00").Not covered yet
herdr-appcan screenshot but not click, so expand and Run now in the panel are untested. The commands underneath are tested.preview.png: my only screenshots show a real machine's job names. One from demo data is needed before tagging the repoherdr-mod.Summary by Sourcery
Add a native Herdr Crons panel backed by the same collected data and actions as the web view.
New Features:
Enhancements:
Documentation: