From fda6f613519a11414e11d0bdbbcad99b107a1542 Mon Sep 17 00:00:00 2001 From: Roy Osherove <575051+royosherove@users.noreply.github.com> Date: Sat, 22 Aug 2026 23:36:26 +0000 Subject: [PATCH 1/2] fix(kirocrew): install Playwright deps via dnf on AL2023 (Codex P1 on #94) Codex flagged: playwright-cli install-browser --with-deps shells out to apt-get unconditionally. On AL2023 (the deploy target) that fails silently at the deps phase, browser install falls through to the warn-and-continue path, and Chromium is left unusable at runtime. Root cause confirmed by upstream tracking: https://github.com/amazonlinux/amazon-linux-2023/issues/820 'when i install playwright using pip in amazon linux 2023 first of all it recognized it as an ubuntu system and runs apt commands to download its packages, ultimately it fails, i have to manually install the required packages...' AWS has not shipped an AL2023 fix; the community workaround is manual dnf install of the runtime libs. This PR implements that workaround. Split the install into three sub-steps: 2a. Distro-detect via /etc/os-release; if RHEL-family (amzn/rhel/ fedora/centos/rocky/almalinux), sudo dnf install the runtime libraries. Package list per Roy's confirmed AL2023 recipe: libXcomposite libXdamage libXrandr nss alsa-lib atk cups-libs gtk3 libdrm mesa-libgbm pango libicu woff2 Skip step on non-dnf distros with an info line (defensive). 2b. playwright-cli install-browser (no --with-deps). 2c. playwright-cli install --skills (agent skills, non-fatal). All steps warn-not-fail individually. Failure of 2a doesn't abort 2b/2c; the browser install can still succeed and the agent surfaces the runtime error clearly if libs are missing. Verified: bash -n packs/kirocrew/install.sh: OK. Diff: +46 / -8. --- packs/kirocrew/install.sh | 54 +++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/packs/kirocrew/install.sh b/packs/kirocrew/install.sh index 12f0d69..671fc2b 100755 --- a/packs/kirocrew/install.sh +++ b/packs/kirocrew/install.sh @@ -358,16 +358,54 @@ if command -v npm >/dev/null 2>&1; then ln -sfn "${_pw_bin}" "${_pw_link_dir}/playwright-cli" ok "Symlinked ${_pw_link_dir}/playwright-cli -> ${_pw_bin} (for kirocrew-gateway systemd unit PATH)" - # 2. Install Chromium + system deps. --with-deps invokes sudo to install - # system libraries via the OS package manager (dnf on AL2023). - # Chromium binary goes to ~/.cache/ms-playwright/ (per-user cache, - # which is what the kirocrew-gateway process reads since it runs - # as ec2-user). - log "Installing Chromium browser + system dependencies (may take 1-3 minutes)..." - if playwright-cli install-browser --with-deps 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then + # 2a. Install Chromium system deps via dnf (AL2023 uses dnf, not apt-get). + # Playwright's --with-deps flag shells out to apt-get unconditionally, + # so on AL2023 it silently fails the deps phase and Chromium is left + # unusable at runtime (Codex P1 on PR #94). + # Package list per Roy's confirmed AL2023 recipe (2026-08-22 23:35 UTC): + _pw_dnf_pkgs=( + libXcomposite libXdamage libXrandr nss alsa-lib atk cups-libs + gtk3 libdrm mesa-libgbm pango libicu woff2 + ) + # Distro guard: only run dnf on RHEL-family. On other distros we skip the + # deps step; the browser install still runs and the agent surfaces a clear + # runtime error if libs are missing. + _pw_is_dnf_distro=false + if [[ -r /etc/os-release ]]; then + # shellcheck source=/dev/null + _os_id="$(. /etc/os-release && echo "${ID:-} ${ID_LIKE:-}")" + case "$_os_id" in + *amzn*|*rhel*|*fedora*|*centos*|*rocky*|*almalinux*) _pw_is_dnf_distro=true ;; + esac + fi + if [[ "$_pw_is_dnf_distro" == true ]] && command -v dnf >/dev/null 2>&1; then + log "Installing Chromium runtime libs via dnf (AL2023): ${_pw_dnf_pkgs[*]}" + if sudo dnf install -y -q "${_pw_dnf_pkgs[@]}" 2>&1 | while IFS= read -r line; do log " dnf: ${line}"; done; then + ok "Chromium runtime libs installed via dnf" + else + warn "dnf install of Chromium libs returned non-zero — browser may fail at launch; check dnf log" + fi + else + info "Non-dnf distro or dnf unavailable — skipping RPM deps; browser install will still run" + fi + unset _pw_dnf_pkgs _pw_is_dnf_distro _os_id + + # 2b. Install Chromium binary itself (~/.cache/ms-playwright/, per-user). + # No --with-deps: system libs handled by 2a above on AL2023. + log "Installing Chromium browser binary (may take 30-90s)..." + if playwright-cli install-browser 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then ok "Chromium browser installed under ~/.cache/ms-playwright/" else - warn "playwright-cli install-browser failed — agent can retry on first use, but may need sudo for --with-deps (non-fatal)" + warn "playwright-cli install-browser failed — agent can retry on first use (non-fatal)" + fi + + # 2c. Install agent skills so KiroCrew has richer command context. + # Non-fatal: agent works without skills but with less introspection. + log "Installing Playwright agent skills..." + if playwright-cli install --skills 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then + ok "Playwright agent skills installed" + else + warn "playwright-cli install --skills failed — non-fatal (agent still usable via --help discovery)" fi else warn "@playwright/cli installed but 'playwright-cli' not on PATH; skipping browser install" From 8b873b51fb990e4f6fe4373e2b02f7602b3c7aef Mon Sep 17 00:00:00 2001 From: Roy Osherove <575051+royosherove@users.noreply.github.com> Date: Sat, 22 Aug 2026 23:43:23 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix(kirocrew):=20Codex=20P1s=20on=20#96=20?= =?UTF-8?q?=E2=80=94=20remove=20undefined=20info,=20keep=20--with-deps=20f?= =?UTF-8?q?or=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two P1s from Codex review of the AL2023-fix PR: P1 #1 (line 389): 'info' isn't defined in packs/common.sh (only log/ok/fail/warn). Under set -e the installer would terminate on non-dnf hosts before Chromium ever installs. P1 #2 (line 396): I dropped --with-deps for the entire distro branch, but manifest.yaml lists ubuntu2204 as supported. On Ubuntu, Playwright's --with-deps IS the correct path (apt-get is what Playwright actually invokes there). Only AL2023 needed the manual dnf detour. Fix — three-branch distro dispatch: 1. RHEL-family (amzn/rhel/fedora/centos/rocky/almalinux): sudo dnf install the explicit RPM list, then install-browser WITHOUT --with-deps. 2. Debian-family (ubuntu/debian): install-browser --with-deps (unchanged from original PR #94). 3. Unknown distro: install-browser --with-deps as a best-effort with a 'log' line (not 'info') noting the unknown distro. Warn on failure. Distro detection unchanged: /etc/os-release ID/ID_LIKE match against the two families. Verified: bash -n packs/kirocrew/install.sh OK. Diff on top of fda6f61. --- packs/kirocrew/install.sh | 76 ++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/packs/kirocrew/install.sh b/packs/kirocrew/install.sh index 671fc2b..5d80e20 100755 --- a/packs/kirocrew/install.sh +++ b/packs/kirocrew/install.sh @@ -358,46 +358,74 @@ if command -v npm >/dev/null 2>&1; then ln -sfn "${_pw_bin}" "${_pw_link_dir}/playwright-cli" ok "Symlinked ${_pw_link_dir}/playwright-cli -> ${_pw_bin} (for kirocrew-gateway systemd unit PATH)" - # 2a. Install Chromium system deps via dnf (AL2023 uses dnf, not apt-get). + # 2a. Install Chromium system deps via the right package manager. # Playwright's --with-deps flag shells out to apt-get unconditionally, # so on AL2023 it silently fails the deps phase and Chromium is left - # unusable at runtime (Codex P1 on PR #94). - # Package list per Roy's confirmed AL2023 recipe (2026-08-22 23:35 UTC): - _pw_dnf_pkgs=( - libXcomposite libXdamage libXrandr nss alsa-lib atk cups-libs - gtk3 libdrm mesa-libgbm pango libicu woff2 - ) - # Distro guard: only run dnf on RHEL-family. On other distros we skip the - # deps step; the browser install still runs and the agent surfaces a clear - # runtime error if libs are missing. - _pw_is_dnf_distro=false + # unusable at runtime (Codex P1 on PR #94, confirmed by AL2023 issue + # #820: https://github.com/amazonlinux/amazon-linux-2023/issues/820). + # + # Strategy: + # - RHEL-family (amzn/rhel/fedora/centos/rocky/almalinux): sudo dnf + # install an explicit RPM package list, then install-browser + # WITHOUT --with-deps (--with-deps would still try apt-get). + # - Debian-family (ubuntu/debian): keep the original + # install-browser --with-deps path since apt-get is what + # Playwright actually invokes there. + # - Unknown distro: try install-browser --with-deps as a best + # effort; agent surfaces a runtime error if libs are missing. + _pw_distro_family="unknown" if [[ -r /etc/os-release ]]; then # shellcheck source=/dev/null _os_id="$(. /etc/os-release && echo "${ID:-} ${ID_LIKE:-}")" case "$_os_id" in - *amzn*|*rhel*|*fedora*|*centos*|*rocky*|*almalinux*) _pw_is_dnf_distro=true ;; + *amzn*|*rhel*|*fedora*|*centos*|*rocky*|*almalinux*) _pw_distro_family="rhel" ;; + *ubuntu*|*debian*) _pw_distro_family="debian" ;; esac fi - if [[ "$_pw_is_dnf_distro" == true ]] && command -v dnf >/dev/null 2>&1; then - log "Installing Chromium runtime libs via dnf (AL2023): ${_pw_dnf_pkgs[*]}" + + if [[ "$_pw_distro_family" == "rhel" ]] && command -v dnf >/dev/null 2>&1; then + # Package list per Roy's confirmed AL2023 recipe (2026-08-22). + _pw_dnf_pkgs=( + libXcomposite libXdamage libXrandr nss alsa-lib atk cups-libs + gtk3 libdrm mesa-libgbm pango libicu woff2 + ) + log "Installing Chromium runtime libs via dnf (AL2023-family): ${_pw_dnf_pkgs[*]}" if sudo dnf install -y -q "${_pw_dnf_pkgs[@]}" 2>&1 | while IFS= read -r line; do log " dnf: ${line}"; done; then ok "Chromium runtime libs installed via dnf" else warn "dnf install of Chromium libs returned non-zero — browser may fail at launch; check dnf log" fi - else - info "Non-dnf distro or dnf unavailable — skipping RPM deps; browser install will still run" - fi - unset _pw_dnf_pkgs _pw_is_dnf_distro _os_id + unset _pw_dnf_pkgs + + # 2b. Install Chromium binary itself. No --with-deps: apt-get path + # doesn't exist on AL2023, and libs were just installed via dnf. + log "Installing Chromium browser binary (may take 30-90s)..." + if playwright-cli install-browser 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then + ok "Chromium browser installed under ~/.cache/ms-playwright/" + else + warn "playwright-cli install-browser failed — agent can retry on first use (non-fatal)" + fi + + elif [[ "$_pw_distro_family" == "debian" ]]; then + # Ubuntu / Debian: Playwright's --with-deps IS supported here and + # actually invokes apt-get correctly. Keep the original combined path. + log "Installing Chromium browser + system dependencies via apt (debian-family, may take 1-3 minutes)..." + if playwright-cli install-browser --with-deps 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then + ok "Chromium browser + apt deps installed" + else + warn "playwright-cli install-browser --with-deps failed — agent can retry on first use (non-fatal)" + fi - # 2b. Install Chromium binary itself (~/.cache/ms-playwright/, per-user). - # No --with-deps: system libs handled by 2a above on AL2023. - log "Installing Chromium browser binary (may take 30-90s)..." - if playwright-cli install-browser 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then - ok "Chromium browser installed under ~/.cache/ms-playwright/" else - warn "playwright-cli install-browser failed — agent can retry on first use (non-fatal)" + # Unknown distro (not RHEL, not Debian): best-effort. + log "Distro '${_os_id:-unknown}' not recognized as RHEL or Debian family. Attempting playwright's built-in --with-deps..." + if playwright-cli install-browser --with-deps 2>&1 | while IFS= read -r line; do log " playwright: ${line}"; done; then + ok "Chromium browser installed (best-effort on unknown distro)" + else + warn "playwright-cli install-browser --with-deps failed on unknown distro '${_os_id:-unknown}' — may need manual system-lib install" + fi fi + unset _pw_distro_family _os_id # 2c. Install agent skills so KiroCrew has richer command context. # Non-fatal: agent works without skills but with less introspection.