Skip to content

mini-swe-agent repeats completed shell tool results #872

Description

@N0zoM1z0

Describe the bug

Summary

A deterministic OpenAI-compatible provider can cause mini-swe-agent to submit duplicate tool results for completed shell tool-call IDs.

The standalone reproducer installs public mini-swe-agent==2.4.2, starts a local mock provider, sends shell commands through mini-swe-agent's advertised Bash tool, and verifies that the same provider-issued tool-call ID is reported more than once. A local public-package run observed 496 results for repeat_loop_initial and 122760 results for repeat_loop_followup before the bounded run stopped.

Affected target

  • Target: mini-swe-agent
  • Affected version checked with the public reproducer: 2.4.2
  • Current public latest checked on 2026-06-22: 2.4.2
  • Environment: Linux x86_64 Docker, public package install
  • Provider/model: OpenAI-compatible local mock provider, gpt-4o

Steps to reproduce

Prerequisites: Docker, Python 3, and the GitHub CLI (gh) for the clone command below. The linked reproducer is self-contained and uses only Python standard-library modules plus Docker. It installs the affected CLI version from the public package registry, starts a local mock provider, and runs the CLI in an isolated workspace. The Docker run is limited to 2 CPUs and 4 GiB RAM by default.

Complete self-contained reproducer: https://gist.github.com/N0zoM1z0/817c1134f4b64f082c7da3c07fbc4392

The Gist contains mini-swe-agent-repeated-identical-tool-loop.reproduce.py. Download and run:

gh gist clone 817c1134f4b64f082c7da3c07fbc4392 mini-swe-agent-repeated-identical-tool-loop-reproducer
cd mini-swe-agent-repeated-identical-tool-loop-reproducer
python3 mini-swe-agent-repeated-identical-tool-loop.reproduce.py

To reuse an already-built local image:

python3 mini-swe-agent-repeated-identical-tool-loop.reproduce.py --skip-build

Expected successful reproduction output includes:

provider_requests_at_least: observed=497 expected>=2
duplicate_tool_result repeat_loop_initial: observed=496 expected>=2
RUN_REPRODUCED
REPRODUCED

Actual behavior

mini-swe-agent submits more than one tool result for the same provider-issued shell tool-call ID. In the local standalone run, the script observed 496 repeat_loop_initial tool results and 122760 repeat_loop_followup tool results.

Expected behavior

mini-swe-agent should execute and report each provider-issued tool-call ID at most once.

Public-upstream status

This report targets stock public mini-swe-agent==2.4.2, which is the current PyPI latest checked on 2026-06-22. No upstream issue has been filed from this draft yet. This is separate from the child-process cleanup report because it validates duplicate tool-result submission under repeated tool-use state.

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