CommandCodeAI / CommandCodeAI/command-code

Agent repeatedly emits no-op echo commands instead of intended tool calls; session stalls and never completes its task

オープン
#784 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
言語のデータがありません
スター
4k
フォーク
350
PR マージ指標
30日以内にマージされた PR はありません

説明

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
  1. Start a long-running background task, e.g. shell_command with run_in_background: true running a Gradle build.
  2. Prompt the agent to wait for or report the background task's result.
  3. 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 echo tool 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:

  1. Emit the tool call it actually intends (here: shell_output, id: <task>, wait: "exit"), or
  2. 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
  1. 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.
  2. 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_command is used where shell_output(wait) was clearly intended.
  3. 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.
  4. 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 feedback command opened the GitHub issue form in a browser; the user asked that the report be filed directly with gh instead.
  • 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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、cmd.exe 上で shell_command と shell_output の経路を通じてバックグラウンドの Gradle タスクを実行し、ループを再現します。次に、意図したツール呼び出しと出力された echo コマンドを比較します。完了とは、セッションが要求されたバックグラウンドタスクの待機を実行するか、実行できないことを報告するか、ステートレスな呼び出しを続ける代わりに目に見える形でエスカレーションすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
shell
領域
ai, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。