Luci-mod-admin-full and luci-app-opkg don't depend on uhttpd-mod-ubus

Not sure if it should, but

make -C openwrt-imagebuilder-19.07.2-ramips-mt7620.Linux-x86_64 image PROFILE=miwifi-mini PACKAGES="-dnsmasq -firewall -iptables -ip6tables -kmod-ipt-offload -odhcp6c -odhcpd-ipv6only -ppp -ppp-mod-pppoe pciutils strace usbutils -wpad-basic wpad-openssl openssh-keygen mac-telnet-client mac-telnet-server luci-mod-admin-full luci-theme-bootstrap luci-app-opkg luci-proto-ipv6 procps-ng-free procps-ng-kill procps-ng-ps procps-ng-top procps-ng-uptime procps-ng-watch dmesg bind-host diffutils hostapd-utils ip-bridge ip-full lsof tcpdump terminfo iperf3 vim-fuller -dropbear openssh-server openssh-sftp-server openssh-client openssh-sftp-client"

produces the image with unworkable web interface as it has no uhttpd and uhttpd-mod-ubus. The solution is to add uhttpd-mod-ubus. But for example luci-app-attendedsysupgrade depends on uhttpd-mod-ubus.

Well, you have not even packaged in the normal "luci", as you do not include the luci meta-package itself, but have included individual packages from its definition list, but not all of them. You have left out uhttpd from you package list.
https://git.openwrt.org/?p=project/luci.git;a=blob;f=collections/luci/Makefile;h=739eb51bc1c76d105f72281c07ae5fc7135a64a9;hb=refs/heads/openwrt-19.07#l14

And your uhttpd-mod-ubus requires uhttpd.
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/uhttpd/Makefile;h=fe4d0aaaed51def5b3fcac36baba1fddfb0d935a;hb=HEAD#l65
(see line 68: DEPENDS:=uhttpd +libubus +libblobmsg-json)

If you explicitly leave out uhttpd, you can't include sub-packages that require it.

  1. I've tried to include uhttpd but it doesn't solve the problem: without uhttpd-mod-ubus it says: Error: No related RPC reply
  2. Why luci-app-attendedsysupgrade depends on uhttpd-mod-ubus while luci-mod-admin-full or luci-app-opkg does not?

Likely because it uses functions provided by uhttpd-mod-ubus

You should include both of them. Your preferred packages require uhttpd-mod-ubus and that requires uhttpd.

If preferred packages require uhttpd-mod-ubus then them should depend on uhttpd-mod-ubus, is not it?

Could you say, why and will uhttpd-mod-ubus be installed with luci package. uhttpd-mod-ubus doesn't depend on luci directly, but looks like luci isn't functional without uhttpd-mod-ubus?

The dependency chain is a bit more complex:

But as uhttpd-mod-ubus requires uhttpd, which you have left out, the uhttpd-mod-ubus package can't be installed.

If you would have included the normal "luci", or even all the needed components of it separately, everything would be fine. But if you leave out uhttpd, you run into problems.

Core LuCI itself does not require uhttpd-mod-ubus.

Ps. uhttpd is the underlying webserver component, so I wonder why you leave that out and still expect a GUI.

It's not true. uhttpd-mod-ubus depends on uhttpd so specifying only uhttpd-mod-ubus will add uhttpd automatically.

No.
uhttpd-mod-ubus does NOT select uhttpd automatically.

I worded my response above carefully:

uhttpd-mod-ubus is available only if you have installed uhttpd

DEPENDS:=uhttpd +libubus +libblobmsg-json

There is no "+" before uhttpd, so it does not get selected automatically.

Sorry, I didn't know about "+" meaning, but it adds uhttpd when I add uhttpd-mod-ubus, you can check it yourself:

make -C openwrt-imagebuilder-19.07.2-ramips-mt7620.Linux-x86_64 image PROFILE=miwifi-mini PACKAGES="-dnsmasq -firewall -iptables -ip6tables -kmod-ipt-offload -odhcp6c -odhcpd-ipv6only -ppp -ppp-mod-pppoe pciutils strace usbutils -wpad-basic wpad-openssl openssh-keygen mac-telnet-client mac-telnet-server uhttpd-mod-ubus luci-mod-admin-full luci-theme-bootstrap luci-app-opkg luci-proto-ipv6 procps-ng-free procps-ng-kill procps-ng-ps procps-ng-top procps-ng-uptime procps-ng-watch dmesg bind-host diffutils hostapd-utils ip-bridge ip-full lsof tcpdump terminfo iperf3 vim-fuller -dropbear openssh-server openssh-sftp-server openssh-client openssh-sftp-client"
...
Building images for ramips - Xiaomi MiWiFi Mini
Packages: pciutils strace usbutils wpad-openssl openssh-keygen mac-telnet-client mac-telnet-server uhttpd-mod-ubus luci-mod-admin-full luci-theme-bootstrap luci-app-opkg luci-proto-ipv6 procps-ng-free procps-ng-kill procps-ng-ps procps-ng-top procps-ng-uptime procps-ng-watch dmesg bind-host diffutils hostapd-utils ip-bridge ip-full lsof tcpdump terminfo iperf3 vim-fuller openssh-server openssh-sftp-server openssh-client openssh-sftp-client base-files busybox fstools kernel kmod-gpio-button-hotplug kmod-leds-gpio kmod-mt76x2 kmod-rt2800-soc kmod-usb-ohci kmod-usb2 libc libgcc logd mtd netifd opkg swconfig uci uclient-fetch urandom-seed urngd
...
Installing uhttpd-mod-ubus (2020-02-12-2ee323c0-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/base/uhttpd-mod-ubus_2020-02-12-2ee323c0-1_mipsel_24kc.ipk
...
Installing uhttpd (2020-02-12-2ee323c0-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.2/packages/mipsel_24kc/base/uhttpd_2020-02-12-2ee323c0-1_mipsel_24kc.ipk
...
Configuring uhttpd.
...
Configuring uhttpd-mod-ubus.
...
Enabling uhttpd                                                                                                                                      

Another question is: if I do

% make PROFILE=miwifi-mini PACKAGES="luci" image

uhttpd will be included, but uhttpd-mod-ubus will not, so luci will fail with Error: No related RPC reply. So why luci or luci-mod-admin-full or luci-app-opkg doesn't depend on uhttpd-mod-ubus?

LuCI provides a fallback emulation for uhttpd-mod-ubus. Upon loading, luci.js will first send a test HTTP request to /ubus/ to see if it exists. If the test requests result in a 404 error, the ui will fall back to the Lua emulation at /cgi-bin/luci/admin/ubus.

I do plan to make uttpd-mod-ubus mandatory though as it is significantly faster than the emulation.