async def update_sync_job_status_activity(
    sync_job_id: str,
    status: str,
    user_dict: Dict[str, Any],
    error: Optional[str] = None,
    failed_at: Optional[str] = None,
) -> None:
    """Activity to update sync job status.

    This activity is used to update the sync job status when errors occur
    or when the workflow is cancelled.

    Args:
        sync_job_id: The sync job ID
        status: The new status (e.g., "FAILED", "CANCELLED")
        user_dict: The current user as dict
        error: Optional error message
        failed_at: Optional timestamp when the job failed
    """
    # Import here to avoid Temporal sandboxing issues
    from airweave import schemas
    from airweave.core.shared_models import SyncJobStatus
    from airweave.core.sync_job_service import sync_job_service

    # Convert user dict back to Pydantic model
    user = schemas.User(**user_dict)

    # Convert string status to enum
    status_enum = SyncJobStatus[status]

    # Convert failed_at string to datetime if provided
    failed_at_dt = datetime.fromisoformat(failed_at) if failed_at else None

    activity.logger.info(f"Updating sync job {sync_job_id} status to {status}")

    try:
        await sync_job_service.update_status(
            sync_job_id=UUID(sync_job_id),
            status=status_enum,
            current_user=user,
            error=error,
            failed_at=failed_at_dt,
        )
        activity.logger.info(f"Successfully updated sync job {sync_job_id} status to {status}")
    except Exception as e:
        activity.logger.error(f"Failed to update sync job {sync_job_id} status: {e}")
        raise
Activity to update sync job status.

    This activity is used to update the sync job status when errors occur
    or when the workflow is cancelled.

    Args:
        sync_job_id: The sync job ID
        status: The new status (e.g., "FAILED", "CANCELLED")
        user_dict: The current user as dict
        error: Optional error message
        failed_at: Optional timestamp when the job failed
    
backend/airweave/platform/temporal/activities.py