-
Notifications
You must be signed in to change notification settings - Fork 2
fix(cli): use GHCR images for preset agent-images in chroot mode #459
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
Conversation
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Smoke Test ResultsLast 2 Merged PRs:
Test Results:
Status: PASS
|
Chroot Runtime Version VerificationVersion Comparison
ResultFAILED: Not all runtime versions match between host and chroot environment. Details
This indicates that the chroot environment is not providing fully transparent access to host binaries for Python and Node.js runtimes. Only Go matched correctly.
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
Smoke Test Results: Claude Engine ✅ GitHub MCP: #458: fix(smoke-chroot): add -E flag to sudo awf for PATH preservation, #457: fix(cli): use GHCR images for preset agent-images in chroot mode Overall Status: PASS
|
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.
Pull request overview
This PR fixes a critical bug in v0.13.0 where using --enable-chroot with preset agent images (default or act) would fail in packaged binaries by attempting to build from a non-existent local directory instead of using pre-built GHCR images.
Changes:
- Reordered image selection logic in
docker-manager.tsto prioritize GHCR preset images over local builds, even in chroot mode - Added comprehensive test coverage for chroot mode with different agent image configurations
- Updated smoke test workflow to validate the fix by testing
--enable-chrootwith--agent-image act
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/docker-manager.ts | Reordered conditional logic to check for GHCR preset images before local build conditions, fixing the bug where chroot mode would always attempt local builds |
| src/docker-manager.test.ts | Added 4 new test cases covering chroot mode with default preset, act preset, custom images, and buildLocal combinations |
| package.json | Bumped version from 0.13.0 to 0.13.1 for this bug fix release |
| .github/workflows/smoke-chroot.md | Updated command examples to use sudo -E instead of sudo to preserve environment variables |
| .github/workflows/smoke-chroot.lock.yml | Updated workflow to test the fix scenario with --enable-chroot --agent-image act, upgraded dependency versions, and modernized workflow infrastructure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it('should build locally with minimal Dockerfile when buildLocal and enableChroot are both true', () => { | ||
| const configWithChrootAndBuildLocal = { | ||
| ...mockConfig, | ||
| enableChroot: true, | ||
| buildLocal: true | ||
| }; | ||
| const result = generateDockerCompose(configWithChrootAndBuildLocal, mockNetworkConfig); | ||
| const agent = result.services.agent as any; | ||
|
|
||
| // When both buildLocal and enableChroot are set, should build locally | ||
| expect(agent.build).toBeDefined(); | ||
| expect(agent.build.dockerfile).toBe('Dockerfile.minimal'); | ||
| expect(agent.image).toBeUndefined(); |
Copilot
AI
Feb 3, 2026
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.
Missing test case for when a custom image is specified without buildLocal and without chroot mode. According to the new logic at lines 609-612 in docker-manager.ts, this should use the custom image directly without building. Consider adding a test to cover this scenario and ensure the else branch is properly tested.
| // Use pre-built GHCR image based on preset | ||
| if (useGHCR && isPreset) { | ||
| // Use pre-built GHCR image for preset images (works in both normal and chroot mode) | ||
| // The GHCR images already have the necessary setup for chroot mode |
Copilot
AI
Feb 3, 2026
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.
The comment "The GHCR images already have the necessary setup for chroot mode" might be slightly misleading. The GHCR preset images are built from the regular Dockerfile (with Node.js and other tools), not from Dockerfile.minimal. While they do work correctly in chroot mode, they include packages that aren't strictly necessary when chrooting. Consider clarifying the comment to say "The GHCR images work correctly in chroot mode (though they include extra packages)" or similar to be more precise.
| // The GHCR images already have the necessary setup for chroot mode | |
| // The GHCR images work correctly in chroot mode (though they include extra packages and are not built from Dockerfile.minimal) |
When using --enable-chroot with --agent-image act (or default), AWF now correctly uses the pre-built GHCR images instead of always trying to build locally from Dockerfile.minimal. This fixes a bug where the packaged AWF binary would fail with: "unable to prepare context: path '/snapshot/gh-aw-firewall/containers/agent' not found" The issue was that chroot mode logic was checked before GHCR preset logic, causing it to always attempt local builds even for preset images. Changes: - Prioritize GHCR preset images over local builds (even in chroot mode) - Only build locally when: --build-local is set, OR --enable-chroot with a custom (non-preset) image - Add tests for chroot + preset image combinations Fixes #458 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Without -E flag, sudo does not preserve environment variables, causing AWF_HOST_PATH to be set from sudo's default PATH instead of the user's PATH with toolcache directories. This resulted in Python/Node version mismatches between host and chroot. The -E flag ensures PATH is passed to AWF, allowing proper resolution of host toolcache binaries in chroot mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7b12443 to
e89fdc5
Compare
|
📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident... |
|
💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges... |
Summary
--enable-chrootwith--agent-image actfailed with packaged binaryProblem
AWF v0.13.0 fails when using
--enable-chrootwith--agent-image act:The bug caused AWF to always try building the agent container locally instead of using the pre-built GHCR image, even when using preset images (
defaultoract).Root Cause
In v0.13.0's
docker-manager.ts, the agent image selection logic checkedenableChrootbeforeuseGHCR && isPreset, causing it to always build locally in chroot mode:Fix
Changed the logic to prioritize GHCR preset images:
Test plan
npm test- 664 passing)sudo -E awf --enable-chroot --agent-image act --allow-domains github.com -- echo "test"Fixes #458
🤖 Generated with Claude Code