Repository navigation
Expose trigger CRUD on the flow server so the dashboard can schedule flows - #55
Merged
Merged
Conversation
…flows Until now a cron trigger could only be created by the agent through the flow_trigger tool. The dashboard's Schedule page had no way to make one, so the two schedulers on a box looked like one, and "New task" could only mean a message to the agent. The flow server gains /flows/triggers: list, create, update (pause via enabled:false), delete, and run-now. Every write goes through the same validation the tool uses (assertValidSchedule) plus a flow-existence check, and arms the scheduler immediately. The server reaches the scheduler through an accessor rather than a captured instance, because register() re-runs on plugin reloads and replaces the scheduler while the first server instance survives; a captured reference would point at a stopped scheduler and re-arm its timers. Trigger records carry an origin field (agent or dashboard) so the two kinds stay tellable apart once both exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A cron trigger could only be created by the agent (
flow_triggertool). The dashboard's Schedule page reads OpenClaw cron only, so "New task" can only mean a message to the agent, and flow schedules were invisible until clawnify#1807 mirrored them read-only.What
/flows/triggerson the local flow server:GET(list, optional?flow=),POST(create),PATCH /:id(update;enabled:falsepauses),DELETE /:id,POST /:id/run(202, detached).assertValidSchedule), plus a flow-existence check. Writes callscheduler.sync()so the change is armed immediately.register()re-runs on reloads and swaps the scheduler while the first server survives theactiveServerguard.origin: "agent" | "dashboard"on trigger records.tests/serve-triggers.test.tscovers validation, arm/disarm on pause and resume, run-now recording a run, and 404s. Full suite: 225 passing.Version 1.6.2 → 1.6.3. The hook side (CAP
schedules.*flow target) and the dashboard dialog follow in clawnify.