Skip to content

Commit 6d3f168

Browse files
committed
fix: outside diff range comments
1 parent 2e51b5f commit 6d3f168

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

services/workspace_tabs.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _assemble_tab_from_composer_data(
131131
if not bubble_id:
132132
continue
133133
bubble_entry = bubble_map.get(bubble_id)
134-
if not bubble_entry:
134+
if bubble_entry is None:
135135
continue
136136
if isinstance(bubble_entry, Bubble):
137137
bubble = bubble_entry
@@ -571,6 +571,16 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
571571
if not isinstance(cd, dict):
572572
parse_warnings.record_composer_skipped()
573573
continue
574+
try:
575+
composer = Composer.from_dict(cd, composer_id=composer_id)
576+
except SchemaError as e:
577+
_logger.warning(
578+
"Failed to parse Composer from composerData:%s: %s",
579+
composer_id,
580+
e,
581+
)
582+
parse_warnings.record_composer_skipped()
583+
continue
574584
try:
575585
if (
576586
composer_id not in composer_id_to_ws
@@ -580,7 +590,7 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
580590
global_db, composer_id,
581591
)
582592
pid = determine_project_for_conversation(
583-
cd, composer_id, project_layouts_map,
593+
composer, composer_id, project_layouts_map,
584594
project_name_map, workspace_path_map,
585595
workspace_entries, {}, composer_id_to_ws, invalid_workspace_ids,
586596
)
@@ -592,14 +602,13 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
592602
if assigned not in matching_ws_ids:
593603
continue
594604

595-
headers = cd.get("fullConversationHeadersOnly") or []
605+
headers = composer.full_conversation_headers_only
596606
if not headers:
597607
continue
598608

599-
title = cd.get("name") or f"Conversation {composer_id[:8]}"
609+
title = composer.name or f"Conversation {composer_id[:8]}"
600610

601-
_early_model_config = cd.get("modelConfig") or {}
602-
_early_model_name = _early_model_config.get("modelName")
611+
_early_model_name = composer.model_name_from_config()
603612
_early_model_names = [_early_model_name] if _early_model_name and _early_model_name != "default" else None
604613
if is_excluded_by_rules(rules, build_searchable_text(
605614
project_name=workspace_display_name,
@@ -615,7 +624,7 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
615624
tab_entry: dict = {
616625
"id": composer_id,
617626
"title": title,
618-
"timestamp": to_epoch_ms(cd.get("lastUpdatedAt")) or to_epoch_ms(cd.get("createdAt")) or int(datetime.now().timestamp() * 1000),
627+
"timestamp": to_epoch_ms(composer.last_updated_at) or to_epoch_ms(composer.created_at) or int(datetime.now().timestamp() * 1000),
619628
"messageCount": len(headers),
620629
}
621630
if tab_meta:

0 commit comments

Comments
 (0)