Skip to content

Add rule engine with schedule and interactive buttons#6

Open
dgrieser wants to merge 8 commits into
masterfrom
feat/rules-triggers-conditions-actions-buttons
Open

Add rule engine with schedule and interactive buttons#6
dgrieser wants to merge 8 commits into
masterfrom
feat/rules-triggers-conditions-actions-buttons

Conversation

@dgrieser

Copy link
Copy Markdown
Collaborator
  • Introduced trigger, condition, and action concepts for configs, defaulting to classic message behavior.
  • Added support for schedule triggers (cron) with timezone handling and button timeout functionality.
  • Implemented Outlook calendar condition stub with environment‑based event source.
  • Expanded configuration schema with new fields: trigger, schedule_cron, schedule_timezone, condition, condition_negate, outlook patterns, action, action_target, buttons, button_timeout, button_timeout_target.
  • Added commands to set triggers, cron expressions, timezones, conditions, outlook patterns, actions, targets, button management, and immediate run.
  • Implemented interactive button blocks, pending button tracking, timeout handling, and persistence cache.
  • Developed scheduler to evaluate cron schedules, respect conditions, and execute actions.
  • Updated README with usage details for the new features.
  • Modified Helm chart deployment to expose new cache files via environment variables.
  • Updated requirements to include croniter and added new outlook.py stub module.
  • Extended tests to cover new setters, condition evaluation, actions, button handling, and scheduler behavior.

dgrieser added 8 commits June 24, 2026 06:13
- Introduced trigger, condition, and action concepts for configs, defaulting to classic message behavior.
- Added support for schedule triggers (cron) with timezone handling and button timeout functionality.
- Implemented Outlook calendar condition stub with environment‑based event source.
- Expanded configuration schema with new fields: trigger, schedule_cron, schedule_timezone, condition, condition_negate, outlook patterns, action, action_target, buttons, button_timeout, button_timeout_target.
- Added commands to set triggers, cron expressions, timezones, conditions, outlook patterns, actions, targets, button management, and immediate run.
- Implemented interactive button blocks, pending button tracking, timeout handling, and persistence cache.
- Developed scheduler to evaluate cron schedules, respect conditions, and execute actions.
- Updated README with usage details for the new features.
- Modified Helm chart deployment to expose new cache files via environment variables.
- Updated requirements to include `croniter` and added new `outlook.py` stub module.
- Extended tests to cover new setters, condition evaluation, actions, button handling, and scheduler behavior.
- schedule_reply now respects `action` config and presence of `buttons`, delegating to `run_action` for non‑reply actions or when buttons are defined
- classic plain threaded reply retained for default `ACTION_REPLY` without buttons
- action_reply validates `thread_ts` against the target channel, preventing invalid thread references across conversations
- added comprehensive tests covering routing to actions, button handling, classic reply behavior, and channel‑specific threading constraints
…ndling

- Update .gitignore to include button state persistence file.
- Expand README with detailed button syntax, examples, and OpsGenie integration.
- Introduce new button action constants (config, ack, message, alert, delay) and escalation types.
- Extend DEFAULT_CONFIG with `default_button` and normalize legacy button format during migration.
- Refactor command parsing to support typed button specifications and default‑button commands.
- Implement add, clear, set, and clear default button commands with validation.
- Rewrite schedule_reply to always use the unified action engine and forward replies when configured.
- Add escalation registration, task handling, and auto‑press of default button on timeout.
- Enhance button press handling to support ack, message, alert, delay, and rescheduling.
- Provide helper functions for button normalization, finding buttons, and determining escalation kind.
- Update tests to cover new button actions, migration, default button behavior, and refactored logic.
…config property

- Updated README to clarify button syntax, button‑gated OpsGenie workflow, and added docs for `opsgenie-message`.
- Added `opsgenie_message` field to default config and commands to set/clear it.
- Refactored button handling: removed the dedicated `alert` action, treated OpsGenie as a regular config property.
- Implemented `_render_template`, `maybe_post_opsgenie_alert`, and context handling so any config with OpsGenie enabled can fire alerts using the original message or a custom template.
- Adjusted escalation logic to use config‑level OpsGenie and pass original message context to target configs.
- Updated `show_config`, help output, and related UI messages to reflect new behavior.
- Modified tests to reflect removal of the `alert` button action and new context propagation for OpsGenie alerts.
- Updated the news message text to highlight new capabilities:
- Triggers, actions, and interactive buttons now supported.
- Rules can run on a schedule (cron), DM users or groups, post to channels, and include auto‑press defaults with timeout escalation.
- Provides users with a concise overview of these features directly in the `/hutbot help` output.
- Expose HTTP port 8080 in Dockerfile and enable optional UI via env vars
- Document UI setup, endpoints, and Helm chart configuration in README
- Implement UI backend helpers in `bot.py` for validation, channel membership, and config CRUD
- Add `maybe_start_web_ui` to launch aiohttp UI when enabled
- Extend Helm chart (Chart.yaml bump to 0.1.3) with UI service, ingress, and network policy resources
- Include new Helm values under `ui:` to configure enablement, port, host, headers, service, and ingress
- Add `webui.py` aiohttp server with routes, security headers, and UI context bridging
- Provide static assets (`app.js`, `index.html`, `styles.css`) for the single‑page UI
- Add tests for UI helper functions and CRUD operations
- Adjust main loop to start and clean up the UI runner
- Minor updates to other files to integrate the new functionality.
- Document UI security considerations in README and explain `ui.allowedIngress`.
- Extend Helm chart values and NetworkPolicy to configure allowed ingress sources for the UI.
- Set default `allowedIngress` to an empty list (back‑compat insecure) with example.
- Introduce `get_user_by_email_strict` for exact‑email lookups and use it in the web UI backend.
- Update OpsGenie alert handling to use the posted message timestamp when the original ts is missing.
- Snapshot button definitions at posting time, store them, and strip interactive buttons after a press.
- Resolve button actions against the snapshot to prevent edited configs from affecting old messages.
- Preserve the original author in the context for config‑running buttons.
- Fix escalation task cleanup logic to avoid removing a rescheduled timer.
- Add comprehensive tests covering the new UI auth, allowedIngress, button snapshotting, alert aliasing, and escalation behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant