openclaw - 💡(How to fix) Fix GPT-4o agent sessions exit after single text response instead of continuing tool-use loop [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#81567Fetched 2026-05-14 03:30:46
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1

When an OpenClaw agent is configured with openai/gpt-4o as its model, sessions dispatched via CLI exit after a single text response instead of continuing to use tools iteratively to complete the task.

Root Cause

When an OpenClaw agent is configured with openai/gpt-4o as its model, sessions dispatched via CLI exit after a single text response instead of continuing to use tools iteratively to complete the task.

Fix Action

Workaround

Calling the OpenAI API directly via Python script, bypassing the OpenClaw agent loop entirely. Functional but loses all OpenClaw tool infrastructure.

RAW_BUFFERClick to expand / collapse

Summary

When an OpenClaw agent is configured with openai/gpt-4o as its model, sessions dispatched via CLI exit after a single text response instead of continuing to use tools iteratively to complete the task.

Expected Behaviour

The agent should behave like Claude: receive the message, use tools (read/write/exec etc.) across multiple turns, and continue until the task is complete — matching the documented agentic loop.

Actual Behaviour

GPT-4o receives the prompt, generates a detailed text plan/outline of what it would do, and the session closes with status: done. No tools are called. The model treats the request as a chat completion ("respond to this message") rather than an agentic task ("complete this task using your tools").

The same prompt dispatched to a Claude-based agent on the same gateway, same session mechanism, same tools available — Claude iterates through tool calls and completes the task.

Reproduction

  1. Configure an OpenClaw agent with model.primary: openai/gpt-4o
  2. Dispatch a multi-step task via CLI: openclaw agent --agent main --session-id test -m "Read the file at /tmp/test.md and write a summary to /tmp/output.md"
  3. Observe: GPT-4o responds with a description of the steps it would take, session closes, no files written
  4. Same command with a Claude-based agent: Claude reads the file, writes the summary, task complete

Context

  • Observed consistently across Papers 5 and 6 of a CA exam task (long-form, multi-step: read paper → write answers → generate PDF → send via Telegram)
  • GPT-4o returns ~35k tokens of detailed planning text in one shot and exits
  • Claude Sonnet 4.6 on identical prompt: session shows status: running, continues across turns, uses tools, completes task
  • OpenClaw version: 2026.4.24
  • macOS, arm64

Possible Cause

The agent continuation loop may not be correctly handling GPT-4o's response termination condition. GPT-4o may require an explicit tool_choice nudge or system-prompt instruction to enter tool-use mode, whereas Claude does this naturally from the agent system prompt.

Alternatively, GPT-4o's response may be finishing with finish_reason: stop (text complete) rather than finish_reason: tool_calls, and the OpenClaw agent loop may be treating stop as a session-end signal regardless of model.

Workaround

Calling the OpenAI API directly via Python script, bypassing the OpenClaw agent loop entirely. Functional but loses all OpenClaw tool infrastructure.

Request

  1. Investigate whether the agent loop handles finish_reason: stop from GPT-4o differently from Claude's equivalent
  2. Consider whether GPT-4o requires a system prompt addition to behave agentically in the OpenClaw loop
  3. Document any known behavioural differences across providers

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix GPT-4o agent sessions exit after single text response instead of continuing tool-use loop [1 comments, 2 participants]