Skip to content

[Bug]: openai gpt-5.5 model with codex keeps looping randomly #3396

@danpiths

Description

@danpiths

Bug Description

i've noticed this pattern heavily that gpt-5.5 models with codex tend to sometimes go into a repeat loop. and whenever that happens it is almost impossible to get it out of the loop. it is very very prevalent when switching from claude code opus 4.6 to codex gpt 5.5 and sometimes it happens without the switch also. idk what causes it to go into a loop so bad.

when it is stuck in a loop the general behaviour is for the model to keep calling the same tool again, thinking about the same thing and then calling the same tool again, thinking about the same thing and so on.

this also only happens when i've been chatting for a long time or i send something big in the context. my guess is that it is mostly compaction/summarization that gets triggered after a tool call, thus it makes a tool call and then the history summarizes and it doesn't get back the exact tool response and thus thinks on the summary and keeps trying the same tool back again.

Steps to Reproduce

not really sure how this happens, but it happens frequently enough with me.
2 things i think that might help is:

  • chat a lot with gpt-5.5 codex until it is a point where summarization/compaction keeps triggering
  • start with gpt-5.5 codex and chat a lot, switch to claude code opus 4.6 and then chat a lot further, then switch back to gpt-5.5 codex again and try chatting a little more, it should mostly start the loop but can't guarantee it everytime

Expected Behavior

it should not be looping

Actual Behavior

keeps looping to keep calling the same tool and thinking the same thing again and again and sometimes even keeps repeating the output

Forge Version

forge 2.13.0

Operating System & Version

macOS 26.5

AI Provider

OpenAI

Model

gpt-5.5

Installation Method

Other (via nix flakes)

Configuration (.forge.toml)

"$schema" = "https://forgecode.dev/schema.json"

max_search_lines = 1000
max_search_result_bytes = 10240
max_fetch_chars = 50000
max_stdout_prefix_lines = 100
max_stdout_suffix_lines = 100
max_stdout_line_chars = 500
max_line_chars = 2000
max_read_lines = 2000
max_file_read_batch_size = 50
max_file_size_bytes = 104857600
max_image_size_bytes = 262144
tool_timeout_secs = 300
auto_open_dump = false
max_conversations = 100
max_sem_search_results = 100
sem_search_top_k = 10
services_url = "https://api.forgecode.dev/"
max_extensions = 15
max_parallel_file_reads = 64
model_cache_ttl_secs = 604800
use_forge_committer = true
max_commit_count = 20
top_p = 0.8
top_k = 30
max_tokens = 20480
max_tool_failure_per_turn = 3
max_requests_per_turn = 100
restricted = true
tool_supported = true
currency_symbol = "$"
currency_conversion_rate = 1.0
verify_todos = true
use_text_patch_fallback = false
research_subagent = true
subagents = true
merge_system_messages = false

[retry]
initial_backoff_ms = 200
min_delay_ms = 1000
backoff_factor = 2
max_attempts = 8
status_codes = [
    429,
    500,
    502,
    503,
    504,
    408,
    522,
    524,
    520,
    529,
]
suppress_errors = false

[http]
connect_timeout_secs = 30
read_timeout_secs = 900
pool_idle_timeout_secs = 90
pool_max_idle_per_host = 5
max_redirects = 10
hickory = false
tls_backend = "default"
adaptive_window = true
keep_alive_interval_secs = 60
keep_alive_timeout_secs = 10
keep_alive_while_idle = true
accept_invalid_certs = false

[session]
provider_id = "codex"
model_id = "gpt-5.5"

[commit]
provider_id = "codex"
model_id = "gpt-5.5"

[suggest]
provider_id = "codex"
model_id = "gpt-5.5"

[updates]
frequency = "daily"
auto_update = false

[compact]
retention_window = 6
eviction_window = 0.2
max_tokens = 2000
token_threshold = 100000
message_threshold = 200
on_turn_end = false

[reasoning]
effort = "medium"
enabled = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions