bug: Codex CLI edit/resend can break WS tool continuation with 'No tool output found for function call'
Summary
On v0.1.119, Codex CLI WebSocket sessions can enter a broken reconnect loop after leaving the terminal view and resending from edit mode.
Observed client flow:
- Send a message in Codex CLI against a sub2api OAuth
/responsesendpoint. - Press
Escto leave the terminal view. - Press
Esctwice to enter edit mode. - Resend the edited prompt.
- The request fails with:
No tool output found for function call call_*- then repeated
Reconnecting...
This is distinct from image-history-only failures and from rs_* reasoning replay failures. It appears to be another multi-turn tool continuation bug specific to Codex CLI edit/resend behavior.
Production Evidence
From production logs on 2026-04-29 17:02:48 +0800:
ingress_ws_function_call_output_prev_infer account_id=91 turn=2 conn_id=oa_ws_91_591 action=set_previous_response_id previous_response_id=resp_008b9ba1f288d4bd0169f1c92fad7881919a7284dc9c4097e5
Immediately followed by:
ingress_ws_error_event account_id=91 turn=2 conn_id=oa_ws_91_591 idx=2 fallback_reason=event_err err_code=- err_type=invalid_request_err err_message=No tool output found for function call call_FMarYwXbOva7sdmdklTybxZ9. previous_response_id=resp_008b9ba1f288d4bd0169f1c92fad7881919a7284dc9c4097e5 previous_response_id_kind=response_id response_id=- store_disabled=true has_prompt_cache_key=true
The gateway inferred a continuation turn with function_call_output and auto-filled previous_response_id, but upstream still rejected the request because the expected tool output for the referenced function call was not present in a way upstream accepted.
Why this looks different from existing issues
Related but not identical:
#1915reportsNo tool output found for tool search callafter image generation / image modification in the same session.#2067reportsrs_*reasoning replay causing turn-2 failures when clients replay prior assistant items understore=false.
This issue reproduces without image generation and is triggered specifically by Codex CLI edit/resend flow after leaving the session with Esc.
Suspected Root Cause
The WS ingress continuation logic currently treats the resend as a valid function_call_output continuation and preserves / infers previous_response_id, but it does not fully validate that the resent payload still carries a tool-output chain consistent with the referenced prior function call.
So the gateway forwards a continuation turn that is structurally close enough to continue, but semantically incomplete for upstream, which returns:
No tool output found for function call call_*
Reproduction
Environment:
- sub2api
v0.1.119 - OpenAI OAuth account
/responsesWebSocket path via Codex CLI
Steps:
- Start a new Codex CLI session through sub2api.
- Send a prompt that causes at least one tool/function call in the conversation.
- Press
Escto leave the active terminal/stream view. - Press
Esctwice to enter edit mode. - Edit the previous content and send again.
- Observe the client error
No tool output found for function call call_*and then repeated reconnect attempts.
Suggested Direction
- Harden the WS continuation path for edit/resend turns.
- Before preserving or inferring
previous_response_idfor a resend containingfunction_call_output, verify that the resent payload still contains a valid tool-output continuation chain for the referenced upstream function call. - If the tool-output chain is incomplete or no longer trustworthy, degrade safely instead of forwarding a broken continuation turn that poisons the session.