Skip to content

fix: surface terminal agent run failures - #99304

Merged
steipete merged 4 commits into
openclaw:mainfrom
moeedahmed:fix/reply-delivery-visible-failures-20260703
Jul 5, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
moeedahmed:fix/reply-delivery-visible-failures-20260703

Conversation

@moeedahmed

@moeedahmed moeedahmed commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

An embedded agent can reach a terminal failure while returning no visible payload. The reply operation records the failure, but the normal chat path previously had nothing to send, so an interactive request could appear to be ignored.

Why This Change Was Made

The contributor patch correctly identified the missing presentation, but its early kind: "final" returns bypassed pending tool/block drains, reply normalization, dedupe, session bookkeeping, and usage/model metadata.

This rewrite carries a prepared terminal-failure payload through the existing success-shaped run result. The outer reply owner waits for pending delivery, evaluates the canonical side-effect and source-delivery evidence, then appends the failure only when nothing was already delivered. Existing visible errors, message-tool/source replies, block streams, cron/approval side effects, non-direct silent policy, and heartbeat-specific copy remain authoritative.

User Impact

Interactive terminal run failures now produce one safe visible failure instead of silence. A reply already delivered through another supported path is not duplicated, and heartbeat failures retain heartbeat-specific guidance.

Release note context: Fix interactive requests appearing to be ignored when an agent run ends in a terminal failure without a visible payload.

Evidence

  • Testbox tbx_01kwsmzw7a12qk14aezg1w0wbr on the final rebased head:
    • 229 focused execution tests passed.
    • 67 payload normalization/threading tests passed.
    • 71 full runReplyAgent E2E tests passed.
    • Exact eight-file check:changed core/coreTests/docs gate passed, including core/test typechecks, lint, import-cycle and repository guards.
  • E2E regression proof holds a pending tool-result delivery open, confirms the reply does not finish early, releases it, and then observes exactly one marked generic failure.
  • Negative E2E coverage proves both message-tool and source-reply delivery suppress the duplicate.
  • Reply-threading coverage proves filtered payloads cannot consume replyToMode: first, enabled display lanes share the slot, and message-tool dedupe sees the final routed target.
  • Unit coverage includes exhausted, completed, and heartbeat terminal results plus preservation of existing visible terminal payloads.
  • Fresh post-rebase full-branch autoreview: no accepted/actionable findings (confidence 0.91).
  • Source-blind behavior validation on Testbox tbx_01kwsnw1132ts7a0v3sg6sg3tm passed all 5 clauses:

No config, protocol, dependency, or storage surface changes.

Co-authored with and preserves credit for @moeedahmed's original report and patch direction.

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 3, 2026
@clawsweeper

clawsweeper Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 3:32 PM ET / 19:32 UTC.

Summary
The branch carries terminal-failure payloads through the normal reply runner, gates fallback delivery on side-effect/source-reply evidence, preserves reply threading and dedupe, and adds focused regression tests plus release-note text.

PR surface: Source +83, Tests +244, Docs +1. Total +328 across 8 files.

Reproducibility: yes. at source level: current main can return undefined for an empty terminal-failure run before final payload building. I did not run the live scenario locally, but the PR discussion includes Testbox and source-blind TUI PTY proof for the fixed path.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] One exact-head QA Smoke CI check was still in progress when inspected; merge should wait for the required check result.

Maintainer options:

  1. Decide the mitigation before merge
    Land this terminal-failure reply fix after exact-head checks complete, while leaving the broader successful-empty-completion behavior tracked by Interactive direct turns can complete with empty output and silently drop the reply #99712.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair lane is needed; the remaining action is maintainer review and completion of exact-head merge checks.

Security
Cleared: The diff changes TypeScript reply-runner logic, tests, and changelog text only; no workflow, dependency, lockfile, secret, permission, or package-execution surface changed.

Review details

Best possible solution:

Land this terminal-failure reply fix after exact-head checks complete, while leaving the broader successful-empty-completion behavior tracked by #99712.

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

Yes, at source level: current main can return undefined for an empty terminal-failure run before final payload building. I did not run the live scenario locally, but the PR discussion includes Testbox and source-blind TUI PTY proof for the fixed path.

Is this the best way to solve the issue?

Yes for this terminal-error subcase: carrying a prepared fallback through the success-shaped result lets the reply owner drain deliveries, preserve bookkeeping, normalize/filter payloads, and avoid duplicate message-tool/source replies. The broader successful-empty-completion case remains separate.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer comment provide exact-head Testbox validation plus linked source-blind local/Gateway TUI PTY proof for the changed behavior.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.

Label justifications:

  • P2: The PR fixes a bounded user-visible reply-runner bug where interactive terminal agent failures could otherwise look like an ignored request.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer comment provide exact-head Testbox validation plus linked source-blind local/Gateway TUI PTY proof for the changed behavior.
Evidence reviewed

PR surface:

Source +83, Tests +244, Docs +1. Total +328 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 125 42 +83
Tests 3 245 1 +244
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 371 43 +328

