zeroclaw/web/src/lib
Giulio V 49d68e55f2
fix(cron): add startup catch-up and drop login shell flag (#3948)
* fix(cron): add startup catch-up and drop login shell flag

Problems:
1. When ZeroClaw started after downtime (late boot, daemon restart),
   overdue jobs were picked up via `due_jobs()` but limited by
   `max_tasks` per poll cycle — with many overdue jobs, catch-up
   could take many cycles.
2. Cron shell jobs used `sh -lc` (login shell), which loads the
   full user profile on every execution — slow and may cause
   unexpected side effects.

Fixes:
- Add `all_overdue_jobs()` store query without `max_tasks` limit
- Add `catch_up_overdue_jobs()` startup phase that runs ALL overdue
  jobs once before entering the normal polling loop
- Extract `build_cron_shell_command()` helper using `sh -c` (non-login)
- Add structured tracing for catch-up progress
- Add tests for all new functions

* feat(cron): make catch-up configurable via API and control panel

Add `catch_up_on_startup` boolean to `[cron]` config (default: true).
When enabled, the scheduler runs all overdue jobs at startup before
entering the normal polling loop. Users can toggle this from:

- The Cron page toggle switch in the control panel
- PATCH /api/cron/settings { "catch_up_on_startup": false }
- The `[cron]` section of the TOML config editor

Also adds GET /api/cron/settings endpoint to read cron subsystem
settings without parsing the full config.

* fix(config): add catch_up_on_startup to CronConfig test constructors

The CI Lint job failed because the `cron_config_serde_roundtrip` test
constructs CronConfig directly and was missing the new field.
2026-03-24 15:26:27 +03:00
..
api.ts fix(cron): add startup catch-up and drop login shell flag (#3948) 2026-03-24 15:26:27 +03:00
auth.ts feat(gateway): add embedded web dashboard with React frontend 2026-02-21 16:14:01 +08:00
i18n.ts fix(web): remove duplicate dashboard keys in Turkish locale (#3812) 2026-03-24 15:17:27 +03:00
sse.ts fix(gateway): align dashboard API client and embed built web assets 2026-02-21 16:14:01 +08:00
uuid.ts fix: add crypto.randomUUID fallback for older browsers (#3407) 2026-03-13 09:16:00 -04:00
ws.ts fix(gateway): pass bearer token in WebSocket subprotocol for dashboard auth 2026-03-24 15:17:17 +03:00