Merge pull request #756 from AnishSarkar22/fix/google-calendar-connectors

fix: google calendar issues (composio & non-composio)
This commit is contained in:
Rohan Verma 2026-01-30 14:40:26 -08:00 committed by GitHub
commit 4e04b4053a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 54 additions and 39 deletions

View file

@ -246,15 +246,18 @@ class GoogleCalendarConnector:
dt_start = isoparse(start_date)
dt_end = isoparse(end_date)
# Set start to beginning of day (00:00:00) and end to end of day (23:59:59)
# This ensures same-date queries work (e.g., start=2026-01-23, end=2026-01-23)
# and matches the Composio connector behavior
if dt_start.tzinfo is None:
dt_start = dt_start.replace(tzinfo=pytz.UTC)
dt_start = dt_start.replace(hour=0, minute=0, second=0, tzinfo=pytz.UTC)
else:
dt_start = dt_start.astimezone(pytz.UTC)
dt_start = dt_start.astimezone(pytz.UTC).replace(hour=0, minute=0, second=0)
if dt_end.tzinfo is None:
dt_end = dt_end.replace(tzinfo=pytz.UTC)
dt_end = dt_end.replace(hour=23, minute=59, second=59, tzinfo=pytz.UTC)
else:
dt_end = dt_end.astimezone(pytz.UTC)
dt_end = dt_end.astimezone(pytz.UTC).replace(hour=23, minute=59, second=59)
if dt_start >= dt_end:
return [], (

View file

@ -191,10 +191,10 @@ async def index_google_calendar_events(
)
else:
calculated_start_date = datetime.now() - timedelta(
days=30
) # Use 30 days as default for calendar events
days=365
) # Use 365 days as default for calendar events (matches frontend)
logger.info(
f"No last_indexed_at found, using {calculated_start_date.strftime('%Y-%m-%d')} (30 days ago) as start date"
f"No last_indexed_at found, using {calculated_start_date.strftime('%Y-%m-%d')} (365 days ago) as start date"
)
# Use calculated dates if not provided
@ -209,23 +209,6 @@ async def index_google_calendar_events(
start_date_str = start_date
end_date_str = end_date
# If start_date and end_date are the same, adjust end_date to be one day later
# to ensure valid date range (start_date must be strictly before end_date)
if start_date_str == end_date_str:
# Parse the date and add one day to ensure valid range
dt = isoparse(end_date_str)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=pytz.UTC)
else:
dt = dt.astimezone(pytz.UTC)
# Add one day to end_date to make it strictly after start_date
dt_end = dt + timedelta(days=1)
end_date_str = dt_end.strftime("%Y-%m-%d")
logger.info(
f"Adjusted end_date from {end_date} to {end_date_str} "
f"to ensure valid date range (start_date must be strictly before end_date)"
)
await task_logger.log_task_progress(
log_entry,
f"Fetching Google Calendar events from {start_date_str} to {end_date_str}",

View file

@ -11,7 +11,13 @@ def get_model_context_window(model_name: str) -> int:
"""Get the total context window size for a model (input + output tokens)."""
try:
model_info = get_model_info(model_name)
context_window = model_info.get("max_input_tokens", 4096) # Default fallback
context_window = model_info.get("max_input_tokens")
# Handle case where key exists but value is None
if context_window is None:
print(
f"Warning: max_input_tokens is None for {model_name}, using default 4096 tokens."
)
return 4096 # Conservative fallback
return context_window
except Exception as e:
print(