Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

refactor: Remove backward compatibility for old session mapping format

cyhhao3a0855cf9555
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index 61d024516..feabb71bf 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -191,17 +191,12 @@ class SessionHandler:
restored_count = 0
for user_id, user_settings in all_settings.items():
if hasattr(user_settings, 'session_mappings') and user_settings.session_mappings:
- # Handle both old flat structure and new nested structure
- for key, value in user_settings.session_mappings.items():
- if isinstance(value, dict):
- # New nested structure: {base_session_id: {path: claude_session_id}}
- logger.info(f"Found {len(value)} path mappings for {key} (user {user_id})")
- for path, claude_session_id in value.items():
- logger.info(f" - {key}[{path}] -> {claude_session_id}")
+ # Only handle new nested structure: {base_session_id: {path: claude_session_id}}
+ for base_session_id, path_mappings in user_settings.session_mappings.items():
+ if isinstance(path_mappings, dict):
+ logger.info(f"Found {len(path_mappings)} path mappings for {base_session_id} (user {user_id})")
+ for path, claude_session_id in path_mappings.items():
+ logger.info(f" - {base_session_id}[{path}] -> {claude_session_id}")
restored_count += 1
- else:
- # Old flat structure (for backward compatibility)
- logger.info(f" - {key} -> {value} (legacy format)")
- restored_count += 1
logger.info(f"Session restoration complete. Restored {restored_count} session mappings.")
\ No newline at end of file
diff --git a/modules/settings_manager.py b/modules/settings_manager.py
index dbe4eb816..621ba9184 100644
--- a/modules/settings_manager.py
+++ b/modules/settings_manager.py
@@ -42,6 +42,15 @@ class SettingsManager:
with open(self.settings_file, 'r') as f:
data = json.load(f)
for user_id_str, user_data in data.items():
+ # Clean up old format session mappings, only keep nested dict format
+ if 'session_mappings' in user_data:
+ cleaned_mappings = {}
+ for key, value in user_data['session_mappings'].items():
+ # Only keep nested dictionary format
+ if isinstance(value, dict):
+ cleaned_mappings[key] = value
+ user_data['session_mappings'] = cleaned_mappings
+
# Try to convert to int for Telegram, keep as string for Slack
try:
user_id = int(user_id_str)