Fix Container Boundaries

Sequential fix pipeline for failing container boundary tests. For each non-passing test, spawns a fix agent to diagnose and resol…

wtah updated 5mo ago
Claude CodeGeneric
View source ↗
# Fix Container Boundaries Command

Sequential fix pipeline for failing container boundary tests. For each non-passing test, spawns a fix agent to diagnose and resolve the issue, rebuilds the container, and re-validates the fix.

---

## Purpose

This command **fixes failing boundary tests** identified by `/test-container-boundaries`. It processes each failing test SEQUENTIALLY, ensuring:
1. Each issue is diagnosed and fixed before moving to the next
2. Containers are rebuilt after code changes
3. Fixes are validated by re-running the test

**Position in Pipeline**:

/test-container-boundaries → Validates container input interfaces ↓ /fix-container-boundaries → Fixes failing boundary tests (YOU ARE HERE) ↓ /fix-e2e → Tests full user journeys across containers


---

## Required Skill

**MANDATORY**: Load the `container-boundary-testing` skill:

.claude/skills/container-boundary-testing/SKILL.md


This skill defines:
- **Docker rebuild procedures** (critical for applying fixes)
- **Test file format** (Shell Script `.test.sh` only)
- **Common issues and fixes**
- **Validation workflow**

---

## Prerequisites

Before running this command:

1. **`/test-container-boundaries` has been run** - Boundary tests exist
2. **`BOUNDARY-TEST-REPORT.md` exists** - Contains list of failing tests
3. **Docker containers are running** - `docker-compose.local.yml` is up
4. **Playwright MCP is configured** - For UI container tests

---

## Usage

```bash
/fix-container-boundaries                              # Fix all failing tests
/fix-container-boundaries --container={container}      # Fix specific container
/fix-container-boundaries --test={input-slug}          # Fix specific test
/fix-container-boundaries --max-iterations=3           # Limit fix iterations per test

Instructions

You are orchestrating the boundary test fix pipeline. This command:

  1. Reads BOUNDARY-TEST-REPORT.md to find failing tests
  2. For each failing test, spawns a fix agent SEQUENTIALLY
  3. After each fix, rebuilds the container and re-runs the test
  4. Updates the report with fix results

CRITICAL: This is a SEQUENTIAL pipeline. Process ONE test at a time.


⚠️⚠️⚠️ CRITICAL: SEQUENTIAL EXECUTION ONLY ⚠️⚠️⚠️

MANDATORY EXECUTION RULES:

  1. ONE test at a time: NEVER spawn multiple fix agents simultaneously
  2. Wait for completion: Each fix agent MUST complete before starting the next
  3. Always use run_in_background: false: All Task calls MUST block
  4. Rebuild between fixes: Container MUST be rebuilt after code changes

Execution Pattern:

Test 1: Spawn fix agent (run_in_background: false)
        → Wait for completion
        → Rebuild container
        → Re-run test
        → Only after PASS/max iterations, proceed to...

Test 2: Spawn fix agent (run_in_background: false)
        → Wait for completion
        → Rebuild container
        → Re-run test
        → Only after PASS/max iterations, proceed to...

... continue until all failing tests processed

Execution Flow

Phase 1: Collect Failing Tests
    │   Read BOUNDARY-TEST-REPORT.md
    │   Parse "Remaining Issues" section
    │   Build list of failing tests
    ▼
Phase 2: Sequential Fix Iterations (ONE AT A TIME)
    │   For EACH failing test:
    │   ┌─────────────────────────────────────────────────────────────────────┐
    │   │  1. Spawn Boundary Fix Agent                                        │
    │   │     - Reads .input.md and .test.ts                                  │
    │   │     - Diagnoses root cause                                          │
    │   │     - Applies minimal fix                                           │
    │   │                                                                     │
    │   │  2. Rebuild Container                                               │
    │   │     - ./scripts/local-stop-all.sh                                   │
    │   │     - docker-compose build {container}                              │
    │   │     - ./scripts/local-start-all.sh                                  │
    │   │                                                                     │
    │   │  3. Re-run Test                                                     │
    │   │     - npx vitest run tests/container-inputs/{slug}.test.ts          │
    │   │                                                                     │
    │   │  4. If PASS: Move to next test                                      │
    │   │     If FAIL: Iterate (max iterations)                               │
    │   └─────────────────────────────────────────────────────────────────────┘
    ▼
Phase 3: Update Report
    │   Update BOUNDARY-TEST-REPORT.md
    │   - Move fixed tests to "Passed" section
    │   - Update "Remaining Issues" section
    │   Generate fix summary

Phase 1: Collect Failing Tests

Step 1.1: Read Report

Read BOUNDARY-TEST-REPORT.md and parse the following sections:

## Remaining Issues

| Container | Input | Issue | Required Action |
|-----------|-------|-------|-----------------|
| {container-1} | {input-slug-1} | {error description} | {fix action} |
| {container-2} | {input-slug-2} | {error description} | {fix action} |

Step 1.2: Build Ordered List

Create a list of failing tests ordered by container:

Failing Tests:
1. {container-1}/tests/container-inputs/{input-slug-1}.test.sh
2. {container-1}/tests/container-inputs/{input-slug-2}.test.sh
3. {container-2}/tests/container-inputs/{input-slug-3}.test.sh

Phase 2: Sequential Fix Iterations

For EACH failing test in the list:

Step 2.1: Spawn Boundary Fix Agent

Use Task tool with subagent_type: general-purpose:

Fix boundary test: {test-file}

**FIRST**: Load the `container-boundary-testing` skill from `.claude/skills/container-boundary-testing/SKILL.md`. This skill contains Docker procedures, test format guidelines, and common fixes.

Maintain Fix Container Boundaries?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Fix Container Boundaries on getagentictools](https://getagentictools.com/loops/wtah-fix-container-boundaries-command?ref=badge)
npx agentictools info loops/wtah-fix-container-boundaries-command

The second line is the CLI lookup for this page — handy in READMEs and docs.