Skip to content

1.20.1

Choose a tag to compare

@s-nagaev s-nagaev released this 25 Oct 11:00
· 33 commits to main since this release
604ac8d

Added

  • Scheduler observability: APScheduler logs are now visible in Chibi's loguru sinks. APScheduler 3.x emits everything through stdlib logging on the apscheduler.* logger family, and Chibi never bridged it — so every INFO/DEBUG record (Scheduler started, Added job ... to job store, Next wakeup is due at ..., No jobs; waiting until a job is added) was discarded outright, and even the surviving WARNING+ records (e.g. Run time of job ... was missed by 2:00:00) leaked to stderr as bare, unformatted lines with no timestamp, no level and no scheduler marker, making "did not fire" and "fired but delivery failed" indistinguishable in the logs. A dedicated stdlib→loguru bridge (chibi.config.logging) now installs a single intercepting handler on the apscheduler logger (idempotent, propagation disabled — no duplicate or double-formatted output, no logging.lastResort leak), scoped narrowly to the apscheduler.* family so all other loggers and every runner sink behave exactly as before. Bridged records render in the standard datetime | LEVEL | message shape with the stdlib logger name embedded in the message ([apscheduler.scheduler] ...), so a plain grep -i scheduler over the logs finally matches.
  • New SCHEDULER_DEBUG_LOGS setting (default false): the bridge floor is flag-gated — with the flag off the floor is INFO (start, scheduling, missed-run warnings; no per-wakeup chatter), with SCHEDULER_DEBUG_LOGS=true it drops to DEBUG so Next wakeup is due at ... and Added job ... become visible for diagnosing wakeup-arming issues. Toggling the env var only requires a process restart, not a rebuild. Documented in the generated configuration reference and the settings docstring.
  • Explicit Chibi-level scheduler logging, independent of the stdlib bridge: every successful scheduling call (schedule_interval_job / schedule_cron_job / schedule_once_job) now logs an INFO line carrying the job id, the owner (derived from the job-id namespace — system or the agent's user id), a trigger summary and the next run time, and a failed add_job logs a WARNING with the job id and error before re-raising. Additionally, a Chibi-level WARNING is logged whenever APScheduler dispatches a missed-run event (EVENT_JOB_MISSED), carrying the job id and the missed-by duration — the exact signature of the macOS-sleep digest failures, previously invisible.
  • Docs: self-sufficient trigger_text contract for self-type scheduled jobs. The schedule_task tool now states explicitly (in the trigger_text parameter description, the action-type descriptions and the SCHEDULER_HINT_PROMPT system-prompt hint) that for self jobs the trigger text must be exhaustive and self-sufficient — goal, requirements, constraints and expected output — because at fire time the model may have no memory of the scheduling conversation (thread cleared, context evicted, or a different chat). Includes good vs. bad examples. Docs-only: no schema or runtime changes.

Fixed

  • Scheduler wakeup guard against silent job starvation: a transient job store failure (e.g. a Redis hiccup) inside APScheduler's wakeup() left the wakeup timer permanently disarmed — the scheduler stayed "running" but silently stopped executing jobs until an unrelated external wakeup() (a new job or a chat message) happened to re-arm it. This mirrored an upstream APScheduler bug (agronholm/apscheduler#1132, merged to the 3.x branch on 2026-08-31 but not yet released). Chibi now ships GuardedAsyncIOScheduler, a local guard that mirrors the upstream fix verbatim: an exception escaping _process_jobs() is logged through the standard apscheduler.scheduler logger and the wakeup timer is re-armed with jobstore_retry_interval. Both scheduler flavors (Telegram ChibiScheduler and stdio/IDE StdioScheduler) use it. The guard is marked TODO(apscheduler-3.11.4): remove guard and is a pure-deletion revert once APScheduler 3.11.4 ships. Regression tests simulate a jobstore.update_job() failure mid-wakeup and verify the scheduler keeps firing jobs.
  • Local semantic memory no longer breaks after OS temp cleanup: the LOCAL fastembed embedding model was cached in the system temp directory ($TMPDIR/fastembed_cache), which the OS wipes periodically — a wiped or interrupted download then made the ONNX model unloadable and killed Chroma archival and semantic search for the whole deployment. The model is now cached in a persistent per-user directory (~/.cache/chibi/fastembed), so a temp-directory cleanup can no longer destroy it; the location is overridable with the FASTEMBED_CACHE_PATH environment variable. Embedding vectors, model and dimension are unchanged, so existing collections need no re-embedding.

Changed

  • APScheduler upgraded 3.11.2 → 3.11.3 across all dependency artifacts: poetry.lock, and the exported requirements.txt (the production Docker image pin) and requirements-dev.txt (pyproject.toml already allowed ^3.11); regenerating the requirements via the deps task (poetry export) keeps everything consistent. 3.11.3 fixes #1103 — sub-minute interval jobs stalling across a DST spring-forward gap with ZoneInfo timezones, relevant ahead of the 2026-10-26 CEST→CET transition (our tzlocal yields ZoneInfo). No API changes; PTB 22.x compatibility range (>=3.10.4,<3.12.0) unaffected.