Skip to content

Commit d3ba665

Browse files
committed
acdbot: enable autopilot for one-offs
1 parent 48a2691 commit d3ba665

File tree

4 files changed

+32
-24
lines changed

4 files changed

+32
-24
lines changed

.github/ACDbot/call_series_config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ default_autopilot_settings:
2525
display_zoom_link_in_invite: true
2626
external_meeting_link: false
2727

28+
# Autopilot settings for one-off calls
29+
one_off_autopilot_settings:
30+
duration: 60
31+
occurrence_rate: "custom"
32+
need_youtube_streams: false
33+
display_zoom_link_in_invite: true
34+
external_meeting_link: false
35+
2836
call_series:
2937
# Core Protocol Calls
3038
acdc:

.github/ACDbot/modules/call_series_config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,14 @@ def get_default_autopilot_settings() -> dict:
159159
"""
160160
config = _load_config()
161161
return config.get("default_autopilot_settings", {})
162+
163+
164+
def get_one_off_autopilot_settings() -> dict:
165+
"""
166+
Get the autopilot settings for one-off calls.
167+
168+
Returns:
169+
Dict with one-off autopilot settings
170+
"""
171+
config = _load_config()
172+
return config.get("one_off_autopilot_settings", {})

.github/ACDbot/scripts/handle_protocol_call.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from modules.mapping_manager import MappingManager
2222
from modules.datetime_utils import generate_savvytime_link, format_datetime_for_discourse, format_datetime_for_stream_display
2323
from modules.logging_config import get_logger, log_success, log_resource_status, log_api_call, should_log_debug
24-
from modules.call_series_config import get_autopilot_defaults, has_autopilot_support, get_default_autopilot_settings
24+
from modules.call_series_config import get_autopilot_defaults, has_autopilot_support, get_default_autopilot_settings, get_one_off_autopilot_settings
2525

2626

2727
class ProtocolCallHandler:
@@ -112,20 +112,11 @@ def _apply_autopilot_defaults(self, form_data: Dict, issue) -> Dict:
112112

113113
# Check if this is a one-off call
114114
if call_series and call_series.startswith("one-off"):
115-
self.logger.info("Autopilot mode enabled but call is one-off - using user-provided values")
116-
# Post informational comment
117-
try:
118-
comment_text = """ℹ️ **Autopilot Note**
119-
120-
Autopilot mode was enabled, but this is a one-time call. One-time calls don't have predefined defaults, so your provided configuration values have been used instead."""
121-
122-
issue.create_comment(comment_text)
123-
except Exception as e:
124-
self.logger.warning(f"Failed to post autopilot note: {e}")
125-
return form_data
126-
127-
# Get autopilot defaults for this series, or use system defaults
128-
defaults = get_autopilot_defaults(call_series)
115+
self.logger.info("Autopilot mode enabled for one-off call - applying one-off defaults")
116+
defaults = get_one_off_autopilot_settings()
117+
else:
118+
# Get autopilot defaults for this series, or use system defaults
119+
defaults = get_autopilot_defaults(call_series)
129120

130121
if not defaults:
131122
self.logger.info(f"No specific autopilot config for '{call_series}', using defaults")

.github/ACDbot/tests/unit/test_protocol_call_handler.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -557,25 +557,23 @@ def test_apply_autopilot_defaults_disabled(self):
557557
self.assertFalse(result["need_youtube_streams"])
558558

559559
def test_apply_autopilot_defaults_one_off_call(self):
560-
"""Test that autopilot posts notice for one-off calls."""
560+
"""Test that autopilot applies one-off defaults for one-off calls."""
561561
mock_issue = unittest.mock.MagicMock()
562562

563563
form_data = {
564564
"call_series": "one-off-123",
565565
"autopilot_mode": True,
566-
"duration": 60,
566+
"duration": 90,
567567
}
568568

569569
result = self.handler._apply_autopilot_defaults(form_data, mock_issue)
570570

571-
# Values should remain unchanged
571+
# One-off defaults should be applied
572572
self.assertEqual(result["duration"], 60)
573-
574-
# Should post informational comment
575-
mock_issue.create_comment.assert_called_once()
576-
comment_text = mock_issue.create_comment.call_args[0][0]
577-
self.assertIn("Autopilot Note", comment_text)
578-
self.assertIn("one-time call", comment_text)
573+
self.assertEqual(result["occurrence_rate"], "custom")
574+
self.assertFalse(result["need_youtube_streams"])
575+
self.assertTrue(result["display_zoom_link_in_invite"])
576+
self.assertFalse(result["skip_zoom_creation"])
579577

580578
def test_apply_autopilot_defaults_no_defaults_configured(self):
581579
"""Test autopilot with series that has no defaults uses system defaults."""

0 commit comments

Comments
 (0)