fix(tools): remove unnecessary crontab requirement from cronjob tool (#1638)

* fix(tools): remove unnecessary crontab requirement from cronjob tool

The hermes cron system is internal — it uses a JSON-based scheduler
ticked by the gateway (cron/scheduler.py), not system crontab.

The check for shutil.which('crontab') was preventing the cronjob tool
from being available in environments without crontab installed (e.g.
minimal Ubuntu containers).

Changes:
- Remove shutil.which('crontab') check from check_cronjob_requirements()
- Remove unused shutil import
- Update docstring to clarify internal scheduler is used
- Update tests to reflect new behavior and add coverage for all
  session modes (interactive, gateway, exec_ask)

Fixes #1589

* test: add HERMES_EXEC_ASK coverage for cronjob requirements

Adds missing test for the exec_ask session mode, complementing
the cherry-picked fix from PR #1633.

---------

Co-authored-by: Bartok9 <bartokmagic@proton.me>
This commit is contained in:
Teknium 2026-03-17 01:40:02 -07:00 committed by GitHub
parent 4b96d10bc3
commit 949fac192f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 12 deletions

View file

@ -8,7 +8,6 @@ Compatibility wrappers remain for direct Python callers and legacy tests.
import json
import os
import re
import shutil
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional
@ -414,13 +413,10 @@ def check_cronjob_requirements() -> bool:
"""
Check if cronjob tools can be used.
Requires 'crontab' executable to be present in the system PATH.
Available in interactive CLI mode and gateway/messaging platforms.
The cron system is internal (JSON file-based scheduler ticked by the gateway),
so no external crontab executable is required.
"""
# Ensure the system can actually install and manage cron entries.
if not shutil.which("crontab"):
return False
return bool(
os.getenv("HERMES_INTERACTIVE")
or os.getenv("HERMES_GATEWAY_SESSION")