Skip to content

Preinstall Chromium runtime libraries in the agent image - #8022

Merged
lpcox merged 4 commits into
mainfrom
copilot/awf-agent-container-fix-runtime-libs
Sep 3, 2026
Merged

Preinstall Chromium runtime libraries in the agent image#8022
lpcox merged 4 commits into
mainfrom
copilot/awf-agent-container-fix-runtime-libs

Conversation

Copilot AI commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Playwright-managed browsers fail to launch inside the sandbox (libnspr4.so: cannot open shared object file) because the agent image ships a minimal Ubuntu base and uses selective bind mounts, so Chromium's native dependencies are neither in the image nor reachable from the host.

Changes

  • containers/agent/Dockerfile: adds a BROWSER_PKGS list (Chromium/Playwright shared libs + fonts-liberation) to the existing single apt layer. Transitive deps (fontconfig, freetype, harfbuzz, …) come in automatically.
  • 22.04 / 24.04 compatibility: the same Dockerfile builds against ubuntu:22.04 (default preset) and catthehacker/ubuntu:act-24.04 (act preset). On 24.04 several of these names became ambiguous virtual packages (apt-get install libasound2has no installation candidate), so each package resolves to its t64 variant when the base image provides one:
for pkg in $BROWSER_PKGS; do \
  if apt-cache show "${pkg}t64" >/dev/null 2>&1; then \
    PKGS="$PKGS ${pkg}t64"; \
  else \
    PKGS="$PKGS $pkg"; \
  fi; \
done && \
apt_install_retry $PKGS && \
  • scripts/ci/agent-dockerfile-browser-deps.test.ts (new): asserts the required libs are declared under their base names, and executes the extracted resolution loop against a stubbed apt-cache to cover both the 22.04 passthrough and the 24.04 t64 preference. Follows the extract-and-run-the-shell-block pattern of agent-dockerfile-security.test.ts.
  • Docs: docs/agent-images.md + docs-site mirror list the preinstalled libraries; docs/troubleshooting.md gains a Playwright / Chromium Issues section (symptom, in-sandbox ldd verification, npx playwright install-deps chromium for custom base images, cdn.playwright.dev allowlist note).

Notes for reviewers

  • Image size grows by the browser lib set (~120 MB installed) on every agent image, including runs that never touch a browser. Worth confirming that tradeoff versus keeping the staged-sysroot approach used by scripts/ci/stage-playwright-loopback-smoke.sh.
  • The existing smoke-playwright-* workflows still stage their own sysroot; they are unchanged here and could be simplified in a follow-up once the new image ships.

Copilot AI changed the title [WIP] Fix missing Chromium/Playwright runtime libs in agent container Preinstall Chromium runtime libraries in the agent image Sep 2, 2026
Copilot AI requested a review from lpcox September 2, 2026 17:31
@lpcox
lpcox marked this pull request as ready for review September 2, 2026 19:50
Copilot AI balanced review requested due to automatic review settings September 2, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Image-installed libraries are hidden by the runtime chroot, and no integration test exercises the claimed behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds Chromium runtime dependencies to agent images for Playwright compatibility.

Changes:

  • Adds Ubuntu 22.04/24.04 package resolution.
  • Adds Dockerfile-focused dependency tests.
  • Documents browser dependencies and troubleshooting.
