Files
DocsGPT/docsgpt/core/settings/scheduler.py
T
arc53-machine 5578039c19 refactor(settings): treat unset spellings of every optional string as None
Review follow-up. The per-group secret validators normalised a hand-picked
list of API keys, which left other optional credentials and overrides
(OPEN_ROUTER_API_KEY, S3 and Daytona keys, ELASTIC_PASSWORD, the OIDC
trio, connector client ids, MICROSOFT_AUTHORITY, MCP_OAUTH_REDIRECT_URI)
holding the literal "None" or "" a .env file spells "unset" with, so
truthiness checks and fallbacks downstream saw a value. One rule on the
group base replaces those lists: every Optional[str] field maps "", "None"
and whitespace to None and strips real values. Plain str fields are left
alone. The OIDC required-settings check therefore also rejects those
spellings.

EMBEDDINGS_POOLING is Literal["cls", "mean"] with case-insensitive
parsing; its consumer silently ignored anything else.

Bounds added where the consumer rejects or misbehaves on the value:
SCHEDULE_RUN_OUTPUT_RETENTION_DAYS and MESSAGE_EVENTS_RETENTION_DAYS (the
cleanup repositories raise on <= 0), EMBEDDINGS_DELEGATE_TIMEOUT, the
remote-device idle/pairing/invocation TTLs and CELERY_VISIBILITY_TIMEOUT
(> 0), REMOTE_DEVICE_CMD_QUEUE_TTL_SECONDS (> 605, the documented drain
deadline), GRAPHRAG_MAX_CHUNKS_FOR_EXTRACTION (>= 0; negative would slice
the pending list from the end).

The generated reference now renders generic type arguments
(dict[str, int] rather than dict).
2026-09-17 11:37:57 +01:00

29 lines
1.3 KiB
Python

"""Scheduled agent runs (see scheduler.md)."""
from __future__ import annotations
from pydantic import Field
from docsgpt.core.settings._shared import SettingsGroup
class SchedulerSettings(SettingsGroup):
"""Cadence, quotas and timeouts of scheduled runs."""
SCHEDULE_DISPATCHER_INTERVAL: int = Field(
default=30, description="Seconds between dispatcher passes that enqueue due schedules."
)
SCHEDULE_MIN_INTERVAL: int = Field(default=900, description="Smallest allowed recurrence interval in seconds.")
SCHEDULE_MAX_PER_USER: int = Field(default=50, description="Cap on schedules a user may own.")
SCHEDULE_RUN_TIMEOUT: int = Field(default=600, description="Wall-clock cap on one scheduled run, in seconds.")
SCHEDULE_MISFIRE_GRACE: int = Field(
default=60, description="Seconds past the due time within which a missed run still fires."
)
SCHEDULE_AUTOPAUSE_FAILURES: int = Field(
default=3, description="Consecutive failures after which a schedule is paused automatically."
)
SCHEDULE_ONCE_MAX_HORIZON: int = Field(
default=31_536_000, description="How far ahead a one-off run may be scheduled, in seconds (one year)."
)
SCHEDULE_RUN_OUTPUT_RETENTION_DAYS: int = Field(default=90, gt=0, description="Days scheduled-run output is kept.")