Skip to content

[Bug]: Sisyphus-Junior stuck in infinite loop endlessly refactoring Python type hints (dict vs Dict) #1349

@Brisbanehuang

Description

@Brisbanehuang

Prerequisites

  • I will write this issue in English
  • I have searched existing issues
  • I am using the latest version
  • I have read the documentation

Bug Description

The agent (Sisyphus-Junior / gpt-5.2-codex) enters an infinite loop while attempting to fix Python type hint errors reported by Pyright/LSP.

Specifically, it struggles with missing type arguments errors and repeatedly cycles through the same failed strategies:

  1. Switches from built-in dict/tuple to typing.Dict/typing.Tuple.
  2. Checks lsp_diagnostics.
  3. Claims the error persists (possibly hallucinating the persistence or misinterpreting the LSP output).
  4. Switches back to built-in types or attempts to add suppress comments (# pyright: ignore).
  5. Repeats this process dozens of times, consuming massive amounts of context (screenshot shows 140k tokens used).
Image

Steps to Reproduce

  1. Assign a task to Sisyphus-Junior to refactor or fix types in a Python file.
  2. Trigger a scenario where strict Pyright rules complain about generic types (e.g., dict vs dict[str, Any]).
  3. Observe the agent failing to satisfy the LSP and entering a "Code -> LSP -> Code" infinite loop without stopping or asking for user intervention.

Expected Behavior

The agent should detect that it is repeating the same actions (loop detection). After 2-3 failed attempts to fix the same line/error, it should:

  1. Stop and report failure.
  2. Or attempting a brute-force suppression effectively.
  3. NOT continue burning tokens indefinitely.

Actual Behavior

Infinite loop of futile refactoring until manual termination or context exhaustion.

Environment

  • Agent: Sisyphus-Junior
  • Model: gpt-5.2-codex
  • Task: Python Refactoring (Pyright)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions