Skip to content

Commit 838ff0f

Browse files
committed
fix: outside diff range comments
1 parent 768c31d commit 838ff0f

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
@@ -134,7 +134,7 @@ def _assemble_tab_from_composer_data(
134134
if not bubble_id:
135135
continue
136136
bubble_entry = bubble_map.get(bubble_id)
137-
if not bubble_entry:
137+
if bubble_entry is None:
138138
continue
139139
if isinstance(bubble_entry, Bubble):
140140
bubble = bubble_entry
@@ -570,6 +570,16 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
570570
if not isinstance(cd, dict):
571571
parse_warnings.record_composer_skipped()
572572
continue
573+
try:
574+
composer = Composer.from_dict(cd, composer_id=composer_id)
575+
except SchemaError as e:
576+
_logger.warning(
577+
"Failed to parse Composer from composerData:%s: %s",
578+
composer_id,
579+
e,
580+
)
581+
parse_warnings.record_composer_skipped()
582+
continue
573583
try:
574584
if (
575585
composer_id not in composer_id_to_ws
@@ -579,7 +589,7 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
579589
global_db, composer_id,
580590
)
581591
pid = determine_project_for_conversation(
582-
cd, composer_id, project_layouts_map,
592+
composer, composer_id, project_layouts_map,
583593
project_name_map, workspace_path_map,
584594
workspace_entries, {}, composer_id_to_ws, invalid_workspace_ids,
585595
)
@@ -591,14 +601,13 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
591601
if assigned not in matching_ws_ids:
592602
continue
593603

594-
headers = cd.get("fullConversationHeadersOnly") or []
604+
headers = composer.full_conversation_headers_only
595605
if not headers:
596606
continue
597607

598-
title = cd.get("name") or f"Conversation {composer_id[:8]}"
608+
title = composer.name or f"Conversation {composer_id[:8]}"
599609

600-
_early_model_config = cd.get("modelConfig") or {}
601-
_early_model_name = _early_model_config.get("modelName")
610+
_early_model_name = composer.model_name_from_config()
602611
_early_model_names = [_early_model_name] if _early_model_name and _early_model_name != "default" else None
603612
if is_excluded_by_rules(rules, build_searchable_text(
604613
project_name=workspace_display_name,
@@ -614,7 +623,7 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
614623
tab_entry: dict = {
615624
"id": composer_id,
616625
"title": title,
617-
"timestamp": to_epoch_ms(cd.get("lastUpdatedAt")) or to_epoch_ms(cd.get("createdAt")) or int(datetime.now().timestamp() * 1000),
626+
"timestamp": to_epoch_ms(composer.last_updated_at) or to_epoch_ms(composer.created_at) or int(datetime.now().timestamp() * 1000),
618627
"messageCount": len(headers),
619628
}
620629
if tab_meta:

0 commit comments

Comments
 (0)