mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-02 01:29:23 +00:00
Remove restart infrastructure, generalize WASM channel setup (#493)
* refactor: remove restart infrastructure and generalize Telegram-specific code Remove the gateway restart mechanism (hot-activation works, restart won't fix activation failures) and generalize Telegram-specific hardcoded checks so all WASM channels get equal treatment. Part 1 - Remove restart infrastructure: - Remove needs_restart from ActionResponse, restart_requested from GatewayState - Remove gateway_restart_handler, /api/gateway/restart route, exit code 75 - Remove restart overlay JS/CSS (dead code - restartGateway() never called) - Surface actual activation errors instead of suggesting restart Part 2 - Generalize Telegram-specific code: - Replace telegram_owner_id: Option<i64> with generic wasm_channel_owner_ids: HashMap<String, i64> (backwards-compatible via TELEGRAM_OWNER_ID env var) - Pairing status check now applies to all active WASM channels - All channels get 3-step stepper in web UI, remove "coming soon" note - Remove dead setup_telegram() code (~700 lines) - Telegram's capabilities.json declares required_secrets, so the generic setup_wasm_channel() path handles it Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * test: add Settings::set() test for wasm_channel_owner_ids Addresses review feedback: verify that setting per-channel owner IDs via the dotted-path Settings::set() API works correctly with the new HashMap<String, i64> type. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(web): refresh extension stepper after pairing approval loadPairingRequests only refreshed the pairing section, not the stepper status. Call loadExtensions() instead so the stepper updates from "Awaiting Pairing" to "Active" immediately after approval. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
5f841554d5
commit
78878ad7ef
+28
-15
@@ -249,10 +249,10 @@ pub struct ChannelSettings {
|
||||
#[serde(default)]
|
||||
pub signal_group_allow_from: Option<String>,
|
||||
|
||||
/// Telegram owner user ID. When set, the bot only responds to this user.
|
||||
/// Captured during setup by having the user message the bot.
|
||||
/// Per-channel owner user IDs. When set, the channel only responds to this user.
|
||||
/// Key: channel name (e.g., "telegram"), Value: owner user ID.
|
||||
#[serde(default)]
|
||||
pub telegram_owner_id: Option<i64>,
|
||||
pub wasm_channel_owner_ids: std::collections::HashMap<String, i64>,
|
||||
|
||||
/// Enabled WASM channels by name.
|
||||
/// Channels not in this list but present in the channels directory will still load.
|
||||
@@ -1049,28 +1049,37 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_telegram_owner_id_db_round_trip() {
|
||||
fn test_wasm_channel_owner_ids_db_round_trip() {
|
||||
let mut settings = Settings::default();
|
||||
settings.channels.telegram_owner_id = Some(123456789);
|
||||
settings
|
||||
.channels
|
||||
.wasm_channel_owner_ids
|
||||
.insert("telegram".to_string(), 123456789);
|
||||
|
||||
let map = settings.to_db_map();
|
||||
let restored = Settings::from_db_map(&map);
|
||||
assert_eq!(restored.channels.telegram_owner_id, Some(123456789));
|
||||
assert_eq!(
|
||||
restored.channels.wasm_channel_owner_ids.get("telegram"),
|
||||
Some(&123456789)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_telegram_owner_id_default_none() {
|
||||
fn test_wasm_channel_owner_ids_default_empty() {
|
||||
let settings = Settings::default();
|
||||
assert_eq!(settings.channels.telegram_owner_id, None);
|
||||
assert!(settings.channels.wasm_channel_owner_ids.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_telegram_owner_id_via_set() {
|
||||
fn test_wasm_channel_owner_ids_via_set() {
|
||||
let mut settings = Settings::default();
|
||||
settings
|
||||
.set("channels.telegram_owner_id", "987654321")
|
||||
.set("channels.wasm_channel_owner_ids.telegram", "987654321")
|
||||
.unwrap();
|
||||
assert_eq!(settings.channels.telegram_owner_id, Some(987654321));
|
||||
assert_eq!(
|
||||
settings.channels.wasm_channel_owner_ids.get("telegram"),
|
||||
Some(&987654321)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1406,7 +1415,11 @@ mod tests {
|
||||
channels: ChannelSettings {
|
||||
http_enabled: true,
|
||||
http_port: Some(9090),
|
||||
telegram_owner_id: Some(12345),
|
||||
wasm_channel_owner_ids: {
|
||||
let mut m = std::collections::HashMap::new();
|
||||
m.insert("telegram".to_string(), 12345);
|
||||
m
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
heartbeat: HeartbeatSettings {
|
||||
@@ -1473,9 +1486,9 @@ mod tests {
|
||||
assert!(restored.channels.http_enabled, "http_enabled lost");
|
||||
assert_eq!(restored.channels.http_port, Some(9090), "http_port lost");
|
||||
assert_eq!(
|
||||
restored.channels.telegram_owner_id,
|
||||
Some(12345),
|
||||
"telegram_owner_id lost"
|
||||
restored.channels.wasm_channel_owner_ids.get("telegram"),
|
||||
Some(&12345),
|
||||
"wasm_channel_owner_ids lost"
|
||||
);
|
||||
assert!(restored.heartbeat.enabled, "heartbeat.enabled lost");
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user