Skip to content

bug(swe-fast): repo never cloned — git_init works on empty dir, PR creation always skipped #52

@williamhdean

Description

@williamhdean

Bug

When swe-fast is called with a repo_url, it derives repo_path from the URL and calls os.makedirs() — but never clones the repo. run_git_init then finds an empty directory and runs git init, creating a local repo with no remote.

Because git remote get-url origin fails on a fresh git init, remote_url comes back empty. The PR creation gate at the end of build() is:

if remote_url and cfg.enable_github_pr:

This is always False, so the PR step is silently skipped on every run. As a side effect, the coding agents work against an empty workspace instead of the actual codebase, so they invent code from scratch.

Root cause

swe_af/fast/app.py lines 80–85 (before this fix):

if effective_repo_url and not repo_path:
    repo_path = f"/workspaces/{_repo_name_from_url(effective_repo_url)}"
if not repo_path:
    raise ValueError("Either repo_path or repo_url must be provided")

os.makedirs(repo_path, exist_ok=True)  # creates dir but never clones!

The parent swe_af/app.py has the correct clone logic but it was never ported to the fast variant.

Additional issue

The swe-fast Docker service in docker-compose.yml was missing env_file: .env, so GH_TOKEN (and other API keys) were only picked up if already exported in the host shell — silently empty otherwise.

Fix

See linked PR. Mirrors the clone/reset/re-clone logic from swe_af/app.py into swe_af/fast/app.py, and adds env_file: .env to the swe-fast Docker service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions