Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

  • Step 1: Update types (src/types.ts)

    • Add agentImage?: 'default' | 'act' | string field
    • Remove agentBaseImage field (replaced by agentImage)
  • Step 2: Update CLI (src/cli.ts)

    • Remove --agent-base-image option
    • Add --agent-image option with presets description
    • Update validation logic:
      • default or unset → use GHCR agent:latest
      • act → use GHCR agent-act:latest
      • Custom image → require --build-local, validate against allowlist
    • Create validateAgentImage and isAgentImagePreset functions
    • Export updated functions and constants
    • Simplified validation logic (removed redundant 'default' check)
    • Simplified type guard using direct comparison
  • Step 3: Update Docker Manager (src/docker-manager.ts)

    • Handle config.agentImage:
      • undefined or 'default' → use agent:tag from GHCR
      • 'act' → use agent-act:tag from GHCR
      • Custom → build locally with custom image as BASE_IMAGE arg
    • Support 'act' preset with --build-local (uses ACT_PRESET_BASE_IMAGE constant)
    • Extract ACT_PRESET_BASE_IMAGE to constant for maintainability
  • Step 4: Update Tests

    • Update src/cli.test.ts - add tests for presets, update function names
    • Update src/docker-manager.test.ts - test preset behavior and GHCR images, use constant
    • Added more edge case tests to improve coverage
  • Step 5: Update Documentation (docs/usage.md)

    • Replace --agent-base-image with --agent-image
    • Document presets (default, act) with table
    • Update examples showing preset and custom usage
    • Add error handling section for custom images without --build-local
  • Step 6: Verify changes

    • Run tests (615 passed)
    • Run linter (0 errors, only pre-existing warnings)
    • Build passes
  • Step 7: Code review and security scan

    • Code review completed - addressed feedback to extract constant
    • CodeQL scan - 0 alerts
    • Added more tests per coverage feedback
    • Fixed redundant validation logic and cleaner type guard

Security Summary: No security vulnerabilities introduced. CodeQL found 0 alerts.

Original prompt

Problem Statement

The current --agent-base-image option is confusing:

  • act is a magic keyword that behaves differently from other values
  • CLI mentions runner-22.04, full-22.04 but these aren't published to GHCR
  • ubuntu:22.04 does nothing (same as default) - confusing
  • Version mismatch: default uses 22.04, but act uses 24.04

Proposed Solution

  1. Rename Option: --agent-base-image → --agent-image

"Base image" is an implementation detail. Users care about which agent image to use.

  1. Define Clear Presets for Pre-built GHCR Images
    ┌─────────┬──────────────────┬───────────────────────────────┬────────┬───────────────────────┐
    │ Preset │ GHCR Image │ Base │ Size │ Use Case │
    ├─────────┼──────────────────┼───────────────────────────────┼────────┼───────────────────────┤
    │ default │ agent:latest │ ubuntu:22.04 │ ~200MB │ Minimal, fast │
    ├─────────┼──────────────────┼───────────────────────────────┼────────┼───────────────────────┤
    │ act │ agent-act:latest │ catthehacker/ubuntu:act-24.04 │ ~2GB │ GitHub Actions parity │
    └─────────┴──────────────────┴───────────────────────────────┴────────┴───────────────────────┘
  2. Custom Images Require --build-local ...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 23, 2026 01:02
Breaking change: replaces --agent-base-image with --agent-image

- Add presets: 'default' (agent:latest) and 'act' (agent-act:latest)
- Custom images now require --build-local flag
- Updated types: agentImage replaces agentBaseImage
- Updated docker-manager to handle presets vs custom images
- Updated tests and documentation

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Addresses code review feedback to improve maintainability

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Clarify --agent-base-image option usage feat(cli): replace --agent-base-image with --agent-image option Jan 23, 2026
Copilot AI requested a review from Mossaka January 23, 2026 01:08
@Mossaka Mossaka marked this pull request as ready for review January 23, 2026 02:13
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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

