Repository navigation
feat: signals between bots start routines - #135
Merged
Merged
Conversation
Schedule gains kind signal, SkipReason too_soon, and RoutineRun keeps the signal that made it run (name, sender, note); migration 0017 adds those columns to routine_runs. The routine envelope says which signal and who sent it, with the note apart, marked as a bot's. Spec 20.13.
A bot's send_signal runs every enabled routine of its crew that waits for that signal, by the usual pause and overlap rules, at most once every 5 minutes per routine. crew_roster lists the signals, the bot rules say when to send one, and schedule_routine accepts the new kind.
"When a bot signals" in the routine form, with the signal's name and a hint to tell the other bot when to send it; only the overlap rule stays under More options. The list shows the signal, "Waits for a signal" and who sent the last one.
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.
Signals between bots that start routines (spec 20.13, roadmap item 18.7).
A routine can now wait for a signal instead of a time. When a bot of the crew says something happened (
send_signal report-ready), every routine of the crew that waits for that signal runs right away, in its own bot's chat. Example: Writer saves the report and signalsreport-ready, and Reviewer's "Review the report" routine runs, without the owner relaying it and without Writer knowing who reviews.Daemon
Schedulegains{kind: "signal", name}. The name is normalized like a slug ("Report Ready" becomesreport-ready). A name with no letters or digits is refused withsignal_invalid. These routines have nonext_run_at, so the scheduler never fires them, and the time zone and the "computer was off" rule don't apply.send_signal {name, note?}. It runs every enabled routine of an active bot in the sender's crew that waits for that signal, under the usual pause and overlap rules (20.3). Each routine runs from a signal at most once every 5 minutes; a signal that comes sooner is askippedrun with reasontoo_soon, so bots that signal each other in a loop cannot burn the owner's plan.RoutineRun.signalkeeps{name, fromBotId, note}; migration 0017 adds those columns toroutine_runs.crew_rosterlists the signals the crew's routines wait for, and the bot rules say to send a signal once what it names is done.schedule_routineaccepts the new kind, so a bot can ask the owner for a signal routine.App
pnpm devpreview.Checks
cargo fmt,clippy -D warnings,cargo test --workspaceandpnpm check(309 tests) pass.FakeRuntimeand a manual clock (tests/routine_signals.rs: normalized name, no clock runs, note and sender in the stdin line, the 5-minute spacing, crew scope, disabled routines, bad names and notes, andcrew_roster/send_signalover MCP); the app (features/routines/signals.test.tsx).crew_roster, foundreport-readyand sent it with a note. Reviewer's routine ran at once, used the note, and the run endeddone. The daemon log had none of the message text.Still to check by hand