Repository: harbor-framework/harbor
Issue: Adapter runs unable to find docker
Root cause: Configuration Error

I believe that the recently merged PR https://github.com/laude-institute/harbor/commit/a56ddaea324599a5e5e20c8aa67be65b065faf67 is causing adapter runs to fail because it cannot find the path to docker.

Example error from `aider_polygot`:
<img width="819" height="276" alt="Image" src="https://github.com/user-attachments/assets/a57e3520-b21c-49fb-9d4b-da77ca0b8d5d" />

Wondering if it happens for others as well.

Yes. just hit this and wasn't sure if it's a local thing. 

Here's my analysis: 

# Bug: Docker environment broken on macOS after PR #272

## Summary

The Docker environment fails to find the `docker` executable on macOS after [PR #272](https://github.com/laude-institute/harbor/pull/272), resulting in:

```
FileNotFoundError: [Errno 2] No such file or directory: 'docker'
```

## Root Cause

[PR #272](https://github.com/laude-institute/harbor/pull/272) changed the default value of `include_os_env` in `DockerEnvironmentEnvVars.to_env_dict()`:

```python
# Before (working)
def to_env_dict(self, include_os_env: bool = True) -> dict[str, str]:

# After (broken)  
def to_env_dict(self, include_os_env: bool = False) -> dict[str, str]:
```

In `_run_docker_compose_command()`, the code calls:

```python
process = await asyncio.create_subprocess_exec(
    *full_command,
    env=self._env_vars.to_env_dict(),  # <-- Bug: PATH not included!
    ...
)
```

When `env={}` (or any dict without `PATH`), `asyncio.create_subprocess_exec` uses a minimal default PATH that only includes `/usr/bin`. On macOS, Docker is typically installed at `/usr/local/bin/docker`, which is **not** in this fallback PATH.

## Why it works on Linux but fails on macOS

| Platform | Docker location | In fallback PATH? | Result |
|----------|-----------------|-------------------|--------|
| Linux (GitHub Actions) | `/usr/bin/docker` | ✅ Yes | Works |
| macOS | `/usr/local/bin/docker` | ❌ No | **Fails** |

## Proof of Regression

We created a GitHub Actions workflow that proves the regression using:

1. **A docker shim** placed at `/usr/local/bin/docker` to simulate macOS Docker installation
2. **The exact same test script** run against both versions

### Test Script

```python
from harbor.environments.docker.docker import DockerEnvironmentEnvVars

env_vars = DockerEnvironmentEnvVars(...)
env = env_vars.to_env_dict()  # This is exactly what Harbor does

proc = await asyncio.create_subprocess_exec(
    "docker", "--version",
    env=env,  # If PATH missing, docker won't be found on macOS
    ...
)
```

### Results

**GitHub Actions Run:** https://github.com/rotemtam/harbor/actions/runs/20486455115

```
TEST 1: Harbor BEFORE commit a56ddae (Sunday's version)
  to_env_dict() returns PATH in env: True
  Result: ✓ SUCCESS - Docker shim v1.0.0 called!

TEST 2: Harbor AFTER commit a56ddae (current buggy version)
  to_env_dict() returns PATH in env: False
  Result: ✗ FAILED - [Errno 2] No such file or directory: 'docker'
```

The **same script** produces different results:
- **Before PR #272:** `PATH` is included → ✅ Docker found
- **After PR #272:** `PATH` is NOT included → ❌ Docker not found

## Fix

Change the call in `_run_docker_compose_command()` to explicitly include OS environment:

```python
process = await asyncio.create_subprocess_exec(
    *full_command,
    env=self._env_vars.to_env_dict(include_os_env=True),  # <-- Fix
    ...
)
```

## Affected Files

- `src/harbor/environments/docker/docker.py`

## Related PR

- https://github.com/rotemtam/harbor/pull/2



Thanks, should be fixed now!