openclaw - ✅(Solved) Fix message.send can report post-processing failure after successful Slack delivery [1 pull requests, 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#84271Fetched 2026-05-20 03:41:58
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
1
Author
Timeline (top)
labeled ×6commented ×1cross-referenced ×1

In OpenClaw 2026.5.12, a message.send tool call can successfully post to Slack but still return to the model as isError: true with:

Tool output unavailable due to post-processing error.

This can make a successful user-visible Slack delivery look like a failed send.

Error Message

Tool output unavailable due to post-processing error. Tool output unavailable due to post-processing error. The generic error appears to be produced in: buildMiddlewareFailureResult() returns content text Tool output unavailable due to post-processing error. with details: {status: "error", middlewareError: true}.

  • If preserving the original details is unsafe because middleware validation fails, strip or normalize details rather than replacing the whole result with status:"error".
  • Add regression coverage for: successful Slack/message send raw result + forced tool-result middleware exception/invalid candidate result. The final tool response should remain success and include delivery identifiers.

Root Cause

  • Preserve side-effect success across post-processing failures for message.send.
  • If preserving the original details is unsafe because middleware validation fails, strip or normalize details rather than replacing the whole result with status:"error".
  • Add regression coverage for: successful Slack/message send raw result + forced tool-result middleware exception/invalid candidate result. The final tool response should remain success and include delivery identifiers.

Fix Action

Fixed

PR fix notes

PR #84292: fix(agents): preserve delivered message send results

Description (problem / solution / changelog)

Summary

  • preserve successful message.send results when tool-result middleware throws or returns an invalid candidate after delivery
  • return the sanitized delivery result with a middleware warning instead of replacing it with a generic middleware error
  • add regression coverage for thrown and invalid middleware post-processing failures

Fixes #84271

Real behavior proof

Behavior or issue addressed: delivered message.send tool results remain successful when tool-result middleware fails after delivery; the result keeps delivery identifiers and gets a middleware warning instead of status: "error" / middlewareError: true.

Real environment tested: local OpenClaw checkout on this PR branch, Node v22.19.0, pnpm v11.1.0 via Corepack, production src/agents/harness/tool-result-middleware.ts imported with tsx.

Exact steps or command run after this patch: ran a live harness invocation using createAgentToolResultMiddlewareRunner({ runtime: "codex" }, [throwingMiddleware]) with a successful message.send result containing messageId, channelId, and threadId; command exits non-zero if the final result contains details.status === "error" or details.middlewareError.

Evidence after fix:

$ corepack pnpm exec tsx --no-warnings -e 'import { createAgentToolResultMiddlewareRunner } from "./src/agents/harness/tool-result-middleware.ts"; (async()=>{ const runner=createAgentToolResultMiddlewareRunner({runtime:"codex"},[()=>{throw new Error("post-processing failed") }]); const result=await runner.applyToolResultMiddleware({toolCallId:"call-live-1",toolName:"message.send",args:{target:"C123",threadId:"1700000000.000000"},result:{content:[{type:"text",text:"delivered"}],details:{ok:true,messageId:"1700000000.000100",channelId:"C123",threadId:"1700000000.000000"}}}); console.log(JSON.stringify(result,null,2)); if (result.details?.status === "error" || result.details?.middlewareError) process.exit(1); })();'
[agents/harness] [codex] tool result middleware failed for message.send
{
  "content": [
    {
      "type": "text",
      "text": "delivered"
    }
  ],
  "details": {
    "ok": true,
    "messageId": "1700000000.000100",
    "channelId": "C123",
    "threadId": "1700000000.000000",
    "middlewareWarning": "tool-result middleware failed after message delivery"
  }
}

Observed result after fix: command exited 0 and returned the delivered result with delivery identifiers; it did not return Tool output unavailable due to post-processing error. or middlewareError: true.

Not tested: live Slack API delivery was not repeated in this PR run; the proof exercises the post-delivery harness path with redacted/synthetic delivery identifiers.

Verification

  • corepack pnpm test src/agents/harness/tool-result-middleware.test.ts
  • corepack pnpm exec oxfmt --check --threads=1 src/agents/harness/tool-result-middleware.ts src/agents/harness/tool-result-middleware.test.ts

Changed files

  • src/agents/harness/tool-result-middleware.test.ts (modified, +59/-0)
  • src/agents/harness/tool-result-middleware.ts (modified, +41/-2)

Code Example

Tool output unavailable due to post-processing error.

---

Explicit message target required for this run. Provide target/targets (and channel when needed).

---

Tool output unavailable due to post-processing error.

---

ts="<slack-message-ts>", thread_ts="<slack-thread-ts>"
RAW_BUFFERClick to expand / collapse

Summary

In OpenClaw 2026.5.12, a message.send tool call can successfully post to Slack but still return to the model as isError: true with:

Tool output unavailable due to post-processing error.

This can make a successful user-visible Slack delivery look like a failed send.

Environment

  • OpenClaw: 2026.5.12 (f066dd2)
  • Gateway: macOS LaunchAgent
  • Requester channel: Slack thread

Observed

In one inspected run:

  • Run: <run-id>
  • Slack channel: <slack-channel-id>
  • Slack thread: <slack-thread-ts>
  • Child session: <child-session-jsonl>

Transcript sequence:

  • The first message.send had channel/threadId but no explicit target; it correctly failed with:
Explicit message target required for this run. Provide target/targets (and channel when needed).
  • The retry included target="<slack-channel-id>", channel="<slack-channel-id>", threadId="<slack-thread-ts>", and the completion text.
  • That retry returned isError: true with:
Tool output unavailable due to post-processing error.
  • A subsequent message.read of the same Slack thread returned ok: true and showed the exact reply posted at Slack:
ts="<slack-message-ts>", thread_ts="<slack-thread-ts>"

The observed timestamps line up with this ordering: the send call happened first, the Slack-visible reply was created next, and the failed tool result came after that.

Likely Cause

The generic error appears to be produced in:

  • dist/tool-result-middleware-ecm3p4oK.js
  • source label: src/agents/harness/tool-result-middleware.ts

buildMiddlewareFailureResult() returns content text Tool output unavailable due to post-processing error. with details: {status: "error", middlewareError: true}.

For Codex dynamic tools, tool.execute(...) runs first, then middlewareRunner.applyToolResultMiddleware(...) runs on the raw result. For message.send, the Slack side effect can happen inside tool.execute(...). If tool-result middleware throws or rejects the candidate result after that, OpenClaw can discard the successful raw result and substitute the generic middleware failure result. The Codex bridge then exposes the tool response as isError: true, even though Slack already received the message.

Expected

For successful non-idempotent side-effect tools such as message.send, a post-processing failure should not make the public tool result indistinguishable from delivery failure.

If the raw execution result contains successful delivery identifiers, return a successful minimal result preserving fields such as messageId, channelId, and threadId, and surface middleware failure only as a warning/diagnostic.

Proposed Fix

  • Preserve side-effect success across post-processing failures for message.send.
  • If preserving the original details is unsafe because middleware validation fails, strip or normalize details rather than replacing the whole result with status:"error".
  • Add regression coverage for: successful Slack/message send raw result + forced tool-result middleware exception/invalid candidate result. The final tool response should remain success and include delivery identifiers.

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