What I checked:

Likely related people:

  • steipete: Authored the current PR commits, is assigned on the live PR, owns the current main squashed blame around the empty-payload return, and carried adjacent reply-routing/dedupe commits in merged PR 90943. (role: recent area contributor and current branch owner; confidence: high; commits: e254f791d97f, 862de9f1a1c2, 8659b5adb95a; files: src/auto-reply/reply/agent-runner.ts, src/auto-reply/reply/agent-runner-execution.ts, src/auto-reply/reply/agent-runner-payloads.ts)
  • sandieman2: Authored merged PR 90943, which changed final reply delivery and routed-thread dedupe behavior in the same reply-runner and payload-building surfaces this PR preserves. (role: adjacent reply-routing contributor; confidence: medium; commits: f99d95539a4c, c67dc59b02b0; files: src/auto-reply/reply/agent-runner.ts, src/auto-reply/reply/agent-runner-payloads.ts, src/auto-reply/reply/reply-payloads-base.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (5 earlier review cycles)
  • reviewed 2026-07-03T09:36:04.173Z sha 8e7e7d7421c15fd17df2eb8a89a5345397cdb3e4 :: needs real behavior proof before merge. :: [P2] Preserve pending delivery before returning terminal failures
  • reviewed 2026-07-05T17:59:06.979Z sha 6d0e01025a28c31518d64d984ee2cbdca41acb45 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-05T18:14:22.171Z sha c7786f2df7c695db27a027160adbdbb560738874 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-05T19:06:10.832Z sha b526f4deaae2dc49c825e710aaa8c3892bc2fb6f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T19:25:06.337Z sha e254f791d97f188e8550ef72509e68ecadbe1d04 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 3, 2026
@steipete steipete self-assigned this Jul 5, 2026
@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch from 8e7e7d7 to 6d0e010 Compare July 5, 2026 17:46
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 5, 2026
@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch from 6d0e010 to c7786f2 Compare July 5, 2026 18:04
@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch from c7786f2 to 1ff92f7 Compare July 5, 2026 18:39
@steipete

steipete commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Land-ready on exact head 22e3325691cf9a597e88a43a51286542ebc4f610.

  • Testbox tbx_01kwsmzw7a12qk14aezg1w0wbr: 229 execution + 67 payload/threading + 71 full runReplyAgent E2E tests passed; exact eight-file core/coreTests/docs check:changed passed.
  • Source-blind Testbox tbx_01kwsnw1132ts7a0v3sg6sg3tm / run 28749300454: all behavior clauses and real local/Gateway TUI PTY 7/7 passed.
  • Pending delivery is drained before fallback; message-tool/source/block/cron/approval evidence prevents duplicates; filtered outputs cannot consume replyToMode: first; route-sensitive dedupe sees final targets.
  • Fresh full-branch autoreview: no accepted/actionable findings (confidence 0.91).
  • Hosted CI/Testbox for this exact rebased head is green. No known proof gaps.

@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch from 1ff92f7 to b526f4d Compare July 5, 2026 18:53
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 5, 2026
@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch 2 times, most recently from fb85fec to e254f79 Compare July 5, 2026 19:20
@steipete
steipete force-pushed the fix/reply-delivery-visible-failures-20260703 branch from e254f79 to 22e3325 Compare July 5, 2026 19:33
@steipete
steipete merged commit 04857c7 into openclaw:main Jul 5, 2026
96 checks passed
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
* fix: surface empty terminal run failures

Co-authored-by: Moeed Ahmed <[email protected]>

* docs: note terminal failure replies

* fix: normalize terminal failure replies

* fix: preserve terminal failure reply threading

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Moeed Ahmed <[email protected]>
mattzyha added a commit to mattzyha/openclaw that referenced this pull request Aug 12, 2026
…alCleanup flags

Replaces the fork's two hardcoded Discord reaction patches (sticky-❌,
inline-awaited cleanup) with opt-in config flags that default to
upstream behavior, so upstream's statusReactions.timing tests pass
unmodified and future rebases stop conflicting on them.

- messages.statusReactions.stickyError: a failed run keeps its ❌
  permanently (including on dispatch abort) instead of clearing after
  errorHoldMs, so unattended/overnight failures stay visible.
- messages.statusReactions.awaitTerminalCleanup: the terminal-reaction
  hold/cleanup is awaited inline instead of fire-and-forget, so the
  gateway restart drain (waitForRestartReplyDrain) finishes it and
  cannot strand a reaction. Holds the channel's serialized run slot
  for the hold duration.

Both default false = exact upstream behavior. Schema (strict), types,
schema help, and field labels updated; the abort test is restored to
upstream's version and flag-on variants added alongside it.

Also refreshes fork test assertions that went stale on the v2026.7.1-2
rebase: upstream's markAgentRunFailureReplyPayload (openclaw#99304) now sets
payload.isError on non-silent terminal failures, and the openai
transient login-failure copy gained the /login codex pairing hint.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants