Repository navigation
Conversation
These four commands now live only under cronitor jobs. Root invocations fail as unknown commands. discover stays as an alias of jobs sync, and the auto-discover crontab line targets that subcommand even when inherited flags sit between the two words. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
| // sync, list, shell, and dash are only available here. The root command does | ||
| // not keep those names as aliases or hidden forwarders. | ||
| var jobsCmd = &cobra.Command{ | ||
| Use: "jobs", |
There was a problem hiding this comment.
Non-blocking: jobs has no Run/Args, so an unknown subcommand exits 0 and prints the group help on stdout:
$ cronitor jobs snyc /etc/crontab; echo $?
Commands for the cron jobs on this machine.
...
0
The root now rejects sync with exit 1, so a typo under the new path is quieter than the removed path. It also interacts with the documented out=$(cronitor jobs sync --auto file) && printf '%s\n' "$out" | crontab - pattern if someone drops the flags. monitor and issue already exit 1 here; group and auth don't, so the repo is mixed. Consider adding Args: cobra.NoArgs (or a RunE that returns an unknown-command error) so jobs <typo> fails like cronitor <typo>.
| // `jobs discover`, including when inherited flags sit between the two words | ||
| // (`jobs --hostname box sync`). sync is written as discover so | ||
| // IsAutoDiscoverCommand still matches. Flag values are not rewritten. | ||
| func ensureAutoOnJobsSubcommand(args []string) []string { |
There was a problem hiding this comment.
Non-blocking, about the legacy cronitor discover --auto line. I checked whether sync should rewrite it, and I don't think that's needed for this PR:
- Auto-discover has been off by default since 6f51049 (Feb 2020):
noAutoDiscover = true, and--no-auto-discoveris deprecated and hidden. - With that default,
Parse(true)drops any recognized plumbing line. I ran a scratch test throughrunSyncArgswith17 * * * * cronitor discover --auto /etc/crontabin the fixture. A plainjobs sync --autooutput the crontab without the line. Only--no-auto-discover=falsekept it, unrewritten and wrapped asCRONITOR=<key> cronitor discover --auto /etc/crontab. - Old hourly lines also ran
discover --autounder the same default, so they normally removed themselves long ago.
So the only population left is users who pass a hidden, deprecated flag. In that path, a one-line rewrite in Parse (a plumbing line whose command has discover with no preceding jobs gets jobs discover) would be cheap. Key() ignores the command for plumbing lines, so the monitor key stays stable. That's fine as a follow-up.
The PR description's Risks and Breaking-change sections say a later jobs sync "keeps" the old line and tell people to "let sync add the new line". By default, sync removes the line and never adds one. Please fix that wording before it turns into release notes.
Separately, ensureAutoOnJobsSubcommand plus inheritedBoolFlag/inheritedValueFlag is about 120 lines for that same hidden path. The flag tables duplicate RootCmd's persistent flags by hand and will drift when one is added. A new persistent bool flag between jobs and sync would be read as taking a value. The non-jobs discover fallback can't be reached now that the root rejects discover. Consider building the line from the parsed command (or a plain jobs sync to jobs discover replacement) and keeping one test.
| if err != nil || viaAlias != discoverCmd { | ||
| t.Fatalf("jobs discover resolved to %v (%v)", viaAlias, err) | ||
| } | ||
| for _, flag := range []string{"auto", "dry-run", "format", "with-monitored", "silent"} { |
There was a problem hiding this comment.
Non-blocking (tests should be critical only): the layout lock is worth keeping. That means checking that the four subcommands live under jobs, that jobs discover resolves to sync, and that the root rejects the old names. The per-flag Lookup checks for auto/dry-run/format/with-monitored/silent/mcp-instance/mcp/json don't protect anything this PR could break. Reparenting a command can't drop its local flags, and the existing sync tests already exercise those flags through jobs sync. Consider removing this block. The five-case TestCreateAutoDiscoverLineTargetsJobsSubcommand in lib/crontab_test.go could likewise shrink to one or two cases, given the line is only written behind a hidden, deprecated flag.
|
VERDICT: APPROVE Second-model review at head There is no Verification
BlockingNone. Non-blocking
|
cronitor jobs with an unknown subcommand now returns an unknown-command error. The hidden auto-discover line writer only rewrites the jobs subcommand to discover --auto, and the opt-in path writes an old discover --auto line in that form. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
|
VERDICT: APPROVE Re-review at c36328d, covering BlockersNone. What I checked
Non-blocking notes
|
|
Owner triage of the Opus re-review notes (#95 (comment)), at c36328d. I'm skipping all of them for now, with reasons:
CI is green on c36328d and Opus approved, so this PR is ready. It's for the first Monocle major release; not merging. |
|
Interrogate (Grok 4.7 xhigh-fast) IntentThis change puts Auto-discover stays off by default. A normal Findings1. Opt-in rewrite is discarded when the new command is not monitorableSame root cause, two triggers. The intent requires the written crontab to contain Command (review worktree at c36328d; repro is The in-memory command is already Adversary that found it: none. The fan-out seat did not return a report. Verified by running the command above twice on the PR commit. 2. A flag value of
|
|
Follow-up to #95 (comment). The fan-out adversary returned after that comment was posted. Its three reports are the same two findings already there: Re-ran its commands on the review worktree at c36328d: Exit 1. Exit 1. Same discard. The path ends in Exit 1. Written line is still Exit 0. The test passes by recording No new verified finding. Verdict stays FINDINGS. |
Write() saved the original discover --auto line when the rewritten command looked like meta-cron or a cronitor.link host. The jobs subcommand scan also treated a flag value of sync or discover as the subcommand. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
|
Dev-only checks, not committed:
|
|
VERDICT: APPROVE Opus 5.5 Medium review of 85996ac (delta from c36328d, which I approved earlier). The delta only touches What I checked
Notes
|
|
Owner triage of the Opus 5.5 Medium notes on 85996ac (#95 (comment)). I'm skipping all three, with reasons:
|
|
Interrogate (Grok 4.7 xhigh-fast) IntentThis change puts Auto-discover stays off by default. A normal Scoped to Findings1. A combined short flag still takes a
|
|
Interrogate (Grok 4.7 xhigh-fast) This replaces #95 (comment). Adversary IntentThis change puts Auto-discover stays off by default. A normal Scoped to Findings1. A combined short flag still takes a
|
|
Addendum to #95 (comment). Adversary Its five reports:
FINDINGS |
The hidden --no-auto-discover=false path was scanning the old line's tokens. Short clusters, flag values named sync, and a crontab path named job, jobs, or auto each broke that scan. Remove the recognized line and emit one shell-quoted jobs discover --auto line from the resolved path and flags this sync already parsed. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
|
VERDICT: REQUEST CHANGES Opus 5.5 Medium review of Dropping the argv token rewrite fixes both bugs from the earlier interrogate round. Flags now come from parsed values, not argv positions, so I tested with a scratch test that I did not commit. It calls Blocking
Non-blocking
|
|
Interrogate (Grok 4.7 xhigh-fast) IntentAt f436533 this branch moves FindingsBare
|
Auto-discover has been off since 2020, and rewriting that legacy line kept breaking. jobs sync still drops an active discover --auto line, leaves a commented-out one unchanged, and says so once on stderr. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
|
Addendum to #95 (comment) Interrogate flags and sync reported more cases after that comment. Re-ran each one twice on the f436533 binary. Two are new failures. The name and ignore leak is the same behavior master already has. Findings
|
|
VERDICT: REQUEST CHANGES Opus 5.5 Medium review of Both blocking items from my last review are fixed, because the commit no longer writes an auto-discover line at all:
Last round's non-blocking items 3, 4, and 6 no longer apply. The Dockerfile CMD ( The remaining problem is the one you asked me to check: the recognizer can remove user lines it shouldn't. I tested with a scratch test that calls Blocking
Non-blocking
|
|
Interrogate (Grok 4.7 xhigh-fast) Scoped to 760790e. Two adversaries, both Grok 4.7 xhigh-fast, each in its own worktree. Every finding below was re-run here; the second run matched the first. Intent
The hidden Findings1.
|
The substring check deleted user jobs that merely mentioned discover and --auto. Recognize the old CLI line by tokens: an optional cronitor exec wrapper, a cronitor binary, optional global flags, an optional jobs, then discover and the word --auto. A pending name or ignore comment is cleared when that line is removed. Co-authored-by: August Flanagan <aflanagan@users.noreply.github.com>
Opus 5.5 Medium review (delta)SHA: Previous blockers (comment 6831997131): fixed
Legacy forms still removed (probe at HEAD)
BlockersNone. Non-blocking notes
Dropped (pre-existing)
Verification
|
|
Interrogate (Grok 4.7 xhigh-fast) Reviewed Verdict: FINDINGS Three passes: Parse/Write of 172 crontab cases against master; the same set with a passwd user named Findings1.
|
Plan
sync(aliasdiscover),list,shell, anddashmove under a new top-leveljobscommand.ping,exec, and every other command stay at the root. This is a clean break: no root aliases, hidden forwarders, or deprecation shims.Files:
cmd/jobs.goaddsjobsand documents the four subcommands.cmd/discover.go,cmd/list.go,cmd/shell.go, andcmd/dash.goreparent those commands and update help, examples, the dry-run rerun hint, and the systemdExecStartcomment.jobsusescobra.NoArgs, so an unknown subcommand fails instead of printing help and exiting 0. Barecronitor jobsstill prints help.cmd/configure.gopoints the saved-config hint atcronitor jobs sync.lib/crontab.godoes not write an auto-discover line. Auto-discover has been off by default since 2020, and this major release removes the hidden--no-auto-discoveropt-in.jobs syncremoves an active line only when it is the old installed plumbing: optional run-as user, optionalcronitor exec <key>, acronitorbinary, optional global flags, optionaljobs, thendiscoverand the whole word--auto. It does not add a replacement. A commented-out copy of that line is left unchanged. A# Name:or# cronitor: ignoreabove the removed line is not applied to the next job. When sync removes a line, it prints one notice to stderr.README.md,docs/MCP_INTEGRATION.md,docs/MCP_PROMPTS.md,docs/IP-ACCESS-RESTRICTIONS.md,dockerfile,web/src/components/Docs.js, bats tests, the shell-shim fixtures, and the Go tests that invoke the old paths.docs/releases/*.mdis unchanged.Tests:
cmd/jobs_test.golocks the layout: the four subcommands live underjobs,jobs discoverresolves to sync, the root rejectssync,discover,list,shell, anddash, andjobs not-a-commandis an unknown command.TestLegacyAutoDiscoverLinechecks that installed legacy lines are removed (a cronitor binary,jobs discover, anexecwrapper, a global flag, and a run-as user), that user jobs which only resemblediscover --autostay, and that a# Name:or# cronitor: ignoreabove the removed line does not carry onto the next job.Risks:
cronitor discover --autocrontab lines call commands that no longer exist.jobs syncremoves that old plumbing line. It does not install a replacement. The hidden auto-discover opt-in is removed in this major release.cronitor dashinto a launcher. Whichever of these two lands second needs a rebase, and that launcher belongs atjobs dash.Command mapping
cronitor synccronitor jobs synccronitor discovercronitor jobs discover(alias ofjobs synconly)cronitor listcronitor jobs listcronitor shellcronitor jobs shellcronitor dashcronitor jobs dashFlags are unchanged, except the hidden
--no-auto-discoverflag, which is removed.jobs dash --mcp-instanceand the legacyjobs dash --mcpstay.cronitor execandcronitor pingcrontab lines are unaffected.Breaking change
Intended for the first Monocle major release. There are no compatibility aliases.
What breaks:
cronitor sync,cronitor discover,cronitor list,cronitor shell, orcronitor dash, including pipelines such ascronitor sync --auto file | crontab -. Those invocations fail with Cobra's normal unknown-command error.cronitor jobs <typo>fails the same way.cronitor discover --auto ...no longer run, becausediscoveris not a root command. Auto-discover has been off by default since 2020. The hidden--no-auto-discoveropt-in is removed in this major release.cronitor jobs syncremoves an active recognizeddiscover --autoline, leaves a commented-out one unchanged, and does not add a replacement. An old line that still sayscronitor discover --auto --no-auto-discover=falsefails as an unknown command, not an unknown flag.cronitor dash --mcp-instance .... The args become["jobs", "dash", "--mcp-instance", "..."].CMDthat named the old paths. This repo's README, MCP docs, dashboard copy, anddockerfileare updated here.jobs sync --autostill prints the original crontab on failure, the same as 33.16.Release notes
cronitor dashmust becomecronitor jobs dash.Pull request #89
Do not merge this onto #89 or the reverse without a rebase. #89 splits the dashboard into
crontab-dashboardand turnscronitor dashinto a launcher. After both land, that launcher should becronitor jobs dash, not a rootdash.Dev-only checks
cd web && npm ci && npm run buildsucceeded.web/static/is gitignored and is rebuilt in CI.go build ./...succeeded.go test ./...passed on this revision, includingTestCompat_LogPresignAndUploadFromExec.cronitor jobsprints help and exits 0.cronitor jobs not-a-commandprintsunknown commandand exits 1.go vet ./...still fails on the pre-existing unkeyedTimezoneLocationNameliteral incmd/root.go. This change does not touch that line.bats tests/test-list.batspassed 1 and skipped 1 on Linux. The suite needs root becausetests/setup_suite.bashwrites/etc/cronitor.tests/test-discover.batsis updated and was not run against the live Cronitor API.Dropped from the committed tests, checked while developing:
--auto,--dry-run,--format,--with-monitored,--silent; dash--mcp-instanceand--mcp; list--json.Website docs to update
gh api repos/cronitorio/cronitorreturns 404 for this token, so these are the published markdown pages that still name the old commands. No docs PR was opened.docs/using-cronitor-cli.md—cronitor sync,list,shell,dash, andcronitor dash --mcp-instancedocs/agent-quickstart.md—cronitor syncdocs/sdks.md—cronitor syncdocs/mcp-server.md— nameslistandsyncas local runtime commandsguides/cron-jobs.md—cronitor sync,cronitor discover, and the FAQ that says the alias is top-levelguides/windows-scheduled-tasks.md—cronitor syncguides/cron-job-testing.md—cronitor shellguides/running-cron-jobs-inside-a-docker-container.md—cronitor sync --filerisky: yes (conservative): it changes the
dockerfileCMD tojobs dashand the CI test scripts' command names, which is build-adjacent. Otherwise this moves commands underjobsand rewrites the legacy discover line in crontabs. It doesn't touch auth, API keys, secrets, the release or install scripts, or the API surface.