Cron & Jobs

Cron Job Definition, Registration & Context Isolation

Decrypting cron/jobs.py scheduled task definitions, dependency registration, and session state management
Cron Scheduling Flow
๐Ÿ“Š Figure 8-1-1: Cron scheduled task trigger, multi-thread pool execution, and database state write flow

โฐ 1. Job Registration & Definition

In cron/jobs.py, scheduled tasks are declared through a unified registration mechanism. Each scheduled task can define its Cron expression, context parameters, and required tool set isolation flags. This ensures each scheduled task runs cleanly in the background without interfering with user's active interactions.

Job Crash Recovery
๐Ÿ“Š Figure 8-1-2: Scheduled task timeout detection, crash capture, and dead letter queue (DLQ) retry flow

๐Ÿ›ก๏ธ 2. Execution Isolation & Independent Session Context

Each scheduled task is assigned a temporary, independent session_id and isolated environment sandbox at startup, achieving complete data isolation and preventing conflicts with frontend user sessions.