Skip to content

fix: ask for repo path before building env config in sweagent sh - #1603

Open
BlueX888 wants to merge 1 commit into
SWE-agent:mainfrom
BlueX888:fix/prep-run-shell-repo-prompt-after-env-config-mounts-none
Open

BlueX888 wants to merge 1 commit into
SWE-agent:mainfrom
BlueX888:fix/prep-run-shell-repo-prompt-after-env-config-mounts-none

Conversation

@BlueX888

Copy link
Copy Markdown

Reference Issues/PRs

No existing issue or PR covers this (searched the tracker for sweagent sh / repo prompt / run_shell; the last commit touching sweagent/run/run_shell.py is an unrelated typo fix).

What does this implement/fix? Explain your changes.

Summary

sweagent sh prompts for the repository path when -r/--repo is not given, but the prompt ran after the environment config had already been built. Without -r the docker volume mount therefore became -v None:/repo, and the path entered at the prompt was discarded. This PR moves the prompt above the environment-config construction so the entered path is used.

Why

  • sweagent/run/run_shell.py:101 defines -r/--repo with default=None.
  • run_from_cli interpolated cli_args.repo into the volume mount while building EnvironmentConfig (docker_args=["-v", f"{cli_args.repo}:/repo"]).
  • The if cli_args.repo is None: cli_args.repo = Path(Prompt.ask(...)) block that fills the value in interactive mode sat below the EnvironmentConfig/SWEEnv.from_config calls, so without -r the mount was -v None:/repo and the prompted path never reached the environment.
  • The sibling -p problem-statement prompt is already placed before its first use; the repo prompt now follows the same ordering.

Changes

  • sweagent/run/run_shell.py: moved the cli_args.repo is None prompt block above the EnvironmentConfig construction so the prompted path is interpolated into docker_args. docker_args is the only other use of cli_args.repo in the file.
  • tests/test_run_shell.py (new): regression tests asserting that the repo path from the interactive prompt (and from -r) ends up in the docker args as ["-v", "<repo>:/repo"].

Testing

  • New tests on unpatched main: pytest tests/test_run_shell.py -v → AssertionError: assert ['-v', 'None:/repo'] == ['-v', '<tmp>/myrepo:/repo'] (1 failed, 1 passed).
  • New tests on this branch: pytest tests/test_run_shell.py -v → 2 passed.
  • pytest -m "not slow" on this branch: 99 passed, 2 xfailed, plus 12 pre-existing environment failures (missing sweagent console script on PATH, Docker daemon not running, GitHub API rate limiting) that fail identically on unpatched main; the only run-to-run difference is the new regression test failing there.
  • pre-commit run --files sweagent/run/run_shell.py tests/test_run_shell.py → all hooks pass (ruff, ruff format, typos, trailing whitespace, check-ast, ...).

`run_from_cli` built the environment config (including the
-v <repo>:/repo docker volume mount) before prompting for the
repository path, so `sweagent sh` without -r mounted the literal
string None instead of the path entered at the prompt.
sun04222 added a commit to sun04222/SWE-agent that referenced this pull request Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant