Skip to content

Codex Desktop enters an infinite loop of repeated tool calls #42444

Open

Description

@repmah22yt-collab

What version of Codex is running?

Codex Desktop 26.826.12353 on Windows 11.

What happened?

Codex Desktop can enter an apparent infinite loop of repeated tool calls / repeated connection-status actions. Instead of completing the task or failing once, it keeps issuing the same tool-related action and printing the same status line many times.

This started suddenly between working sessions: the same setup worked the previous day, but after reopening Codex the next day the loop appeared. Restarting the PC did not resolve it.

The problem is not limited to one third-party MCP server:

  • It was first observed while the Weppy Roblox MCP integration and Roblox Studio were connected.
  • It continued after Weppy was disabled/disconnected.
  • In one test, the same connection/status line was printed more than 10 times after the visible screenshot.
  • Previously, the same flow normally connected within roughly 10–20 seconds, reported the active Roblox experience/mode once, and continued.
  • The UI may also remain in a reconnecting state.

There were two Roblox-related MCP routes visible in the affected setup:

  • Roblox_Studio — 29 tools
  • weppy-roblox-mcp — 25 tools

Disabling the duplicate Roblox_Studio route and keeping only Weppy was tested/recommended during diagnosis, but the repeated-call behavior was also reproduced with Weppy disabled, so this does not appear to be solely a Weppy bug.

A separate Weppy startup attempt timed out after 30 seconds. Increasing MCP startup/tool timeouts may help that timeout, but it does not explain why Codex repeats the same action indefinitely instead of surfacing one error and stopping.

Steps to reproduce

The exact trigger is not fully deterministic, but the observed sequence is:

  1. Open Codex Desktop on Windows.
  2. Start a chat that uses MCP tools (in the original case, Roblox Studio / Weppy).
  3. Ask Codex to inspect or connect to the active Roblox Studio session.
  4. Observe Codex repeat the same tool call or connection/status action instead of continuing.
  5. Disable/disconnect Weppy and retry.
  6. In affected sessions, Codex can still repeat the same line/action many times or remain in a reconnecting loop.

Expected behavior

Codex should call a tool once, wait for its result, then either continue the task or surface a single timeout/connection error. It should detect identical repeated calls with no state change and stop the loop.

Actual behavior

Codex repeatedly issues the same tool-related action/status output, sometimes more than 10 times, without useful progress. The session may remain stuck until Codex is restarted or the run is manually stopped.

Frequency

Intermittent but repeatedly reproducible after it started. It affected both the original MCP-enabled setup and a test with Weppy disabled.

Regression?

Yes. The same setup and workflow worked the previous day. The issue appeared after reopening Codex the next day, without an intentional project/workflow change. A recent Codex Desktop update/regression is suspected, but the root cause is not confirmed.

Additional context

  • OS: Windows 11
  • Codex Desktop: 26.826.12353
  • Third-party integration present during initial reproduction: Weppy Roblox AI Toolkit Pro
  • PC restart did not fix it.
  • Disconnecting Weppy did not eliminate the repeated-call behavior.
  • Screenshots/video can be provided if maintainers need the exact repeated line and UI state.

This report intentionally does not claim Weppy or the recent update is the confirmed cause. The core Codex-side failure is the absence of loop detection/backoff when an identical tool action makes no progress.

Activity

  1. added
    bug
    app
    windows-os
    mcp
    tool-calls
    on Sep 3, 2026
  2. gary23w commented on Sep 4, 2026

    @gary23w

    Source-level comparison against current main (99d66aa1c5f8394729a97a6eea91880fa420352b) reinforces that this is a Core/runtime gap, not only an MCP integration bug.

    Today the regular-turn controller decides continuation from model_needs_follow_up || has_pending_input, then relies on compaction when the token limit is reached. The source comment explicitly assumes that successful compaction makes an infinite loop unimportant; there is no outcome-sensitive guard in that decision path: session/turn.rs#L441-L543. Compaction bounds context size, but it does not distinguish progress from a compacted repetition.

    A working open-source reference exists in nl-veil (disclosure: I maintain it):

    • The guard is turn-scoped across reasoning/drive passes, not reset per model response: engine.zig#L3210-L3216.
    • It keys on exact tool name + arguments and the returned-result digest. An identical call with a different result resets the count, so legitimate polling/read-after-write is not classified as a loop: engine.zig#L4251-L4260.
    • It first gives in-band feedback, then refuses the dead call, then ends the turn only after consecutive refusal-bearing model iterations ignored that feedback: engine.zig#L8318-L8344, engine.zig#L8397-L8409.
    • A stricter one-shot ledger prevents reissuing identical idempotent network calls, while the general result-sensitive guard covers stateful tools: engine.zig#L8646-L8688.

    A small Codex MVP could live below individual MCP/tool implementations:

    1. Record (turn_id, canonical tool identity, argument digest, result digest, outcome class, mutation epoch).
    2. On the second identical call/result, append a structured warning to the tool result.
    3. After a configurable threshold, return a typed notExecuted: repeatedIdenticalOutcome result instead of invoking the tool.
    4. End or pause only after multiple consecutive model samples contain refused repetitions and no successful new work.
    5. Reset/re-open when observable state changes; do not count same-batch duplicates before the model has seen feedback.
    6. Emit a typed loop-guard event so Desktop can show "paused: repeated action produced no new state" instead of looking hung.

    Useful regressions would cover: identical call + identical result; identical call + changed result; A/B tool cycling; duplicate calls emitted in one batch; read-after-write; intentional bounded poll/wait; and preservation of already-landed tool outputs when the guard stops the turn.

    The important invariant is:

    continuation budget is earned by new state, not by another model iteration
    

    That would address the failure reported here without special-casing Roblox or any MCP server.

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

    appbugmcptool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions