Skip to content

Commit 899514c

Browse files
authored
fix(explorer): allow None file patches and log error (#104559)
Should fix broken explorer polling
1 parent c176899 commit 899514c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/sentry/seer/endpoints/organization_seer_explorer_chat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def get(
8585
except SeerPermissionError as e:
8686
raise PermissionDenied(e.message) from e
8787
except ValueError:
88+
logger.exception("Error getting Explorer run state")
8889
return Response({"session": None}, status=404)
8990

9091
def post(

src/sentry/seer/explorer/client_models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class MemoryBlock(BaseModel):
9292
timestamp: str
9393
loading: bool = False
9494
artifacts: list[Artifact] = []
95-
file_patches: list[ExplorerFilePatch] = []
95+
file_patches: list[ExplorerFilePatch] | None = None
9696
pr_commit_shas: dict[str, str] | None = (
9797
None # repository name -> commit SHA. Used to track which commit was associated with each repo's PR at the time this block was created.
9898
)
@@ -159,7 +159,7 @@ def get_file_patches_by_repo(self) -> dict[str, list[ExplorerFilePatch]]:
159159
"""Get file patches grouped by repository."""
160160
by_repo: dict[str, list[ExplorerFilePatch]] = {}
161161
for block in self.blocks:
162-
for fp in block.file_patches:
162+
for fp in block.file_patches or []:
163163
if fp.repo_name not in by_repo:
164164
by_repo[fp.repo_name] = []
165165
by_repo[fp.repo_name].append(fp)
@@ -177,7 +177,7 @@ def _is_repo_synced(self, repo_name: str) -> bool:
177177

178178
# Find last block with patches for this repo
179179
for block in reversed(self.blocks):
180-
if any(fp.repo_name == repo_name for fp in block.file_patches):
180+
if any(fp.repo_name == repo_name for fp in (block.file_patches or [])):
181181
block_sha = (block.pr_commit_shas or {}).get(repo_name)
182182
return block_sha == pr_state.commit_sha
183183
return True # No patches found = synced

0 commit comments

Comments
 (0)