| 1 | # job_loop.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `job_loop.py` helper module. |
| 6 | - This module runs periodic scheduler and maintenance loops. |
| 7 | - Keep this file-level DOX profile synchronized with `job_loop.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `job_loop.py` owns the runtime implementation. |
| 12 | - `job_loop.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Top-level functions: |
| 14 | - `async run_loop()` |
| 15 | - `async scheduler_tick()` |
| 16 | - `pause_loop()` |
| 17 | - `resume_loop()` |
| 18 | - Notable constants/configuration names: `SLEEP_TIME`. |
| 19 | |
| 20 | ## Runtime Contracts |
| 21 | |
| 22 | - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together. |
| 23 | - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change. |
| 24 | - Observed side-effect areas: scheduler state. |
| 25 | - Imported dependency areas include: `asyncio`, `datetime`, `helpers`, `helpers.print_style`, `helpers.task_scheduler`, `time`. |
| 26 | |
| 27 | ## Key Concepts |
| 28 | |
| 29 | - Important called helpers/classes observed in the source: `time.time`, `runtime.is_development`, `scheduler.tick`, `call_extensions_async`, `resume_loop`, `asyncio.sleep`, `runtime.call_development_function`, `PrintStyle.error`, `scheduler_tick`, `errors.format_error`, `PrintStyle`, `errors.error_text`. |
| 30 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 31 | |
| 32 | ## Work Guidance |
| 33 | |
| 34 | - Preserve public helper APIs used by core code and plugins unless every caller is updated. |
| 35 | - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded. |
| 36 | - Prefer adding cohesive helper functions here only when behavior is reused across modules. |
| 37 | |
| 38 | ## Verification |
| 39 | |
| 40 | - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers. |
| 41 | - Related tests observed by source search: |
| 42 | - `tests/test_api_chat_lifetime.py` |
| 43 | |
| 44 | ## Child DOX Index |
| 45 | |
| 46 | No child DOX files. |