Skip to content

Agent stuck replaying the same user turn + “named a source file” gate, infinite Q&A loop #714

Description

@justrach

Symptom

The agent entered a dozens-of-turns loop answering the same user question.

Each replayed turn also injected a tool-use gate of the form: if a source path was named, the agent must read/edit that path before answering. Combined with turn replay, the agent kept read_file/codedb on the same docs and restating the same answer until the human interrupted.

Expected

After the question is answered from the named file, stop. Do not re-inject the same user question. The source-path gate should not fire on every subsequent turn when the prior turn already read (and, when needed, edited) that file.

Actual

The same user payload was replayed as a new turn many times (50+). Combined with the source-file gate, the agent kept:

  1. calling read_file / codedb on the same spans
  2. repeating the same short answer
  3. getting the same question again

Why this is a harness bug

The user asked once. The session then replayed that turn plus a tool-use constraint that forced another read each time. That is session/prompt/turn scheduling, not the working repo.

Suggested fix

  • Deduplicate consecutive identical user messages (or identical user+gate bundles) before injecting a new turn.
  • The “named a source file → must read/edit” rule should be per unanswered mention, not re-applied after a successful read in the previous turn.
  • If the gate must stay, fail closed after N identical loops and surface “stuck replay” to the user instead of burning the session.

Context

  • Harness: Codegraff agent
  • No secrets, credentials, or host details in this report (redacted from the original write-up)

Activity

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

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