diff --git a/.storkit/work/1_backlog/400_bug_whatsapp_and_slack_missing_reset_command_handler.md b/.storkit/work/1_backlog/400_bug_whatsapp_and_slack_missing_reset_command_handler.md index 1fbc3a5f..0fc8931c 100644 --- a/.storkit/work/1_backlog/400_bug_whatsapp_and_slack_missing_reset_command_handler.md +++ b/.storkit/work/1_backlog/400_bug_whatsapp_and_slack_missing_reset_command_handler.md @@ -10,7 +10,21 @@ The reset command has a fallback handler in chat/commands/mod.rs that returns No ## Implementation Note -The fix must be in the shared command dispatch layer (chat/commands/mod.rs), NOT by adding transport-specific handlers. Study how commands like "rebuild" and "status" already work through the shared dispatch — the reset handler should return a concrete result from try_handle_command so all transports get it for free. We do not want separate mechanisms per transport per command. +Follow the **rebuild pattern** established in story 402, with one complication: `handle_reset` in `server/src/chat/transport/matrix/reset.rs` takes a Matrix-specific `ConversationHistory` (`Arc>>`), so it cannot be called directly from WhatsApp or Slack. + +**WhatsApp session storage** (`server/src/chat/transport/whatsapp.rs`): +- Type: `WhatsAppConversationHistory = Arc>>` (key = sender phone number) +- Persisted to `.storkit/whatsapp_history.json` via `save_whatsapp_history` + +**Slack session storage** (`server/src/chat/transport/slack.rs`): +- Type: `SlackConversationHistory = Arc>>` (key = channel ID) +- Persisted to `.storkit/slack_history.json` via `save_slack_history` + +**Approach:** +- Use `extract_reset_command` from `server/src/chat/transport/matrix/reset.rs` to detect the command (it works transport-agnostically) +- Implement the reset inline in each transport's async message handler: clear `session_id` and `entries` for the sender/channel key, call the transport's own `save_*_history`, reply with confirmation +- Add async intercepts in `whatsapp.rs` (~line 1107, after the rebuild intercept) and `slack.rs` (~line 845, after the rebuild intercept) +- The fallback handler in `chat/commands/mod.rs` (`handle_reset_fallback`) stays as-is ## How to Reproduce