Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix: pollins-size-ms (#64932)

Alex V5aa3d94a03b6
diff --git a/products/conversations/backend/tasks.py b/products/conversations/backend/tasks.py
index e97fefb12b1a..c7685b92573a 100644
--- a/products/conversations/backend/tasks.py
+++ b/products/conversations/backend/tasks.py
@@ -904,6 +904,8 @@ def _parse_graph_datetime(value: str | None) -> datetime | None:
TEAMS_DELTA_MAX_PAGES_PER_RUN = 20
TEAMS_DELTA_REQUEST_TIMEOUT_SECONDS = 30
TEAMS_REPLIES_MAX_PAGES_PER_TICKET = 5
+# Graph list-replies caps $top at 50; larger values return 400 Bad Request.
+TEAMS_REPLIES_PAGE_SIZE = 50
# Cap the number of tickets whose threads we poll per channel per run.
# Oldest-synced tickets are polled first so the sweep round-robins through
# the backlog across successive every-minute runs.
@@ -946,7 +948,8 @@ def _sync_one_ticket_thread_replies(
latest_synced_at = ticket.teams_thread_replies_synced_at
url: str | None = (
- f"{GRAPH_API_BASE}/teams/{teams_team_id}/channels/{channel_id}/messages/{root_message_id}/replies?$top=200"
+ f"{GRAPH_API_BASE}/teams/{teams_team_id}/channels/{channel_id}/messages/{root_message_id}/replies"
+ f"?$top={TEAMS_REPLIES_PAGE_SIZE}"
)
headers = {"Authorization": f"Bearer {token}"}
pages = 0
@@ -974,7 +977,9 @@ def _sync_one_ticket_thread_replies(
team_id=team.id,
channel_id=channel_id,
ticket_id=str(ticket.id),
+ root_message_id=root_message_id,
status=resp.status_code,
+ body=resp.text[:500],
)
return