feat(cron): native action buttons on Telegram deliveries - #89359
Open
srosenlund wants to merge 1 commit into
Open
feat(cron): native action buttons on Telegram deliveries#89359srosenlund wants to merge 1 commit into
srosenlund wants to merge 1 commit into
Conversation
Parse a last-line delivery_choices envelope (or a per-job fallback) at send time, attach Telegram buttons without blocking the cron worker, and inject the tap as a user turn in the continuable session. Closes NousResearch#78999. Co-authored-by: Cursor <cursoragent@cursor.com>
|
+1 from a user with exactly this need: interactive reminders. My assistant schedules reminder crons and the delivered message should carry Done / Snooze / Stop choices; the fact that a tap becomes a normal user turn in the continuable session means my existing reminder-handling flow (a profile skill that maps choices to reschedule/delete via the cronjob tool) would pick it up unchanged. |
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.
What does this PR do?
Cron workers never receive the
clarifytoolset, so scheduled jobs cannot render approval-style buttons today. This implements the preferred form of #78999: structured choices at delivery time, no wait inrun_job, tap becomes a user turn in the continuable session.A last-line envelope:
{"delivery_choices": ["vis bilag", "lav konteringspreview", "spring over"]}is stripped from the visible message. A per-job
delivery_choiceslist is the fallback when the model omits the envelope. Telegram attaches one inline button per label (cd:callbacks, no "Other"). Stale taps (superseded by a newer delivery for the same job, or older than 6 hours) fail visibly.This is not
cron.allow_clarify(mid-run block) and not journal buttons written tobutton_responses.jsonl.Related Issue
Fixes #78999
Type of Change
Changes Made
cron/delivery_choices.py— envelope parse, job fallback, pending storecron/scheduler.py— strip envelope; send buttons viaadapter.send_delivery_choiceswithout waiting for a tapcron/jobs.py,tools/cronjob_tools.py,hermes_cli/web_models.py,hermes_cli/web_server.py— optionaldelivery_choicesfieldplugins/platforms/telegram/adapter.py—send_delivery_choices+cd:callback injectsMessageEventwebsite/docs/user-guide/features/cron.md— Action buttons sectiontests/cron/test_delivery_choices.py,tests/gateway/test_telegram_cron_delivery_choices.py, envelope-strip case intests/cron/test_scheduler.pyHow to Test
PYTHONPATH=. python3.11 -m pytest tests/cron/test_delivery_choices.py tests/cron/test_scheduler.py::TestCronDeliveryMirror tests/gateway/test_telegram_cron_delivery_choices.py -q— 25 passeddelivery_choices: ["Approve", "Skip"](or have the agent end with the JSON envelope)Checklist
Code
pytest tests/ -qand all tests pass (focused files above: 25 passed; full suite not run in this environment)Documentation & Housekeeping
website/docs/user-guide/features/cron.md)Made with Cursor