The catch-up window (how late a missed cron occurrence may run instead of being skipped) was
half the job's period, clamped to 120s-2h, for every job. A job can now override it outright:
0-1440 minutes, `0` meaning never catch up.
`grace_minutes` is a real 0, not "unset" — and the obvious write pattern would eat it:
`v in {None, "", False}` (the `workdir` update lambda) and `if value:` both treat `0` as
False in Python. Both doors therefore share `jobs_time.normalize_grace_minutes`, reads test
`is None`, and the renderer formats before testing truthiness.
The override moves the dispatch stamp too: `_classify_dispatch_lateness` and the dispatch
health metric read the same window, so a job the scheduler calls "late" is never reported
overdue by the dashboard.
Refused on `once`/`interval` schedules: the window describes a missed wall clock, and a
duration has none.
Split from the timezone commit so it can be reverted alone.
A job may pin its own IANA timezone; its cron expression is then that zone's wall clock,
independent of the profile's configured timezone. Absent/None inherits the profile, so an
existing jobs.json keeps byte-identical behaviour and needs no migration.
The dispatch path needs the pin as much as the compute does. `compute_next_run()` resolves
the zone as job pin -> profile zone -> base offset, and every site that writes `next_run_at`
now passes it (advance, claim, resume, re-arm, recovery, and the quota/unreachable
planners); one missed site re-fires or skips a slot because the stored instant and the
expression would be read in different zones.
`_evaluate_due_job()` normalizes the stored instant into the JOB's zone, which hands every
downstream cron predicate the job's clock, and a pinned job skips
`_repair_timezone_shifted_cron` outright. That repair exists for jobs that FOLLOW the profile
zone across a zone change: on a pinned job its wall-clock comparison reads a due occurrence
as still-in-the-future and re-anchors past it.
Failing shape this fixes (profile America/Los_Angeles, job 0 9 * * 1-5 pinned to
America/New_York, scanned at 09:00 New York): `get_due_jobs()` returned [] and the job was
re-anchored to the next day, i.e. job zones east of the profile zone silently never fired.
The regression test drives the public store API and asserts both the fire and the absence of
the repair, and is proven red on main ([] and a rewritten instant).
Knobs live in the new sibling `cron/jobs_time.py`; `cron/jobs.py` stays over the file-lines
ratchet and only gained the call-site plumbing.
17 conflicts, all from main's lint sweep (ruff UP007/UP017/UP022/UP028/UP031/UP037/UP041,
FURB188/FURB192); no other main commit touches a conflicted file. Resolution: the branch side
of each file plus main's exact autofix (ruff 0.15.10, main's ruff.strict.toml, --fix
--unsafe-fixes). ruff.strict.toml takes main's copy. The pool-retirement live fixture stays
deleted with the pooled backend this branch retires.
45 conflicts, all from #135177 (lefthook + `ruff check --fix` over 2,366 files). No other main commit
touches a conflicted file. Resolution: the branch side of each file, then main's exact autofix
(ruff 0.15.10, `--config ./ruff.strict.toml --fix`) on it — rewrites only (typing generics, noqa
drops, import forms), no import removed. tests/cron/test_bot_chat_cli_home.py stays deleted
(1cc9cb9199 retired its lane).
12 conflicted files, resolved in three lanes:
- gateway/run.py: take the branch split; main's tirith removal and spool-replay
ordering ported into run_runtime_init.py / run_bootstrap.py.
- config migrations: main keeps v50 (tirith); the branch's bot-chat timeout removal
becomes v51 (_config_version 51, template + test updated).
- hermes_state_usage.py: main's voice_chat task route threaded through the branch's
owner transaction; worker.persist usage allowlist accepts task.
- tui_gateway/server.py: branch side; main's edits applied where the code now lives
(agent_factory, session_registry). Desktop sessions get the catalog toolset on the
authority path; daemon-run finite CLI turns are not watched turns; lazy session info
reports nous/welcome on the free tier.
- Desktop/Ink: one branch-child spinner fix (main's route-token check); main's
uninstall i18n keys kept, pool keys stay removed; voice_turn forwarded and accepted
by the authority submit (surface_v1.voice_turn).
- chat_ws / PTY keepalive test: main's stricter test kept.
Final-stack review (hermes-pr-review 2c) on #133283:
- The tick lock reported its outage under the unresolved profile home (_get_lock_paths), while
every save, probe and grace check uses the resolved store path. With a symlinked HERMES_HOME
(or macOS /var -> /private/var) the lock outage never cleared: writable stuck at 0, no
"recovered" notice, and a skipped one-shot retired as missed. All store_health records are now
keyed through one _key() (realpath). Pinned with a symlinked home; red without it.
- unwritable -> recovered (before delivery) -> unwritable posted nothing: the dropped first
notice left the "recovered" timer pending, so the re-entry cancelled it as if an outage notice
had gone out. A dropped "unwritable" now cancels that timer, so the re-entry announces. The
notice test runs on a manual loop clock (no wall-clock timing; it had flaked once under load)
and pins the sequence.
- cron status printed "0 due run(s) not fired" and an empty summary when the jobs could not be
read from an unwritable store; it now says the jobs could not be read.
/simplify-code quality pass on the final #133283 stack, no behaviour change:
- One null-safe is_recurring in cron/constants.py replaces scheduler_tick's new copy and
unreachable_retry's (whose .get("schedule", {}) raised on a null schedule).
- cron status / cron list share _probe_then_list_jobs (probe, print, guarded read) instead of
two near-identical blocks.
- StoreDegraded.notice_fields and probe_report build their fields through one _report_fields.
- The notice listener's pre-checks no longer repeat deliver()'s store re-check; deliver() is the
single staleness gate (still red when removed).
Greptile r1 on #133283:
- #3: probe_store created an empty file in cron/, while a save stages a full payload beside a
symlinked jobs.json's real target. A read-only or full target passed the probe, so status and
doctor reported a writable store, and a fixed 1 MiB free-space cutoff could flag a store
whose small save still fits. The probe now stages a jobs.json-sized payload with
mkstemp_beside (the save's own staging helper), fsyncs it, and checks the resolved target is
writable; the free-space cutoff is gone.
- #5: on a read-only cron/ without cron/output, list_jobs tries to create output and raised
before `cron status` / `cron list` printed the warning and fix. Both print the store warning
first, and a read failure on an unwritable store no longer hides it.
Review cleanup, no behaviour change:
- warn_store_unwritable only resolved the active store before calling
store_health.note_unwritable; note_unwritable now defaults cron_dir to the active store and
every caller uses it directly (scheduler_tick no longer imports both).
- The advance-skip split no longer zips a parallel bool list twice, and reads
(schedule or {}) so a null schedule cannot raise inside the OSError handler.
- skipped_runs metric: a walrus instead of getattr around an Optional record.
- Notices: runner._served_profile_homes is declared on the reconcile mixin, so no getattr.
- cron status loads the active jobs once (skipped count + summary) instead of twice.
Gate r4 quality: _store_unwritable_report(count_skipped) took a boolean whose two
callers each picked a caller-specific step. The report now only probes the
store, and cron_status (the one caller that prints the skipped count) sums the
overdue jobs inside its existing `if (store_report := ...)` block. `cron list`
still does a single list_jobs pass.
Gate finding C12 r3 #8 (efficiency): on an unwritable store `cron list`
read every job twice — once to count the due runs that had not fired, once
to list them — and its one-line banner never shows that count. Add a
count_skipped flag to _store_unwritable_report; `cron list` passes False,
`cron status` keeps the count. Probe: list_jobs calls in cron_list on an
unwritable store go from 2 to 1, and the banner still prints.
Since the tick stopped raising on a failed store write, ticker_last_error is not written during
an outage, so `hermes cron status` stayed green while every job was skipped. The CLI cannot read
the ticker's in-memory state or trust markers in a directory nobody can write, so it probes the
store itself (cron.store_health.probe_report). On failure it leads with a red
"⚠ Cron store is NOT writable — scheduled jobs are being skipped" headline. The detail names
the path, the OS error, the last successful write, how many due runs have not fired, and the
fix. `cron list` prints a one-line banner. The probe runs before any job read, because loading
jobs re-secures the directory mode.
A failed cron run records last_status=error and bumps failure_streak
correctly, but the next successful run resets both in the same pass and
nothing durable records that a failure happened — a silent watchdog-style
script that fails every Nth tick collapses to a single tick of visible
failure, and monitors sampling jobs.json report green forever (#118354).
Stamp job[last_failure] = {at, detail} on every failed run, latest
failure wins, and do NOT clear it on success: last_status keeps
describing current health while last_failure preserves the recency
evidence for dashboards and cron list. cron list now prints a warning
line for the stamp (marked recovered when last_status is healthy).
Fixes#118354🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
`host_multiplexer_serving` read the HOST-wide rendezvous record and every
CLI guard (`_named_profile_refused_under_multiplexer`, `_cmd_stop`,
`_cmd_restart`, profile_lifecycle, status/cron/dashboard readers via
`named_profile_served_by_running_multiplexer`) trusted it as "someone
serves you", so two gateways that are NOT a multiplexer serving this
profile were refused with exit 78:
* #121352 (T2 vs a second tenant home): two Hermes tenants on one host,
separate HERMES_HOME roots, each with its own `default`. Tenant B's
start guard saw tenant A's multiplexer "serving default" and refused;
launchd parked the unit. gateway/host_attach.decide() and run.py's
host-lock claim already start beside a foreign-root owner; the CLI
probe did not. `host_multiplexer_serving` now returns None when the
record's home resolves to another tenant root
(`get_default_hermes_root(home=...)` vs ours).
* #120871 (T1 standalone named fleet, T6 launchd): `hermes -p argus
gateway restart` refused argus's OWN standalone host record as "a
multiplexer serves you" and pointed at `-p default`, whose gateway was
not running. `named_profile_served_by_running_multiplexer` no longer
counts a host record launched by the profile's own home; `cron status`
names the profile that launched the scheduler host instead of a
hardcoded `default`.
Control kept: a satellite whose own home is not the host record's home,
while the same tenant's live default multiplexer lists it, is still
refused without --force and the hint names the owner.
Re-implements the idea of #121574 and #122169 by @Finn763 at the shared
seam so every reader inherits it (those PRs patched only one caller each).
A crash or SIGKILL cannot record itself. CLI, TUI, gateway, serve and cron-tick
drop a small marker under the profile's store dir at start (only when
collection is on), restamp it clean at exit, crash+exception family from the
excepthook, or watchdog before the gateway's os._exit. The next start in that
profile reports every marker whose owner fails the canonical start-time
liveness check (running => killed), on a daemon thread with rename-claims so
startup never waits and concurrent starts never double count.
Turns killed by the turn liveness watchdog or the gateway inactivity watchdog
count as exit_kind=watchdog once per turn, in the turn's own profile (home
captured at turn entry; off-thread watchdogs bind it explicitly).
MAJOR — `_builtin_gateway_liveness` trusted a bare-epoch ticker heartbeat for
~200 s after its writer died, for every profile, and the multiplexer pid gate
had been dropped: a killed serve/Desktop ticker read as alive and
`hermes -p X cron run` queued a primary-routed run "for the gateway's next
tick" with no ticker present.
- `cron/jobs.py::record_ticker_heartbeat` stamps `<epoch> <pid>`;
`get_ticker_heartbeat_age` parses the first field (legacy bare stamps still
yield an age); new `ticker_heartbeat_writer_alive` requires the stamped pid
to be alive and treats a bare stamp as NOT proof by itself.
- The heartbeat-only rung is now `fresh AND (served-by-multiplexer OR writer
alive)`: the multiplexer record proves the host process for a served named
profile (and covers a stale-code multiplexer still writing bare stamps), so
only the in-process serve/Desktop ticker relies on the heartbeat, and then
only with a live writer. `cron status`'s in-process-ticker rung applies the
same rule.
MINOR (a) — `_hand_off_primary_routed_run` gated on `is True`; an unknown
(None) probe returns an error naming the uncertainty instead of "queued …
runs and delivers it".
MINOR (b) — `_run_claimed_job` wraps a shared-bot satellite's resolved map in
`SharedRouteAdapters(primary, _primary_profile_routes_for_current_home())`,
the same grant the ticker's `tick_adapters_for` makes, instead of handing it
the full primary adapter map.
Tests (each red on the previous head a18977090be):
- test_cron_satellite_diagnostics.py::test_in_process_ticker_heartbeat_counts_only_while_its_writer_lives
- test_cronjob_run_primary_routed.py::test_routed_run_without_a_serving_gateway_fails_before_the_turn[None]
- test_cronjob_run_immediate.py::test_execute_job_now_grants_a_shared_bot_satellite_only_its_routed_targets
Trim of the #121921 salvage plus the rest of the class:
- `_builtin_gateway_liveness` (shared by `cron list/create`, `cron status` and the
`cronjob` tool via tools/cronjob_job_args.py): own-home lock/pid, else a fresh
ticker heartbeat in THIS home's store. The multiplexer-record rung was redundant
once the heartbeat is the evidence (served + no heartbeat was already False), and
it wrongly said "dead" when the record excluded the profile or predated
`served_profiles` while `hermes serve` / the Desktop backend was ticking the home
in-process (#121881) or a shared gateway was firing the profile's jobs (#99631).
- `cron status`: the in-process ticker is a rung beside the multiplexer rung instead
of a re-indented copy of the "no gateway" block; its restart hint names the
Desktop app / serve backend.
- The red verdict names the inspected profile and claims only what the probe can
know ("No scheduler is serving profile 'X'"): from a named profile it cannot see a
gateway alive for other profiles, so "No gateway is running on this host" was a
host-wide negative it could not make (#99579). `cron list` names the profile in
its banner and its empty-state line, and the list/create warning names it too
(idea from #99613 by @webtecnica; its `_active_profile_label` wrapper, banner
rewrite and unrelated kanban/script-validation scope were not taken).
WHEN L3 (ticker liveness read by a CLI command), WHERE T7 (Desktop/serve in-process
ticker) and T2/T3 (`hermes -p X` against the host multiplexer).
Tests: the salvaged serve-ticker test keeps the fresh->alive / stale->dead
invariant; one named-profile test proves the profile is named on every verdict and
that probe's own heartbeat counts when the default record excludes probe. Both red
on origin/main (`_builtin_gateway_liveness()` False with a fresh heartbeat;
"No scheduled jobs." without the profile). Existing assertions on the old host-wide
string were moved to the new one.
Co-authored-by: webtecnica <webtecnica@gmail.com>
Desktop topology ticks cron in-process inside `hermes serve`, so
`hermes cron status`/`list` no longer report a missing CLI gateway
when the ticker heartbeat is fresh.
(cherry picked from commit 583de75430adf6272eca932bf72665148df52101)
Add an optional per-job `interpreter` field so a cron Python `script` /
`monitor_script` can run under a user-managed venv instead of Hermes' own
Python, letting scripts import packages the Hermes runtime does not carry
(#8714). Nothing is installed, frozen, or restored automatically.
- cron/jobs.py: persist + normalize the field (absent => record unchanged;
empty string clears it on update).
- cron/scheduler_script.py: _resolve_cron_interpreter() validates the path
at run time (absolute/~ required, regular file, executable on POSIX);
_script_argv runs [interpreter, script] and skips the managed-store
bootstrap/PYTHONPATH overlays, which exist for Hermes' own venv.
Threaded through _run_job_script, the claim-heartbeat wrapper, the
pre-run prompt path and monitor scripts.
- hermes_cli: --interpreter on `cron create` / `cron edit`; shown in
details and `cron list`.
- tools/cronjob_tools.py: programmatic/CLI lane only, like model and
reasoning_effort — absent from the model-facing schema.
Shell scripts (.sh/.bash) still always run under bash. Revives #8741.
Ported onto current main from #70500 (the scheduler moved to
cron/scheduler_script.py and the CLI/tool became table-driven since the
PR's base).
Co-authored-by: MestreY0d4-Uninter <241404605+MestreY0d4-Uninter@users.noreply.github.com>
One gateway per host is the only supported topology (#100896). This is the convergence
path that makes it true on an upgraded machine.
`gateway migrate --multiplex` is now defined by TOPOLOGY, not by the config flag: a host is
converged when no secondary profile owns a gateway process or a supervisor unit. A
half-migrated host (flag flipped, a unit left behind, a crash between the two) therefore
converges on the next run instead of reporting "already multiplexed" — that flag-only test
made the re-run a no-op on exactly the host that needed it. The manifest is the resume
record: present means UNFINISHED, so a confirmed convergence clears it and any manifest
found on disk is resumed from rather than refused.
Windows Scheduled Tasks (and the Startup-folder fallback `gateway install` writes when it
cannot register a task) are now detected and removed like any other unit; Windows used to
be a flat refusal with hand-migration instructions. s6 stays refused, because there the
per-profile gateways are slots the container's own boot registers — and that boot now
registers named slots DOWN unconditionally, which is the s6 leg of the convergence. It
used to read `gateway.multiplex_profiles`, so the UNSET default (on) booted the slots
anyway and the image shipped the opt-out topology by accident.
A running gateway is never SIGTERMed silently: the plan names every pid it will signal and
prints before anything is signalled, with a dry run that changes nothing.
`--standalone` is gone. Reinstalling per-profile services is not a supported target, so
there is no rollback command; the machinery survives only as the compensator inside a
single failed apply, because the one outcome worse than a per-profile fleet is a profile
with no gateway at all.
`gateway.multiplex_profiles: false` is retired as a topology opt-out: it still parses and
still carries the runtime mode every scoped code path reads, but it can no longer pin a
second gateway process — it resolves like an unset key, warns, and points at the migration.
The unset path is not optimistic (it refuses to multiplex while a real blocker holds), so a
host that genuinely cannot fold still comes up standalone and says why. The eager Desktop
activation stops reading it too: a stale `false` there made a multi-home host serve a
second profile with the LAUNCH profile's credentials.
The host gateway lock flips from observe-only to a refusal. `host_attach` already
attaches/rescans/refuses before anything binds, but it reads a RECORD published a moment
after the owner starts, so two gateways launched together can both see no owner. The lock
is the only atomic arbiter of that race. The refusal names the owner, prints the migrate
command, and exits 75 (EX_TEMPFAIL) so a supervisor RETRIES — never the parking 78 — and on
the retry the record exists and the attach path resolves it properly. `--force`, `--replace`
and an unopenable lock dir are not refusals.
Review findings on this PR.
- `_from_host_record` accepted a record with `createTime: null`: `_same_incarnation` treats a
missing create_time as "matches", so `liveness_is_proven()` blessed whatever process happens to
own that PID today. A record pointing at an unrelated `sleep 60` made `cron status` print
"the host gateway (PID ...) serving profiles default, served". Require a recorded create_time.
- `cron status`'s host-record rung printed `hermes gateway restart`, which exits 78 for exactly
its audience (a served NAMED profile); use the `--profile default` form both rungs now share.
- doctor's WORST state (supervision slots exist, nothing owns the gateway role) emitted a warning
but appended no issue, while the strictly less severe LEGACY case did.
- Drop three defensive wrappers in `host_topology`: a try/except around an always-importable
`normalize_profile_name` that silently degraded to a DIFFERENT normalisation, a blanket except
per rung, and a swallowed `get_active_profile_name`.
- `get_systemd_unit_path`, `_legacy_unit_search_paths`, the doctor host-unit probe and the
profile-delete service cleanup hardcoded `~/.config/systemd/user`, so on a host that moves
$XDG_CONFIG_HOME the unit probe false-negatived -- the very bug this PR fixes survived there.
One `user_systemd_unit_dir()` helper honours the spec default.
Tests: the two "Scheduler host: the host gateway" assertions were prefixes of BOTH rungs, so the
rungs were indistinguishable and the host-record rung was never exercised (which is how the
restart-command defect shipped green). Both now assert the full line, plus a served-host-record
case. Rendezvous isolation uses `tmp_path` instead of a leaked `tempfile.mkdtemp()` and also
covers `test_gateway_multiplex_served_record.py`, which read the real host record; the
`tests/conftest.py` hook in #118097 supersedes all of them once it lands.
Multiplex-only (Teknium ruling) runs exactly ONE `hermes gateway run` per host,
multiplexing every profile. Four reporting surfaces still asked a per-PROFILE
process question ("does MY profile own a gateway process?"), so a SERVED profile
answered "no" and the output lied:
* `hermes -p served cron status` printed "Gateway is not running" and told the
user to run `hermes gateway install` / `gateway run` for that profile — i.e.
to start a SECOND host process, which the architecture forbids.
* `hermes doctor` reported "Per-profile gateways: up/total" from s6 slots and
checked systemd linger against the CURRENT profile's unit, so a doctor run
under a served profile skipped the check entirely.
* `hermes claw`'s destructive-action warning was gated on `get_running_pid()`,
which returns None for a served profile — the token-conflict warning was
SILENTLY SKIPPED (a real safety hole).
* `gateway.status.multiplexer_liveness_for_profile()` returned None for the
default home by construction, so `default` could never be reported as SERVED.
* `hermes doctor`'s state.db holder + WAL wording implied one gateway per
profile.
New `gateway/host_topology.py` resolves "which single process owns the gateway
role on this host, and which profiles does it serve" once, from the host
rendezvous record (`gateway/host_rendezvous.py`), falling back to the default
home's recorded `served_profiles` for a gateway that predates the record.
`default` is just another served profile there.
Root cause: every surface derived gateway identity from per-profile artifacts
(argv `-p <name>`, `gateway.pid`, the active profile's systemd unit, s6 slot
counts) instead of the host record that actually names the owner.
After `hermes update` fast-forwards the checkout under a running multiplex gateway,
its cron ticker yields every tick ("stale code: booted on A, disk is at B") for as
long as the process lives. Two things made that a silent total dispatch outage:
* `hermes cron status` weighed only the liveness heartbeat (kept fresh by the yielding
loop) and the success marker; with no success marker on disk it printed
"✓ Gateway is running — cron jobs will fire automatically", and with a stale one
it pointed at "Check the gateway log" instead of naming the cause. The persisted
`CronTickYielded` error is now recognised (`cron.scheduler.stale_code_yield_labels`)
and reported as "Gateway is running STALE code — fires NOTHING", with both
revisions and the restart command. A fresh heartbeat with a recorded error and no
success marker is no longer green either.
* The post-update fleet version matrix flagged a `stale` gateway and exited 1, but
left it running. `_verify_fleet_after_update` now hands every proven-stale survivor
to the existing drain-first `request_restart` path (SIGUSR1) via
`hermes_cli/update_cmd_stale_survivors.py`: a supervised gateway respawns on the new
code, a bare `gateway run` is stopped and listed under "Restart manually" — the same
contract the restart phase already uses for unmapped manual gateways. The drain
budget computation is shared (`_gateway_drain_budget`).
The yield itself is unchanged: a stale-code process still never dispatches while a
fresher lock holder exists (design of 9a7732b45f).
Fixes#117275
An unpinned cron job used to snapshot the global provider/model at creation and treat that
snapshot as its effective pin (#44585), so `hermes model` / `/model` never moved the fleet and
`hermes cron resnap` existed to catch jobs up. New ruling: jobs run on whatever the main agent
model is when they fire. Resolution is per-job pin > cron.model / cron.model_provider (the cron
fleet default) > model.default.
`pinned` replaces the implicit snapshot with an explicit lock: create/update with pinned=true
writes the CURRENT main provider+model onto the job as an ordinary per-job pin; pinned=false
releases both. The cronjob tool exposes it (schema: only when the user asks; it can only lock
the main model, never point spend at a different one) and reports `pinned` per job; the CLI
gets `--pin` / `--unpin`. Legacy records that still carry *_snapshot keys follow the main model.
Removed with the snapshot: `hermes cron resnap`, the tool's resnap action + `all` param, the
"N unpinned jobs keep running on ..." notice in `hermes model` / `hermes config set` / the
dashboard model assignment, and the Desktop cron-model-impact card (setMainModelAssignment
keeps the expensive-model confirm flow in store/model-assignment.ts).
Live A/B (real store + run_job against a temp HERMES_HOME): main-model X -> Y, unpinned job
fires on X before, Y after; pinned job stays on X; unpin -> Y; legacy snapshot record -> Y.
`hermes cron list`, the web dashboard Cron page and the Desktop cron panel/sidebar all
rendered a `next_run_at` parked hours in the past as an ordinary upcoming "Next run" —
the only user-visible trace of a scheduler that stopped ticking (#114309). Every
surface now labels a slot past `cron doctor`'s 15-minute grace as overdue (CLI
`Overdue:` row with the lateness, web `Overdue since`, Desktop `Overdue since` label
on the detail panel and sidebar meta) while paused/disabled/completed jobs keep the
plain label because they are not expected to fire.
The CLI's overdue check now parses through `cron.jobs._parse_aware` and `hermes_time.now`
so status/list/doctor and the ticker agree on the instant (mixed offsets, DST folds,
legacy naive stamps read as system-local like the scheduler does), and both the
ordering and the subtraction normalise to UTC: Python compares same-tzinfo datetimes by
wall clock, which is wrong across a DST fold. Status still orders the soonest run by
instant (#113874) and prints the stored stamp.
Tests: the salvaged status tests are trimmed to two invariants (overdue + stale
heartbeat is loud on status AND list; within-grace stays plain on both), the DST-fold
ordering tests freeze the CLI clock as well so their 2026-11 fixtures never start
reading as overdue, and one vitest each pins the web and Desktop helpers.
Co-authored-by: funky-xamarin <30426178+Wenfengcheng@users.noreply.github.com>
Co-authored-by: joaomarcos <joaomarcosdias444@gmail.com>
Address review feedback: `cron doctor` tolerates a 15-minute grace
window (_OVERDUE_GRACE_SECONDS) before calling a next_run_at overdue,
but the new status OVERDUE line fired on any `scheduled < now`, so a
job a few minutes behind the ticker's own cadence could flash OVERDUE
while doctor still called the same job healthy.
- Gate the status OVERDUE line on the same _OVERDUE_GRACE_SECONDS so
status, list, and doctor tell one consistent story.
- Reuse _next_run_overdue_seconds inside _next_run_overdue_issue,
dropping the duplicated timestamp parsing.
- Add a regression test: a next_run_at 5 minutes in the past stays a
plain 'Next run' line.
When the scheduler host dies, a job's next_run_at is stranded in the
past and `hermes cron status` still printed it as an upcoming
"Next run", hiding the outage (#114309): the report's only signal was
the gateway line, while the schedule line kept presenting a 7h-old
timestamp as future.
- _print_active_jobs_summary: when the earliest next_run_at already
passed, print a loud OVERDUE line (age + scheduler question) instead
of a bare "Next run: <past ts>"; future timestamps render unchanged.
- cron_status gateway-down branch: when ticker_heartbeat is stale,
print when the scheduler last ticked so the frozen state is
first-class visible.
Fixes#114309
The lock result controls the multiplexer probe once the initial PID scan is empty. Pass the known-empty PID list explicitly on the served path.
Reported-by: kshitijk4poor
Use one plain-text missed-fire core in list and doctor, including the rerun command. Keep the error-detail bound independent of the shared recovery suffix.
Reported-by: kshitijk4poor
Share the freshness threshold with status and keep local and external-provider probes unchanged. Missing/stale satellite cases fail on the parent; the fresh control passes.
Reported-by: kshitijk4poor
Keep the nonzero doctor status for the last late dispatch. Replace the configuration-only footer and exercise persistence through successful completion until the next on-time dispatch.
Reported-by: kshitijk4poor
Remove the upstream early multiplexer status shortcut so satellite heartbeat health remains authoritative. Model scoped gateway lock and command-line identity in fixtures, use recorded served profiles for exclusion, and retain rejection of unrelated live PIDs.
(cherry picked from commit 1238efcaa0445fdf198073ca0ba74c0c07cae365)
- cron status now checks default-profile multiplexer so satellite profiles
served by the gateway no longer falsely report 'Gateway is not running'
and correctly show 'running via multiplexer'; when not multiplexed,
the message explains the Desktop-only ticker cliff and how to enable
gateway.multiplex_profiles for 24/7 fires.
- cron doctor now flags last_dispatch catch_up/late and last_fire_error
so a missed schedule that fast-forwarded next_run_at is not silently
reported as 'found no issues'.
(cherry picked from commit 46592ac52bf11736f0d8f3d2bd7e10067ef15af4)
`hermes cron tick` (external-scheduler mode: a system crontab calls it) reached
run_canonical_job -> connect_gateway -> ensure_gateway_runtime, which spawns an
unmanaged gateway daemon when nothing owns the profile. Every crontab tick with
the gateway down left a stray daemon behind.
Headless surfaces refuse rather than spawn (the approvals policy). tick() gains
`headless=True`, set only by the CLI tick and the `python -m cron.scheduler`
entry; cron/scheduler_gateway_gate.py then holds back agent jobs when discovery
reports the home has no owner ("absent" is exactly the state ensure would spawn
in; starting/ready/incompatible/remote are left to connect_gateway, which never
spawns for them). Held-back jobs are skipped, not failed: no run is recorded,
next_run_at keeps the due instant (no drift, no failure streak), the orphan
pending_slot/run_claim stamps from the due scan are dropped so nothing later
"restores" the slot, and `last_fire_error` carries the actionable reason that
`hermes cron list` shows. One warning per tick names the job ids and the fix
(`hermes gateway start` / `hermes gateway install`). no_agent script jobs still
run from a bare tick.
The in-process gateway ticker and `hermes cron run` are not headless and are
unchanged. Docs: cron.md `tick` verb, cron-troubleshooting, cron/AGENTS.md.
Reviewer finding by @erosika on #106742; ruling by @teknium1.