CommandCodeAI / CommandCodeAI/command-code
Agent repeatedly emits no-op echo commands instead of intended tool calls; session stalls and never completes its task
Nessuno ha ancora preso questa issue.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 4k
- Fork
- 350
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Description
During an interactive session, the agent entered a degenerate tool-call loop: it repeatedly stated the intent to make one specific tool call (shell_output with wait: "exit", to read the result of a background build) but instead emitted a no-op shell command on every turn (cmd /c echo marker1, echo marker2, ... continuing for dozens of consecutive turns). User interruptions did not break the pattern; the loop only ended when the user abandoned the session and switched harnesses.
The productive portion of the task had already completed before the loop began, so the failure mode is specifically: correct intent narration, wrong tool emitted, repeated indefinitely with no state change and no self-correction.
Environment
- Command Code version: 1.39.2
- OS: Windows 11 Pro (build 10.0.26200.9168)
- Shell used by agent tooling: cmd.exe
- Model/session details available on request (not redacted by filer, unknown to filer)
Steps to reproduce
- Start a long-running background task, e.g.
shell_commandwithrun_in_background: truerunning a Gradle build. - Prompt the agent to wait for or report the background task's result.
- Observe agent output across subsequent turns.
Expected: the agent issues shell_output with wait: "exit" once, or explains it cannot.
Actual: the agent narrates that exact intent in prose, then emits shell_command("cmd /c echo <word>") instead, repeating this pattern on every turn.
Actual behavior
- Dozens of consecutive no-op
echotool calls, each surfaced to the user as a real action - No state change, no progress, no error raised
- Session appeared active while doing nothing, for an extended period
- User sent multiple corrective messages ("stop this echo spamming", "what are you doing?", "are you even working or passing time?"); none changed agent behavior
- User eventually gave up on the session and completed the remaining step in a different harness
Expected behavior
The agent should either:
- Emit the tool call it actually intends (here:
shell_output,id: <task>,wait: "exit"), or - If it cannot select that tool, state that plainly in text rather than emitting filler tool calls
Severity / impact
High for trust and time: an entire working session was consumed by visible, meaningless activity at its end. The task's actual deliverables (an audit report, two design artifacts, three code fixes, a handoff note) had already been produced; the session still read as a failure to the user because of this loop.
Suggested fixes
- No-op loop detection. Detect consecutive tool calls that are identical or near-identical (same tool, trivially varying args such as
echo <counter>), produce no filesystem/process state change, and follow an unfulfilled stated intent. Surface a warning to the model or force a text-only turn. - First-class "block on background task" affordance. Make blocking on a tracked background task until exit a prominent, unambiguous tool parameter or dedicated tool, so the model does not have to reason about which tool performs this; alternatively raise a clear error when
shell_commandis used whereshell_output(wait)was clearly intended. - Prompt-level guardrail. Forbid no-op/filler tool calls unless they change state, and instruct the agent to emit text (not a tool call) when it is about to narrate an intent it has not yet acted on.
- User-visible escalation. After N consecutive stateless tool calls, prompt the user ("the agent seems stuck in a loop, interrupt?") rather than silently continuing.
Additional context
- A prior filing attempt via the built-in
cmdc feedbackcommand opened the GitHub issue form in a browser; the user asked that the report be filed directly withghinstead. - A first
gh issue create --body "..."attempt lost all but its first line to cmd.exe multiline-argument mangling, which is why this body is supplied via--body-file. - The agent itself later confirmed the loop and described it accurately in-session; the failure was not a misunderstanding of the task but a repeated wrong-tool emission.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il ciclo con un’attività Gradle in background tramite i percorsi shell_command e shell_output su cmd.exe, quindi confronta la chiamata allo strumento prevista con i comandi echo emessi. È completato quando la sessione esegue l’attesa richiesta per l’attività in background, comunica di non poterlo fare oppure effettua un’escalation visibile invece di continuare con chiamate senza stato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- shell
- Ambito
- ai, cli
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100