Skip to content

refactor(autopilot): canonicalize notification routing and add status diagnostics#742

Open
ahmedhesham6 wants to merge 1 commit into
mainfrom
refactor/notification-route-canonical-fields
Open

refactor(autopilot): canonicalize notification routing and add status diagnostics#742
ahmedhesham6 wants to merge 1 commit into
mainfrom
refactor/notification-route-canonical-fields

Conversation

@ahmedhesham6
Copy link
Copy Markdown
Collaborator

Description

Modernizes the autopilot notification routing system with canonical field names, per-schedule overrides, and observability improvements.

Changes Made

  • Canonical target field — Renames chat_idtarget as the primary notification destination field throughout config and runtime, with backward-compatible legacy aliases (notify_chat_id, schedule-level channel) that resolve in priority order
  • Per-schedule notify_channel / notify_target — Adds schedule-level notification overrides replacing the legacy channel key, with conflict validation rejecting --target + --chat-id or --max-turns + --max-steps flag combinations
  • max_turns per-schedule override — Replaces max_steps, propagated through apply_schedule_run_overrides into RunOverrides
  • CheckTriggerOn default → Failure — Swaps from Success to Failure as the sensible default (trigger on check failures)
  • NotificationRoute type — Renames DeliveryConfigNotificationRoute with type alias for backward compat
  • Notification status in autopilot status — New table column showing resolved route (e.g., slack:#ops) and readiness state
  • Notification diagnostics in autopilot doctor — Detects missing channel/target, legacy key conflicts ([notifications].target vs chat_id, notify_target vs legacy aliases), and gateway reachability for delivery
  • Live sandbox health — Doctor now fetches and displays sandbox health from the server health endpoint
  • notification_route_config_warnings() — Warns when canonical fields override legacy aliases in the same config section
  • Documentation updates — System prompt, channel setup guide, gateway README

Related Issues

Part of the autopilot notification routing modernization effort.

Testing

  • ✅ All existing tests pass
  • cargo fmt --check clean
  • cargo clippy --all-targets -- -D warnings clean
  • ✅ New tests: legacy compat, canonical priority, CRUD field preservation, conflict validation, doctor diagnostics, gateway target conversion, schedule max_turns override propagation

Breaking Changes

  • CheckTriggerOn default changed from Success to Failure — schedules without explicit trigger_on will now trigger on non-zero exit codes instead of exit 0. This is a behavioral change but aligns with the more intuitive default.
  • Legacy chat_id and schedule-level channel fields are still loaded but channel add now writes the canonical target field. Config files with both will receive warning diagnostics from autopilot doctor.

… status diagnostics

- Rename chat_id → target as canonical notification destination field,
  with backward-compatible legacy aliases (notify_chat_id, channel)
- Add per-schedule notify_channel and notify_target overrides replacing
  legacy schedule-level 'channel' key
- Add max_turns per-schedule override (replaces max_steps)
- Swap CheckTriggerOn default from Success to Failure
- Rename DeliveryConfig → NotificationRoute with type alias for compat
- Add notification route status to 'autopilot status' table output
- Add notification readiness diagnostics to 'autopilot doctor'
  (route resolution, missing channel/target hints, gateway reachability)
- Add live sandbox health check to doctor output
- Add notification_route_config_warnings for legacy key conflict detection
- Add apply_schedule_run_overrides to propagate schedule max_turns
- Update docs: system prompt, channel setup, gateway README
- Extensive tests for legacy compat, canonical priority, CRUD preservation,
  conflict validation, and doctor diagnostics
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