Skip to content

[Bug]: GENERIC_EXTERNAL_RUN_FAILURE_TEXT delivered on success-path turn — model.completed.aborted=false + assistantTexts non-empty + messagingToolSentTexts empty (2026.5.26 / openai-codex / WhatsApp) #87359

Closed as not planned

Description

@aleps001

Summary

On OpenClaw 2026.5.26 (10ad3aa), with openai-codex/gpt-5.5 via the Codex app-server and the pi harness, the user-facing canned text ⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session. was delivered to a WhatsApp channel on a turn that the runtime trajectory marks as a clean success. The model produced an assistant text, the trajectory reports finalStatus=success with no abort/timeout flags, but the channel did not receive the text — the runtime's fallback failure copy was delivered instead.

This appears to be different from issues like #84076 (Codex app-server stall after item/completed, recovery=none), which are failure-path bugs where turn/completed never arrives. Here model.completed fires cleanly with aborted=false and non-empty assistantTexts, yet the canned text leaks. Opening as a separate issue because the failure shape and likely fix location look distinct.

Environment

  • openclaw --version → OpenClaw 2026.5.26 (10ad3aa)
  • @earendil-works/pi-ai → 0.75.5
  • Provider: openai-codex/gpt-5.5
  • Harness: pi
  • Surface: WhatsApp direct (1:1)
  • Agent: top-level orchestrator (no parent)
  • Config relevant settings:
    • messages.visibleReplies: "automatic"
    • agents.defaults.silentReply: {} (default)
    • No per-agent visibleReplies or silentReply override on the affected agent

Observed behavior

End user received the canned text mid-conversation, between two healthy turns:

⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

The user retried with a short follow-up message. The session continued cleanly into a multi-agent spawn (workflow-lead → enterprise-ai-lead → content-lead → editorial-review) over the next ~30 minutes with no further dispatch issues. No session corruption observed; no /new was required to recover.

Expected behavior

With messages.visibleReplies: "automatic" and the trajectory reporting model.completed.aborted=false, finalStatus=success, assistantTexts non-empty — the auto-reply path should dispatch the assistant text to the WhatsApp channel. The canned failure copy should not appear when the runtime considers the turn a success.

Trajectory evidence

From the affected main agent's trajectory file (agents/main/sessions/<sessionId>.trajectory.jsonl), the turn that emitted the canned text:

model.completed
  aborted=false
  externalAbort=false
  timedOut=false
  idleTimedOut=false
  timedOutDuringCompaction=false
  timedOutDuringToolExecution=false
  promptErrorSource=null
  usage={input: 99479, output: 1238, cacheRead: 39424, reasoningTokens: 1042, total: 140141}
  assistantTexts=["Vou montar como deck executivo para a Distrito..."]   ← non-empty plain assistant text

trace.artifacts
  finalStatus=success
  didSendViaMessagingTool=false
  messagingToolSentTexts=[]
  messagingToolSentMediaUrls=[]
  messagingToolSentTargets=[]

session.ended
  status=success

The three events fired within 7 ms of each other. Then a 44-second gap (user retry), then the next session.started. No aborted=true, no timedOut=true, no promptErrorSource, no surrounding error events. By every runtime marker the turn was a clean success. The agent's last tool sequence in the turn was read → read → update_plan followed by the plain assistant text block.

Code-path notes (from dist/ read)

GENERIC_EXTERNAL_RUN_FAILURE_TEXT is defined in dist/agent-runner-failure-copy-CU6Vmacs.js and emitted from three sites in dist/reply-turn-admission-ClQM84yB.js:

  1. Line ~611, inside formatForwardedExternalRunFailureText — if (!sanitized) return GENERIC_EXTERNAL_RUN_FAILURE_TEXT (sanitizer reduces source text to empty).
  2. Line ~655, inside buildExternalRunFailureReply — fallback after the 6-classifier chain (providerRequestError, missingApiKey, oauthRefresh, isHeartbeat, cliBackendTimeout, codexAppServer) all miss.
  3. Line ~1854, inside buildKnownAgentRunFailureReplyPayload — generic fallback after Embedded agent failed before reply: ....