File summaries
File Description
containers/agent/Dockerfile Installs Chromium runtime libraries.
scripts/ci/agent-dockerfile-browser-deps.test.ts Tests package declaration and resolution.
docs/agent-images.md Documents preinstalled libraries.
docs-site/src/content/docs/reference/agent-images.md Mirrors agent-image documentation.
docs/troubleshooting.md Adds Playwright troubleshooting guidance.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +110 to +113
# Chromium/Playwright native runtime libraries. The agent uses selective bind
# mounts (not a full host filesystem mount), so Playwright-managed browsers
# cannot pick these up from the host and must be present in the image.
BROWSER_PKGS="libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1 fonts-liberation"; \
Comment on lines +101 to +102
it('installs the resolved browser packages with the other agent packages', () => {
expect(readDockerfile()).toMatch(/apt_install_retry \$PKGS/);
@lpcox

lpcox commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@lpcox

lpcox commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed both review threads in fa3ee21:

  • copy_browser_libs() is now wired into run_chroot_command(): it stages the manifest of .so files (recorded at build time in /usr/local/share/awf/browser-libs.manifest) under /run/awf-lib/browser-libs and exports LD_LIBRARY_PATH before exec, so the preinstalled libraries are no longer shadowed by the host bind mounts.
  • Added a fixture test in tests/entrypoint-phase-functions.test.sh that stages a fake library, overwrites the original path to simulate host bind-mount shadowing, and asserts the staged copy is unaffected — exercising the actual chroot behavior rather than just the apt-get package resolution.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 56882e7

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Docker Sbx

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Security Guard completed successfully!

Security review of PR #8022 complete — no security issues found. The PR adds Chromium/Playwright runtime library support via manifest-driven staging in the agent container. Changes maintain isolation model (uses container's writable /run/awf-lib, not bind-mounted), respect capability restrictions (no SYS_ADMIN/NET_RAW added), avoid firewall changes, use safe file operations with error handling, and properly update cleanup logic. No security regression detected.

Generated by Security Guard for #8022

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini reports failed. Facets need polishing...

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

Generated by Build Test Suite for #8022

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

Generated by Contribution Check for #8022

@lpcox
lpcox deployed to aoai-model September 2, 2026 23:59 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Smoke Claude for #8022

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct Mode) ✅ PASS

All systems operational. Agent responding normally with COPILOT_PROVIDER_API_KEY forwarded to sidecar.

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable — allowed=200
✅ Blocked domain (example.com) denied — CONNECT tunnel 403

Overall status: PASS

cc @lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine

Overall: PASS

@lpcox

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Docker Sbx Validation@lpcox

Overall: PASS

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

  • Redis PING: ❌ (Temporary failure in name resolution)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (could not translate host name)

Overall: FAILhost.docker.internal could not be resolved from within the AWF sandbox.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.14 Python 3.12.14 ✅ YES
Node.js v24.19.0 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: FAILED — Node.js version mismatch between host and chroot environment. smoke-chroot label was not applied since not all tests passed.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing — Results

  • Scenario 1 (Module Loading) ✅ — otel.js loads cleanly and exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, plus internal test hooks.
  • Scenario 2 (Test Suite) ✅ — otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js: 68/68 tests passed.
  • Scenario 3 (Env Var Forwarding) ✅ — env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID (and COPILOT_OTEL_FILE_EXPORTER_PATH) into the agent container; api-proxy-env-config.ts (buildOtelEnv()) forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, trace context, and OTEL_SERVICE_NAME into the api-proxy container.
  • Scenario 4 (Token Tracker Integration) ✅ — token-tracker-http.js defines and invokes an onUsage(normalizedUsage, model) callback (line ~406-408), confirmed as the OTEL hook point for token usage attributes.
  • Scenario 5 (OTEL Diagnostics) — not independently re-verified in this pass beyond confirming the local-fallback file exporter path (/var/log/api-proxy/otel.jsonl) exists in otel.js; no span export failures observed in test runs.

Overall: ✅ All scenarios pass. OTEL tracing integration (module init, span creation, GenAI usage attributes, parent context propagation, env forwarding, graceful degradation) is implemented and covered by passing tests.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@Copilot @lpcox
Smoke Test: Copilot BYOK (Direct) Mode — Azure OpenAI (Foundry, api-key)

  • GitHub MCP Testing: ❌ (PR data mismatch)
  • GitHub.com Connectivity: ✅
  • File Write/Read Test: ✅
  • BYOK Inference Test: ✅
    Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
    Overall Status: FAIL

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Status
API ✅ PASS
gh CLI ✅ PASS
File ✅ PASS

Overall result: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Smoke Claude for #8022 · claude · haiku45 · 35.1 AIC · ⊞ 4.5K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

test: validate shared-gateway enclave smoke
Mount the configured container working directory when no other mount exposes it
GitHub MCP connectivity: ❌
GitHub.com connectivity: ✅
File write/read: ✅
BYOK inference: ✅
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra
Overall: FAIL
cc @lpcox @app/copilot-swe-agent

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@lpcox
lpcox deployed to aoai-model September 3, 2026 00:06 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A (ran OK) ✅ PASS
.NET json-parse N/A (ran OK) ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx 1/1 passed ✅ PASS
Node.js execa 1/1 passed ✅ PASS
Node.js p-limit 1/1 passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Note: For Java, Maven's ~/.m2 directory was not writable by the runner user (owned by root), so a local repository/settings were placed under /tmp/gh-aw/agent/m2 with the required Squid proxy configuration (squid-proxy:3128) instead. This is a runner-environment quirk, not a firewall or test-suite failure — all Java builds and tests still passed cleanly through the proxy.

No errors encountered across any ecosystem.

Generated by Build Test Suite for #8022 · copilot · auto · 57.6 AIC · ⊞ 12K ·
Add label ready-for-aw to run again

@lpcox
lpcox merged commit 2a455d0 into main Sep 3, 2026
174 of 179 checks passed
@lpcox
lpcox deleted the copilot/awf-agent-container-fix-runtime-libs branch September 3, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[awf] agent-container: missing Chromium/Playwright runtime libs break playwright-cli in sandbox

3 participants