Skip to content

mini-swe-agent forwards large shell output back to the provider #873

Description

@N0zoM1z0

Describe the bug

Summary

A provider-requested shell command that writes a large stdout payload causes mini-swe-agent to forward the large result back into the provider loop instead of bounding or truncating it.

The standalone reproducer installs public mini-swe-agent==2.4.2, starts a local OpenAI-compatible mock provider, asks mini-swe-agent to run a shell command that prints 100000 bytes, and verifies that the resulting provider traffic contains at least 8192 bytes of tool-result output. A local public-package run observed 30441 bytes of tool-result payload.

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/1620a2feef749941e2f86ab2499c8ca4

The Gist contains mini-swe-agent-huge-stdout-resource-bound.reproduce.py. Download and run:

gh gist clone 1620a2feef749941e2f86ab2499c8ca4 mini-swe-agent-huge-stdout-resource-bound-reproducer
cd mini-swe-agent-huge-stdout-resource-bound-reproducer
python3 mini-swe-agent-huge-stdout-resource-bound.reproduce.py

To reuse an already-built local image:

python3 mini-swe-agent-huge-stdout-resource-bound.reproduce.py --skip-build

Expected successful reproduction output includes:

provider_requests_at_least: observed=4 expected>=2
tool_result_bytes_at_least: observed=30441 expected>=8192
RUN_REPRODUCED
REPRODUCED

Actual behavior

mini-swe-agent forwards the large shell stdout payload back to the provider as tool-result content. In the local standalone run, the script observed 30441 bytes of tool-result payload for the large-output command.

Expected behavior

mini-swe-agent should bound, truncate, or otherwise protect provider-facing tool-result output so a single command cannot amplify a large stdout payload into the model interaction.

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 repeated-tool report because it validates provider-facing output bounding for a single large shell result.

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