Sites #2 and #3 fire from failure paths (buildKnownAgentRunFailureReplyPayload is reached only after agent run failed upstream). Site #1 fires only when sanitization eats all the text — and the assistant text in this case was plain Portuguese prose, not a structured error payload that the sanitizer would normally clean.

So the canned copy reached the channel on a success-path turn. Either:

  • there is a separate auto-reply admission gate (likely also in reply-turn-admission) that runs after session.ended and emits GENERIC_EXTERNAL_RUN_FAILURE_TEXT when assistantTexts is non-empty but messagingToolSentTexts is empty (a guard against agents that produce text without explicitly dispatching), mis-firing under visibleReplies=automatic where the runtime should auto-dispatch plain assistant text; or
  • the auto-dispatch path silently dropped the text between session.ended and the channel adapter, and a downstream handler rendered the generic fallback.

Either way, the trajectory contract reports success while the channel surfaces a failure-copy — the success-path contract and the user-facing contract are disagreeing.

Reproducibility

Not reliably reproducible from observation; appears intermittent. The affected turn followed a chain of read → read → update_plan tool calls and produced a single plain assistant-text block as final output. No special characters in the text (plain Portuguese prose). Same session continued through ~30 minutes of multi-agent spawn work afterward without recurrence.

If a maintainer wants, I can sanitize and attach the full session jsonl + trajectory file for the affected turn.

Workaround

End-user retry with any short follow-up message; the session continues cleanly. No /new required, no session corruption.

Why this looks orthogonal to the existing app-server stall issues

Issues such as #84076 describe Codex app-server stalls where turn/completed never arrives and recovery=none. Those are failure-path: the model run did not complete. In this case model.completed fires cleanly with aborted=false and a non-empty assistantTexts — the runtime considers the run successful, but the dispatch/admission layer downstream of session.ended emits the canned text anyway. The likely fix surface is the auto-reply admission gate after a successful run, not the Codex app-server signaling path.

Happy to provide further detail or test patches.

