Repository navigation
feat(automations): actions that wait, carried out at their time - #452
Merged
Merged
Conversation
timers.later(db, intent) keeps an intent with a AA86 delay or a when as the timer intent-<key>. When its time comes, timers.risk_now works its risk out again from the automation as it is then (its policy and namespaces now, the stricter effect, the action's own check): a routine one runs through actions.perform as the automation, inside its run's cause and ledger scope; one that should ask becomes an approval (approvals.ask once it exists). The run hears of each step through automations.update_intent, and an intent whose automation was switched off, whose timer was cancelled or that Lens missed expires. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KfD6cia42GiEZakbs74jxY
20 of 22 tasks
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.
Requested by Adeel · project thread
Description
Before: an action node with a
delay("wait 2 hours, then…") or awhenwas refused on save as "coming soon", because nothing could keep it until its time.After:
timers.later(db, intent)keeps such an intent as the timerintent-<intent key>. When its time comes, Lens works out its risk again from the automation as it is then: a routine one runs, one that should now ask becomes an approval, and one whose automation was switched off, cancelled or missed expires. Workflow studio M4, part 3 of 3. Action nodes with a wait now pass the save check; nothing runs on its own until automations are stored (M6), whose run hands scheduled intents tolater.How:
laterchecks the intent (automation_spec.check_intent) and sets a timer of kindintent.performwith payload{intent, depth}. It gives back{timer, at}, for the run to keep with the intent.risk_now(db, intent, automation):readandselfare routine.lensstays routine only if it was routine and its namespaces are still within the automation's.outis routine only while the person has that node set toauto.actions.performas the automation (itsrun_as), insideevents.caused_by({automation, run, depth})andactivity.scope("automation:<id>", "automation_run:<run>"). So what it makes carries the cause for the loop guard, and model calls land in the ledger for the run.approvals.ask(once approvals are built; until then it stays waiting, saying why). The run hears every step throughautomations.update_intent(done, failed, waiting, expired), reached through the same import guard as feat(automations): schedule, at and relative triggers as timers #450.upcomingdescribes a waiting action in words ("Write “hi” to the run log: on Fri 16 Oct at 18:22 (UTC)").tests/domain/test_automation_nodes.py(from feat(workflows): an event scope for automations, with action and decide nodes #436) expected "coming soon" for a delay; it now checks that a delay saves, and that it is still refused without the time module.Defaults I picked (reversible):
lensaction.Motivation and Context
Workflow studio M4 (
/mnt/project-files/workflow-studio/briefs/M4.md, plan section 3.10). This completes M4: M6 needslaterfor the run'shand_off, and M5's joins already haveset,cancelandhandlerfrom #446.Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md. (n/a: nothing reaches people until M6 stores automations)Done questions (AGENTS.md)
delayorwhenthroughPOST /api/v1/workflows, which now accepts it; M6 exposes runs andupcoming.outaction can't outlive the person's "ask"; it runs with the automation's person's permissions as they are then, under the loop guard's cause. No new route or outside input. Threat model n/a.docs/automations.mdlabels actions that wait built and says approvals and storing automations are planned.tests/domain/test_timer_intents.pycovers later and upcoming, routine runs as the automation inside its run, ask becomes an approval, expiry when switched off, cancelled or missed, failures, and risk_now.tests/domain/test_automation_nodes.pywas updated. Docs:docs/automations.md(Actions that wait, the event workflow checks). The full backend suite passes locally (1259 passed). No generated files change.docs/automations.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01KfD6cia42GiEZakbs74jxY
Generated by Claude Code