Cron Job Definition, Registration & Context Isolation
Decrypting cron/jobs.py scheduled task definitions, dependency registration, and session state management
๐ 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.
๐ 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.