Activity

  1. clawsweeper commented on May 27, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

    Close as superseded: the WhatsApp trajectory is useful evidence, but the same remaining generic-fallback-after-Codex-success family is already tracked in the open canonical issue at #87299, with newer related evidence and adjacent Codex lifecycle tracking.

    Canonical path: Keep the remaining generic fallback investigation under #87299, while coordinating any terminal-event lifecycle root cause with #87744.

    So I’m closing this here and keeping the remaining discussion on #87299 and #87744.

    Review details

    Best possible solution:

    Keep the remaining generic fallback investigation under #87299, while coordinating any terminal-event lifecycle root cause with #87744.

    Do we have a high-confidence way to reproduce the issue?

    No, not for the exact WhatsApp incident on current main. The issue has detailed trajectory evidence, and current source confirms the expected success-path contract, but the intermittent failure path is now best reproduced and tracked through the canonical generic fallback issue.

    Is this the best way to solve the issue?

    Yes, closing as superseded is the best cleanup path because the remaining work is already represented by the open canonical generic fallback tracker, with the WhatsApp evidence linked for future root-cause work.

    Security review:

    Security review: This is issue triage without a proposed patch, and it does not report a security vulnerability.

    AGENTS.md: found and applied where relevant.

    What I checked:

    • Current issue evidence: Live issue data shows a one-off OpenClaw 2026.5.26 WhatsApp/Codex report with model.completed success, non-empty assistantTexts, empty messagingToolSentTexts, and no closing pull request references.
    • Canonical tracker evidence: The open canonical tracker at [Bug]: Spurious "Something went wrong" and Codex app-server failures in large Telegram direct sessions #87299 covers spurious generic failure text in Codex-backed channel sessions, including a successful Codex run followed by visible generic error copy and newer comments with success-path assistantTexts/finalStatus success evidence.
    • Current direct-reply contract: Current main resolves non-group/channel visibleReplies other than message_tool to automatic source delivery, matching the reporter's WhatsApp direct setup rather than requiring the message tool. (src/auto-reply/reply/source-reply-delivery-mode.ts:95, 1db8ab373422)
    • Current assistant-text payload path: Current main uses non-empty assistantTexts as answer payloads when the run is not aborted and assistant artifacts are not suppressed, so the expected success-path behavior is still the normal delivery contract. (src/agents/embedded-agent-runner/run/payloads.ts:489, 1db8ab373422)
    • Current generic failure-copy path: Current main still returns GENERIC_EXTERNAL_RUN_FAILURE_TEXT for unclassified external-run failures, which is the visible copy family now tracked by the canonical issue. (src/auto-reply/reply/agent-runner-execution.ts:867, 1db8ab373422)
    • Codex contract evidence: Sibling Codex source defines turn.completed as the turn completion event and item.completed as item-terminal, while the TypeScript run helper records finalResponse from item.completed and usage from turn.completed; that matches why OpenClaw treats success-path assistant text and terminal turn state as separate signals. (../codex/sdk/typescript/src/events.ts:32, dfd03ea01bbe)

    Likely related people:

    • vincentkoc: Current blame for the sampled direct-reply mode, assistant payload, failure-copy, and Codex projection lines points to the grafted current-main commit by Vincent Koc, making this a useful routing signal despite shallow provenance. (role: recent current-source committer; confidence: medium; commits: 40093f5a93ed; files: src/auto-reply/reply/source-reply-delivery-mode.ts, src/agents/embedded-agent-runner/run/payloads.ts, src/auto-reply/reply/agent-runner-execution.ts)
    • sandieman2: Authored the recent final-reply delivery fix that touched reply payload routing, dedupe, final dispatch, and queued delivery behavior in the same auto-reply surface. (role: recent reply delivery contributor; confidence: high; commits: c67dc59b02b0; files: src/auto-reply/reply/agent-runner-payloads.ts, src/auto-reply/reply/dispatch-from-config.ts, src/auto-reply/reply/reply-turn-admission.ts)
    • keshavbotagent: Authored recent Codex app-server completion-stall recovery and post-tool edit stream timeout fixes that are adjacent to the Codex terminal-event side of this failure family. (role: adjacent Codex completion-stall fix author; confidence: high; commits: 5f89fbe6699e, fcf2852f0f11; files: extensions/codex/src/app-server/attempt-notification-state.ts, extensions/codex/src/app-server/attempt-turn-watches.ts, extensions/codex/src/app-server/run-attempt.ts)
    • steipete: Earlier history shows app-server control, lifecycle, and harness hardening commits by Peter Steinberger on the same Codex app-server area. (role: Codex app-server lifecycle contributor; confidence: medium; commits: d5698038d71c, 31a0b7bd42a5, 8d72aafdbb8d; files: extensions/codex/src/app-server/run-attempt.ts, extensions/codex/src/app-server/attempt-notification-state.ts, extensions/codex/src/app-server/attempt-turn-watches.ts)
    • Marcus Castro: Recent WhatsApp history includes multi-account inbound state and shared-default alignment work, relevant if a future follow-up proves the remaining symptom is WhatsApp-specific rather than shared reply admission. (role: recent WhatsApp area contributor; confidence: low; commits: 458a52610a4d, d2d9a928b1d2; files: extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts, extensions/whatsapp/src/auto-reply/monitor/process-message.ts)

    Codex review notes: model internal, reasoning high; reviewed against 1db8ab373422.

  2. WarrenJones commented on May 27, 2026

    @WarrenJones
  3. added
    P2Normal backlog priority with limited blast radius.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    on Jun 15, 2026
  4. locked as resolved and limited conversation to collaborators on Jun 25, 2026
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

    P2Normal backlog priority with limited blast radius.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions