انتقل إلى المحتوى
#0553
AgentExec

The cron job that fixes its own cron job

A scheduled exec script pulls the exchange rates at 04:00 UTC. One night the vendor renames a JSON field. The script throws. The 04:00 fire lands in the history as a failure, and nothing else happens.

A loop on the agent session runs every 30 minutes with one prompt: read GET /api/v1/exec/schedules/history, find fires that failed since the last check, open the script, fix the cause, POST /api/v1/exec/schedules/reload so the scheduler re-reads it, then POST /api/v1/exec/schedules/trigger to fire it now and confirm.

At 04:31 the loop finds the failure. At 04:33 the rates are in the database. At 09:00 you read the note about the renamed field and review a diff that already shipped.

A failed schedule used to wait for a human. Now it waits for the next loop tick.