@github-actions
Copy link

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 77.63% 77.52% 📉 -0.11%
Statements 77.71% 77.61% 📉 -0.10%
Functions 77.54% 77.65% 📈 +0.11%
Branches 70.44% 70.76% 📈 +0.32%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 79.3% → 79.7% (+0.37%) 78.6% → 79.0% (+0.37%)
src/cli.ts 35.9% → 36.5% (+0.60%) 36.2% → 37.0% (+0.81%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link

Smoke Test Results - Claude

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved last 2 merged PRs
  • ✅ Playwright: Page title contains "GitHub"
  • ✅ File Writing: Created test file successfully
  • ✅ Bash Tool: Verified file contents

Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link

Smoke Test PASSED

cc @Mossaka @Copilot

AI generated by Smoke Copilot

@Mossaka
Copy link
Collaborator

Mossaka commented Jan 23, 2026

- Add test for ACT_PRESET_BASE_IMAGE constant
- Add test for custom registry with act preset
- Add test for undefined agentImage with --build-local
- Add tests for additional invalid image patterns

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 23, 2026

@copilot bump up the test coverage: https://github.com/githubnext/gh-aw-firewall/actions/runs/21270763902/job/61224218959?pr=397

Added more tests in commit 32bd7ee:

  • Tests for ACT_PRESET_BASE_IMAGE constant
  • Test for custom registry with act preset
  • Test for undefined agentImage with --build-local
  • Tests for additional invalid image patterns

The per-file coverage for modified files actually improved (+0.60% for cli.ts, +0.37% for docker-manager.ts). The very small overall regression (0.11%) was due to total line count increase rather than untested code paths.

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 77.63% 77.52% 📉 -0.11%
Statements 77.71% 77.61% 📉 -0.10%
Functions 77.54% 77.65% 📈 +0.11%
Branches 70.44% 70.76% 📈 +0.32%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 79.3% → 79.7% (+0.37%) 78.6% → 79.0% (+0.37%)
src/cli.ts 35.9% → 36.5% (+0.60%) 36.2% → 37.0% (+0.81%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link

Smoke Test Results ✅

Status: PASS

cc: @Copilot @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link

Smoke Test Results for Claude Engine

Last 2 merged PRs:

✅ GitHub MCP - Retrieved merged PRs
✅ Playwright - Page title contains "GitHub"
✅ File Writing - Created test file successfully
✅ Bash Tool - Read file contents verified

Status: PASS

AI generated by Smoke Claude

@Mossaka
Copy link
Collaborator

Mossaka commented Jan 23, 2026

@copilot bump up test coverage and fix the following issues

  1. Redundant validation for default in src/cli.ts:686-694:
    const agentImage = options.agentImage || 'default';
    if (agentImage !== 'default') {
    const validation = validateAgentImage(agentImage);
    // ...
    }
  2. The check if (agentImage !== 'default') skips validation for 'default', which is fine, but validateAgentImage('default') also returns { valid: true }. This is correct but slightly redundant in logic.
  3. Type assertion could be cleaner in src/cli.ts:133:
    return AGENT_IMAGE_PRESETS.includes(value as 'default' | 'act');
  4. Could use a type guard pattern, but current implementation is acceptable.

- Remove redundant 'default' check before validation
- Simplify isAgentImagePreset() type guard using direct comparison
- Improve branch coverage by removing unnecessary conditional

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 23, 2026

@copilot bump up test coverage and fix the following issues

  1. Redundant validation for default in src/cli.ts:686-694: ...

Fixed both issues in commit d97f8e3:

  1. Redundant validation: Removed the if (agentImage !== 'default') check. Now validateAgentImage() is always called for all values (it handles presets correctly).

  2. Type assertion: Simplified isAgentImagePreset() to use direct comparison (value === 'default' || value === 'act') instead of includes() with a type assertion.

Branch coverage also improved from 27.61% to 28.57% for cli.ts due to removing the redundant conditional.

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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

@github-actions
Copy link

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 77.63% 77.55% 📉 -0.08%
Statements 77.71% 77.63% 📉 -0.08%
Functions 77.54% 77.65% 📈 +0.11%
Branches 70.44% 70.91% 📈 +0.47%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 79.3% → 79.7% (+0.37%) 78.6% → 79.0% (+0.37%)
src/cli.ts 35.9% → 36.4% (+0.50%) 36.2% → 36.6% (+0.49%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link

Smoke Test Results

Last 2 merged PRs:

✅ GitHub MCP - retrieved PRs
✅ Playwright - page title verified ("GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
✅ File Writing - test file created
✅ Bash Tool - file read successful

Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link

Smoke Test Results:

Last 2 Merged PRs:

Test Status:
✅ GitHub MCP: Retrieved last 2 merged PRs
✅ Playwright: GitHub page title verified ("GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
✅ File Write: Created /tmp/gh-aw/agent/smoke-test-copilot-21302717000.txt
✅ Bash Tool: File contents verified

Overall Status: PASS

cc: @Mossaka @Copilot

AI generated by Smoke Copilot

Add comprehensive edge case tests to improve coverage:

- isAgentImagePreset: case sensitivity, whitespace, similar names
- validateAgentImage: special chars, control chars, URL injection,
  env var injection, multiple @ symbols, extra path segments
- docker-manager: custom registry/tag combos, different base images,
  USER_UID/USER_GID verification with act preset

Increases test count from 615 to 630 tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 77.63% 77.55% 📉 -0.08%
Statements 77.71% 77.63% 📉 -0.08%
Functions 77.54% 77.65% 📈 +0.11%
Branches 70.44% 70.91% 📈 +0.47%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 79.3% → 79.7% (+0.37%) 78.6% → 79.0% (+0.37%)
src/cli.ts 35.9% → 36.4% (+0.50%) 36.2% → 36.6% (+0.49%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link

Smoke Test Results

PRs Reviewed:

Tests:

  • ✅ GitHub MCP: Retrieved last 2 merged PRs
  • ✅ Playwright: GitHub page title verified ("GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-copilot-21303051395.txt
  • ✅ Bash Tool: File verified (Smoke test passed for Copilot at Fri Jan 23 22:19:40 UTC 2026)

Status: PASS

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link

Smoke Test Results - Claude

Last 2 Merged PRs:

Test Results:
✅ GitHub MCP - Retrieved PRs successfully
✅ Playwright - Navigated to github.com, title verified: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub"
✅ File Writing - Created /tmp/gh-aw/agent/smoke-test-claude-21303051412.txt
✅ Bash Tool - Verified file content

Status: PASS

AI generated by Smoke Claude

Extract the agent image validation logic from the main CLI handler
into a separate testable function. This improves test coverage by
making the validation logic unit-testable.

Changes:
- Add AgentImageResult interface for typed return values
- Add processAgentImageOption() function with full validation logic
- Simplify main CLI handler to use the new function
- Add 13 new tests for processAgentImageOption covering:
  - Default preset behavior
  - Act preset with info message
  - Custom images requiring --build-local
  - Invalid image rejection

Coverage improvement:
- cli.ts lines: 36.42% → 40.06% (+3.64%)
- Overall lines: 77.55% → 77.98% (+0.43%)
- Overall branches: 70.91% → 71.70% (+0.79%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

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

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 77.63% 77.98% 📈 +0.35%
Statements 77.71% 78.05% 📈 +0.34%
Functions 77.54% 77.77% 📈 +0.23%
Branches 70.44% 71.70% 📈 +1.26%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 79.3% → 79.7% (+0.37%) 78.6% → 79.0% (+0.37%)
src/cli.ts 35.9% → 40.1% (+4.14%) 36.2% → 40.3% (+4.11%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link

Smoke Test: Copilot Engine ✅ PASS

Last 2 merged PRs:

Test Results:

  • ✅ GitHub MCP: Fetched recent PRs
  • ✅ Playwright: Verified page title "GitHub · Change is constant. GitHub keeps you ahead. · GitHub"
  • ✅ File write: Created /tmp/gh-aw/agent/smoke-test-copilot-21303191071.txt
  • ✅ Bash: Verified file content

cc @Mossaka

AI generated by Smoke Copilot

@github-actions
Copy link

Smoke Test Results: PASS

✅ GitHub MCP: #214 feat: add configurable agent base image for GitHub Actions runner parity, #393 fix: mount host readonly and add isolate jail (pending)
✅ Playwright: Page title verified
✅ File Write: Test file created successfully
✅ Bash Tool: File content verified

Overall: PASS

AI generated by Smoke Claude

@Mossaka Mossaka merged commit 8e5e404 into main Jan 23, 2026
37 of 38 checks passed
@Mossaka Mossaka deleted the copilot/update-agent-base-image-option branch January 23, 2026 23:07
@github-actions
Copy link

Smoke Test Results (Claude)

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP
  • ✅ Playwright (title contains "GitHub")
  • ✅ File Write (/tmp/gh-aw/agent/smoke-test-claude-21324284998.txt)
  • ✅ Bash Tool

Status: PASS

AI generated by Smoke Claude

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.

2 participants