Files
hermes-agent/tests/cron/test_cronjob_schema.py
T
红尘 d73ff9b0fb
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Docker / shell lint / Lint Dockerfile (hadolint) (push) Has been cancelled
Docker / shell lint / Lint docker/ shell scripts (shellcheck) (push) Has been cancelled
Docker Build and Publish / build-amd64 (push) Has been cancelled
Docker Build and Publish / build-arm64 (push) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (push) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (push) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (push) Has been cancelled
Nix Lockfile Fix / auto-fix-main (push) Has been cancelled
Nix Lockfile Fix / fix (push) Has been cancelled
Nix / nix (macos-latest) (push) Has been cancelled
Nix / nix (ubuntu-latest) (push) Has been cancelled
OSV-Scanner / Scan lockfiles (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Tests / test (1) (push) Has been cancelled
Tests / test (2) (push) Has been cancelled
Tests / test (3) (push) Has been cancelled
Tests / test (4) (push) Has been cancelled
Tests / test (5) (push) Has been cancelled
Tests / test (6) (push) Has been cancelled
Tests / e2e (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Tests / save-durations (push) Has been cancelled
Initial import of NousResearch/hermes-agent
2026-05-31 09:36:58 +08:00

42 lines
1.6 KiB
Python

"""Tests for the cronjob tool schema shape.
Guards the description text that flags ``schedule`` (and ``prompt``) as
REQUIRED for ``action=create`` — the load-bearing fix for description-driven
models (e.g. Grok) that omit schedule when the schema only lists ``action``
in ``required[]``. See issue #32427 / PR #32448.
"""
from __future__ import annotations
def test_cronjob_schema_action_description_flags_create_requirements():
"""`action` description must state schedule + prompt are required for create."""
from tools.cronjob_tools import CRONJOB_SCHEMA
action_desc = CRONJOB_SCHEMA["parameters"]["properties"]["action"]["description"]
assert "action=create" in action_desc
assert "schedule" in action_desc
assert "REQUIRED" in action_desc
def test_cronjob_schema_schedule_description_flags_required_for_create():
"""`schedule` description must explicitly state REQUIRED for action=create."""
from tools.cronjob_tools import CRONJOB_SCHEMA
schedule_desc = CRONJOB_SCHEMA["parameters"]["properties"]["schedule"]["description"]
assert "REQUIRED" in schedule_desc
assert "action=create" in schedule_desc
def test_cronjob_schema_required_array_unchanged():
"""`required[]` stays minimal — `action` only.
The schema intentionally does NOT promote schedule/prompt into the
top-level required array because they're only mandatory for
action=create, not for list/remove/pause/etc. The description text
carries the conditional requirement instead.
"""
from tools.cronjob_tools import CRONJOB_SCHEMA
assert CRONJOB_SCHEMA["parameters"]["required"] == ["action"]