Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
On the openai-chatgpt-responses transport, a turn that is mid-stream when the reused Responses websocket hits OpenAI's 60-minute connection limit fails outright: there is no reconnect/retry, no model failover, and the user gets "
Steps to reproduce
- Run an agent on
openai/gpt-6.1-solthrough the ChatGPT/Codex subscription route (openai-chatgpt-responses,transport: auto→ websocket) with a fallback model configured. - Keep one session busy with a long agentic turn (in our case a 23-minute, 30-tool-call turn) so the session websocket is reused across requests.
- Observe the stream end with
websocket_connection_limit_reached("Responses websocket connection limit reached (60 minutes)") after message streaming has started.
NOT_ENOUGH_INFO for a shorter deterministic repro; this is one observed occurrence.
Expected behavior
The connection-limit error is recoverable by definition ("Create a new websocket connection to continue"). The transport already retries it once when it arrives before the stream starts (connectionLimitBeforeStart in packages/ai/src/providers/openai-chatgpt-responses.ts). The same should happen after the stream starts: open a new socket and replay/continue, or at least classify the failure so model fallback runs.
Actual behavior
openai-transport:ChatGPT Responses stream terminatedwithelapsedMs=1338440,failureKind=provider-failure.- The run ended with
isError=true,failoverReason=null,providerRuntimeFailureKind=unclassified, raw errorCodex error: Responses websocket connection limit reached (60 minutes). Create a new websocket connection to continue. - The configured fallback model was not tried, and the turn's work was lost.
Code reading (inference, not traced at runtime): connectionLimitBeforeStart is !websocketStarted && isWebSocketConnectionLimitReachedError(error), so a mid-stream limit falls through to the generic failure. Cached sockets are reused while younger than SESSION_WEBSOCKET_MAX_AGE_MS (55 min), but that age is only checked when the socket is acquired. A request that starts on a ~40–55-minute-old socket and streams long enough will cross 60 minutes. Same logic on main at cbfbdc8.
OpenClaw version
2026.9.8 (d22bef1)
Operating system
macOS (Darwin 27.0.0, arm64)
Install method
git checkout, source build, launchd gateway
Model
openai/gpt-6.1-sol (thinking high)
Provider / routing chain
openclaw -> openai-chatgpt-responses (ChatGPT subscription OAuth, websocket) -> OpenAI
Additional provider/model setup details
Agent fallbacks: deepseek/deepseek-v4-flash. It was never attempted for this failure.
Logs
2026-10-07T16:21:51.725Z WARN openai-transport {"provider":"openai","api":"openai-chatgpt-responses","model":"gpt-6.1-sol","transport":"auto","elapsedMs":1338440,"stopReason":"error","failureKind":"provider-failure"} ChatGPT Responses stream terminated
2026-10-07T16:21:51.729Z WARN embedded run agent end {"isError":true,"error":"⚠️ Agent run failed (model: openai/gpt-6.1-sol).","failoverReason":null,"provider":"openai","rawErrorPreview":"Codex error: Responses websocket connection limit reached (60 minutes). Create a new websocket connection to continue.","providerRuntimeFailureKind":"unclassified"}Screenshots, recordings, and evidence
NOT_ENOUGH_INFO
Impact and severity
- Affected: subscription-route OpenAI agents with long agentic turns (WhatsApp group session here)
- Severity: blocks workflow. 23 minutes of tool work were discarded, and a queued human message waited behind it.
- Frequency: observed once on 2026-10-07
- Consequence: failed turn, no reply, no fallback
Additional information
Related but different: #122717 / #122727 (missing-response recovery).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Oct 7, 2026
Codex review: this still needs some work. Reviewed October 7, 2026, 3:28 PM ET / 19:28 UTC.
Summary
Current main still excludes mid-stream connection-limit errors from transport recovery, and the OpenAI provider does not classify that code for fallback. The earlier direct API-key fix does not cover this subscription path; no open PR was found owning the specific repair.
Reproducibility: yes. at the source boundary: emit a normal Responses event followed by the structured connection-limit error through the subscription WebSocket stream. Current code then skips transport recovery; no runtime reproduction or tests were executed during this read-only review.
Next step
The exact provider failure has a narrow source-proven classification gap and an existing recovery owner; establish a failing regression before implementing a focused repair.
Review details
Best possible solution:
Treat subscription connection expiry as a transient failure, reconnect through bounded transcript recovery, and allow configured fallback only where existing replay-safety rules permit it.
Do we have a high-confidence way to reproduce the issue?
Yes, at the source boundary: emit a normal Responses event followed by the structured connection-limit error through the subscription WebSocket stream. Current code then skips transport recovery; no runtime reproduction or tests were executed during this read-only review.
Is this the best way to solve the issue?
Blind post-stream replay is not the best repair. The existing runner can continue the saved transcript with bounded recovery while preserving completed work and restricting model fallback to replay-safe attempts.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning medium; reviewed against 030003c127f8.
Label changes
Label changes:
P1: A reported long-running agent turn fails without a reply or eligible recovery, and current source supports the failure mechanism.impact:message-loss: The reported channel turn ends with an agent failure instead of completing its reply.impact:auth-provider: The defect is in ChatGPT subscription transport failure classification and model recovery.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P1: A reported long-running agent turn fails without a reply or eligible recovery, and current source supports the failure mechanism.impact:message-loss: The reported channel turn ends with an agent failure instead of completing its reply.impact:auth-provider: The defect is in ChatGPT subscription transport failure classification and model recovery.Evidence reviewed
Acceptance criteria:
What I checked:
packages/ai/src/providers/openai-chatgpt-responses.ts:412, 030003c127f8)packages/ai/src/providers/openai-chatgpt-responses.ts:1025, 030003c127f8)extensions/openai/openai-provider.ts:91, 030003c127f8)src/agents/embedded-agent-runner/run/attempt-recovery.ts:385, 030003c127f8)packages/ai/src/providers/openai-chatgpt-responses.test.ts:207, 030003c127f8)packages/ai/src/providers/openai-chatgpt-responses.ts:387, fc23bc864e45)Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.clawsweeper commentedon Oct 7, 2026
🦞⚠️
Automatic implementation stopped before completion.
Reason: The automatic implementation worker stopped before all deterministic gates completed. Open the workflow run for the exact blocker.
Worker: https://github.com/openclaw/clawsweeper/actions/runs/37674954566