Repository navigation
Release v0.51.304 — Release JT (stage-p2a — un-held terminal reaper + opt-in Docker GPU) #3757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -264,6 +264,29 @@ if [ "A${whoami}" == "Aroot" ]; then | |||||||||||||||||||||||||
| chmod 600 "$ENV_FILE" || error_exit "Failed to secure $ENV_FILE" | ||||||||||||||||||||||||||
| export _HW_ROOT_ENV_PATH="$ENV_FILE" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Preserve Docker --group-add supplemental groups (for example render/video | ||||||||||||||||||||||||||
| # for /dev/dri GPU access) when dropping privileges. `su` rebuilds the target | ||||||||||||||||||||||||||
| # user's groups from /etc/group, so host-passed numeric groups must be made | ||||||||||||||||||||||||||
| # visible to hermeswebui before re-entering as the runtime user. | ||||||||||||||||||||||||||
| for gid in $(id -G); do | ||||||||||||||||||||||||||
| if [ "$gid" = "0" ] || [ "$gid" = "$WANTED_GID" ]; then | ||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| group_name="$(getent group "$gid" | cut -d: -f1 || true)" | ||||||||||||||||||||||||||
| if [ -z "$group_name" ]; then | ||||||||||||||||||||||||||
| group_name="hostgpu${gid}" | ||||||||||||||||||||||||||
| groupadd -g "$gid" "$group_name" 2>/dev/null || true | ||||||||||||||||||||||||||
| group_name="$(getent group "$gid" | cut -d: -f1 || true)" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| if [ -z "$group_name" ]; then | ||||||||||||||||||||||||||
| echo "!! WARNING: Could not create supplemental group for GID $gid; GPU device access may be unavailable" | ||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| if [ -n "$group_name" ]; then | ||||||||||||||||||||||||||
| usermod -a -G "$group_name" hermeswebui 2>/dev/null || echo "!! WARNING: Could not add hermeswebui to supplemental group $group_name ($gid)" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
+281
to
+287
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # restart the script as hermeswebui set with the correct UID/GID this time | ||||||||||||||||||||||||||
| echo "-- Restarting as hermeswebui user with UID ${WANTED_UID} GID ${WANTED_GID}" | ||||||||||||||||||||||||||
| exec su -s /bin/bash -c "exec \"${script_fullname}\"" hermeswebui || error_exit "subscript failed" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||
|
|
||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||
|
|
||||||||||||||||||
| REPO = Path(__file__).resolve().parents[1] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def _repo_text(path): | ||||||||||||||||||
| return (REPO / path).read_text(encoding="utf-8") | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_dockerfile_gpu_libraries_are_opt_in(): | ||||||||||||||||||
| """The production image must stay CPU-only unless the GPU build arg is set.""" | ||||||||||||||||||
| dockerfile = _repo_text("Dockerfile") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "ARG INSTALL_GPU_LIBS=0" in dockerfile | ||||||||||||||||||
| assert 'if [ "$INSTALL_GPU_LIBS" = "1" ]' in dockerfile | ||||||||||||||||||
|
|
||||||||||||||||||
| opt_in_block = dockerfile[dockerfile.index("ARG INSTALL_GPU_LIBS=0"):] | ||||||||||||||||||
| for package in ( | ||||||||||||||||||
| "libva2", | ||||||||||||||||||
| "vainfo", | ||||||||||||||||||
| "mesa-va-drivers", | ||||||||||||||||||
| "intel-media-va-driver-non-free", | ||||||||||||||||||
| ): | ||||||||||||||||||
| assert package in opt_in_block, ( | ||||||||||||||||||
| f"{package} must only appear in the INSTALL_GPU_LIBS opt-in block." | ||||||||||||||||||
| ) | ||||||||||||||||||
| assert package not in dockerfile[:dockerfile.index("ARG INSTALL_GPU_LIBS=0")] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_dockerfile_handles_missing_intel_non_free_driver(): | ||||||||||||||||||
| """Debian slim repos may not expose the non-free Intel VA-API package.""" | ||||||||||||||||||
| dockerfile = _repo_text("Dockerfile") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "apt-cache show intel-media-va-driver-non-free" in dockerfile | ||||||||||||||||||
| assert "skipping Intel non-free VA-API driver" in dockerfile | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_docker_docs_show_gpu_build_command(): | ||||||||||||||||||
| docker_docs = _repo_text("docs/docker.md") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "Optional GPU runtime image" in docker_docs | ||||||||||||||||||
| assert "--build-arg INSTALL_GPU_LIBS=1" in docker_docs | ||||||||||||||||||
| assert "default Hermes WebUI Docker image stays CPU-only" in docker_docs | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_docker_docs_cover_intel_amd_dri_mapping(): | ||||||||||||||||||
| docker_docs = _repo_text("docs/docker.md") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "Intel and AMD VA-API" in docker_docs | ||||||||||||||||||
| assert "--device /dev/dri:/dev/dri" in docker_docs | ||||||||||||||||||
| assert "/dev/dri:/dev/dri" in docker_docs | ||||||||||||||||||
| assert "group_add:" in docker_docs | ||||||||||||||||||
| assert "video" in docker_docs | ||||||||||||||||||
| assert "render" in docker_docs | ||||||||||||||||||
| assert "vainfo" in docker_docs | ||||||||||||||||||
| assert "preserves Docker-provided supplemental groups" in docker_docs | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_docker_docs_cover_nvidia_host_runtime_guidance(): | ||||||||||||||||||
| docker_docs = _repo_text("docs/docker.md") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "NVIDIA Container Toolkit" in docker_docs | ||||||||||||||||||
| assert "--gpus all" in docker_docs | ||||||||||||||||||
| assert "gpus: all" in docker_docs | ||||||||||||||||||
| assert "host NVIDIA driver" in docker_docs | ||||||||||||||||||
| assert "host kernel drivers" in docker_docs | ||||||||||||||||||
| assert "NVIDIA runtime" in docker_docs | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_docker_docs_do_not_claim_native_gpu_passthrough_verification(): | ||||||||||||||||||
| docker_docs = _repo_text("docs/docker.md") | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "not a claim that native GPU passthrough was verified" in docker_docs | ||||||||||||||||||
| assert "depends on host drivers" in docker_docs | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_docker_init_preserves_supplemental_device_groups_for_runtime_user(): | ||||||||||||||||||
| docker_init = _repo_text("docker_init.bash") | ||||||||||||||||||
| root_phase = docker_init[:docker_init.index("exec su -s /bin/bash")] | ||||||||||||||||||
|
|
||||||||||||||||||
| assert "for gid in $(id -G)" in root_phase | ||||||||||||||||||
| assert "groupadd -g \"$gid\"" in root_phase | ||||||||||||||||||
| assert "Could not create supplemental group for GID $gid" in root_phase | ||||||||||||||||||
| assert "usermod -a -G \"$group_name\" hermeswebui" in root_phase | ||||||||||||||||||
| assert "Docker --group-add supplemental groups" in root_phase | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_changelog_mentions_optional_gpu_runtime_path(): | ||||||||||||||||||
| changelog = _repo_text("CHANGELOG.md") | ||||||||||||||||||
| unreleased = changelog[changelog.index("## [Unreleased]"):changelog.index("## [v0.51.293]")] | ||||||||||||||||||
|
Comment on lines
+90
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| assert "Optional GPU runtime image path" in unreleased | ||||||||||||||||||
| assert "INSTALL_GPU_LIBS=1" in unreleased | ||||||||||||||||||
| assert "supplemental device groups" in unreleased | ||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_terminal_descendant_reaper_lockis process-wide, so two concurrent calls for different terminal sessions block each other even thoughwaitpid(-pgid_A, …)andwaitpid(-pgid_B, …)are completely independent at the kernel level. The lock is only required to prevent two callers from racing on the same terminal's PGID. In practice the impact is negligible (each call exits after oneECHILDin the common case), but a per-session lock stored onTerminalSessionwould be more precise if this code ever needs to scale to many concurrent terminal closings.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!