Skip to content

fix(control-ui): edit failed messages before resending - #191871

Merged
roboclaw-bot merged 10 commits into
mainfrom
openclaw/recover-failed-image-messages
Nov 3, 2026
Merged

roboclaw-bot merged 10 commits into
mainfrom
openclaw/recover-failed-image-messages

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Co-authored with @jacobtomlinson, who reported the failed-image recovery problem.

Work sessions

What Problem This Solves

Fixes: a rejected image-heavy message cannot be corrected from the failure notice, and continuing leaves its original images in active model context.

User Impact

Users can choose Edit message on the latest failed turn, confirm the existing rewind, remove attachments in the composer, and resend. Image-only messages work too. An existing unsent draft is left untouched; editing is disabled until that draft is sent or cleared. Try again keeps its existing continuation behavior so completed tool actions are not replayed automatically.

Why This Change Was Made

Reuse the existing sessions.rewind owner rather than add a provider-specific image cap or another history-editing path. Rewind removes the rejected tail from active context and clears its resume bindings while retaining the original as an inactive branch. Current-failure, canonical latest-user, imported-entry, and draft guards are checked again at the point of effect. Older failures cannot rewind newer user input. Rewinding does not undo external actions.

Cached failure facts, details, and Try again remain eager. Only the optional new editor, its admission selector, and its copy load on demand. They consume live scope, reader, rewind, and confirmation operations from their existing owners; the shared RewindButton retains its original behavior. The new copy has one dedicated cold namespace, leaving shared recovery copy intact.

Evidence

  • Production Control UI browser regression: 3 passed — text-plus-five-images and image-only recovery, draft protection, canonical rewind ID/order, exact retained-four payload hashes, reconnect/history reload, and unchanged continuation semantics. The test holds the optional edit-module request and verifies failure facts and Try again are already visible before releasing it. Cached-failure unit assertions remain synchronous.
  • Owning Gateway/session integration: 27 passed, including rejected images excluded from fresh openModelContextAsync → buildSessionContext → convertToLlm output after rewind and four-image resend. The original branch remains durable. Covers inline images and persisted media references; unchanged backend proof reused.
  • Recovery/shared-control tests: 93 passed; transcript invalidation: 22 passed; catalog-source suite: 30 passed; verifier suite: 6 passed. Original state regressions fail on unchanged main; catalog composition preserves both shared and cold copy.
  • UI/scripts typechecks, focused lint, formatting, docs formatting/MDX, and git diff --check: passed. Exact merged-source lint:ui:i18n also passed unchanged.
  • Exact failing CI inputs reproduced: merge 1da6b8021bd64d2380e3430cad40fb0bd82f6b13, base 5ead822527e350cecdf30cbe0f04b1f418fdb349. The old candidate reproduces 1,280,771 B chat-boot gzip, over the unchanged 1,280,674 B limit. The qualified runtime candidate measures 1,280,434 B — 337 B smaller, with 240 B headroom. Startup is 90,546 B; request counts stay 3 startup / 20 chat. No performance limits, checker logic, or recorded boot-module lists changed. Prior head 5886d63 subsequently passed hosted performance and i18n checks.
  • Test-cost policy: duplicated failed-input fixtures were consolidated and existing cases extended rather than adding a matrix. config/test-lines-allocations/failed-image-message-recovery.txt allocates 504 lines, exactly the measured positive regression delta. Both working-tree and staged ratchets pass on the exact merge/base, with 24 lines slack. The shared test-line scalar is unchanged. This funds the required browser, canonical-context, and current-owner/draft regressions.
  • Local single-worker costs: state/controller file 1.23 s, catalog-source file 9.94 s, browser file 22.73 s; original focused image-context integration 13.59 s. CI seconds for the final head remain pending its run.
  • Fresh independent autoreview of the cold-owner boundary and allocation completed through P2 with full owner/caller context and final source verification: no actionable findings. Reviews were static; test executions above were run separately.
  • Final type-only architecture correction replaces the page-host dependency with exact read-only fields using canonical leaf value types. Madge: 0 cycles; runtime import guard: 0 cycles. UI typecheck, focused lint, and 33 owner tests were rerun successfully. Type-erased module JavaScript is byte-identical, so unchanged runtime/bundle/media proof is reused rather than claimed as new-head CI. A separate fresh independent P2 review found no actionable findings.
  • Hosted review reported no findings on prior head bc3da5acc7f3; no duplicate review request was posted.

Proof boundary: browser Gateway I/O and courtyard images are synthetic; the backend integration reconstructs real agent/model context. A live GLM/provider request is not claimed; isolated provider credentials were not imported.

Screenshots

Actual production Control UI with synthetic Gateway I/O; all captures were visually inspected. Final settled after captures are byte-identical to the embedded assets, so those images are reused without another upload.

Before: the rejected five-image turn offers continuation, but the attachments cannot be edited there.

Before: rejected five-image message

After editing: the original text and five removable images are back in the composer.

After: editable five-image composer

After removing one and resending: only the four retained images remain in the active conversation, including after reconnect.

After: retained four-image resend

Worked on by

roboclaw-bot and others added 2 commits November 3, 2026 11:51
Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: cb434411-d880-4945-a2b1-51814a1aebb6
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L labels Nov 3, 2026
@roboclaw-bot

roboclaw-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Synthetic Control UI recovery proof

Before: five images are rejected; Try again continues with the rejected images still in history.

Before: rejected five-image message

After editing: the original text and five removable images are restored to the composer.

After: editable five-image composer

After removing one and resending: only the four retained images remain in the active conversation, including after reconnect.

After: retained four-image resend

Actual production Control UI with synthetic Gateway I/O and synthetic courtyard images. Backend tests separately verify active model-context exclusion of the rejected branch.

roboclaw-bot and others added 2 commits November 3, 2026 12:04
Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: ad894fda-026a-4a42-b2ac-b9bd28fc3abb
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds an Edit message action that restores the latest failed input and its attachments through the existing rewind flow.

Example: A message containing five courtyard images is rejected by a model accepting four.

  • Before: The failure notice offers continuation without a direct way to edit the rejected attachments.
  • After: Edit message restores all five images; the user removes one and resends four.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, useful recovery wiring with inspected visual evidence and supporting owner-boundary tests; exact-head CI failures remain unclassified.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected production Control UI screenshots show five restored composer attachments and four images after resend; browser evidence uses synthetic Gateway I/O, while the session integration verifies inactive-branch exclusion from fresh model context, with no live provider request claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: After an image-heavy message is rejected, the failure notice does not directly offer attachment correction.
Reason: The maintainer-authored direction adds discoverable recovery with existing owners and preserves the deliberately safe Try again behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR adds a useful recovery shortcut while preserving safe continuation behavior; no introduced correctness defect was found, but failing CI still needs classification.

Priority: P2
Reviewed head: bc3da5acc7f32e7d2ed2af2fac25e911dec00284

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI maps a failed run to its persisted user message, invokes permission-checked sessions.rewind, and restores the returned text and attachments to the composer.

flowchart LR
  A[Failed reply notice] --> B[Current failure and draft guards]
  B --> C[Existing rewind confirmation]
  C --> D[Permission checked sessions rewind]
  D --> E[Inactive original branch]
  D --> F[Restored composer]
  F --> G[Edited message submission]
Loading

Technical review

Best possible solution:

Retain the focused shortcut through existing rewind and composer owners, with safe continuation kept separate.

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

Current main has continuation and per-message rewind, but lacks the failed-reply edit shortcut; supplied screenshots demonstrate the requested recovery flow, without claiming a live provider reproduction.

Is this the best way to solve the issue?

The smallest complete implementation connects the failure notice to existing confirmed rewind, preserving current-run identity, unsent drafts, attachment restoration, and continuation semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d28078304a6c.

Provenance checked

  • Failed-run continuation keeps the original intent (b957f1a: Continue from existing history without automatically replaying a prompt whose tools may have completed actions.)
  • Shared rewind confirmation keeps the original intent (4e3818b: Preserve transcript controls and their behavior during the Solid migration; this carried existing rewind behavior forward.)
  • Eager failure-notice presentation keeps the original intent (09e552f: Render cached failure facts with their transcript rows instead of introducing delayed row content.)
  • Deferred English recovery copy keeps the original intent (e42e9b5: Keep session English with lazy consumers while preserving shared namespace objects and startup headroom.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +95, Tests +473, Docs +14. Total +582 across 13 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 9 106 11 +95
Tests 3 473 0 +473
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 593 11 +582

Review metrics

Metric Value Why it matters
Production versus test changes Production +106/-11 lines; tests +473/-0 lines Production growth wires existing recovery owners; tests cover distinct stale-input, draft, browser attachment, continuation, and persisted-context boundaries.

Labels

Label changes:

  • add P2: Improves recovery from rejected messages through a direct in-product action without changing provider behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Improves recovery from rejected messages through a direct in-product action without changing provider behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 7:22 AM ET / 12:22 UTC.

roboclaw-bot and others added 2 commits November 3, 2026 12:29
Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 199d8e1-da6d-4b6a-9179-1de0267e2e0e
@jacobtomlinson

Copy link
Copy Markdown
Contributor

I did manage to work around this by modifying my serving setup to increase this limit, but I still think we might want to handle this failure mode better

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 3, 2026
roboclaw-bot and others added 4 commits November 3, 2026 14:09
Keep cached failure facts and continuation eager. Delegate optional editing to the existing live reader, rewind, and confirmation owners. Consolidate its fixtures and allocate only measured regression growth.

Co-authored-by: jacobtomlinson <[email protected]>
Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 0f438d23-c1ac-4100-8393-4e3ad1116ccd
Use canonical leaf value types and read-only fields rather than depending on the page host. Runtime JavaScript is unchanged after type erasure.

Co-authored-by: jacobtomlinson <[email protected]>
Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 60200a2d-ad81-4cd3-b2eb-7f3855fa6ad3
@roboclaw-bot
roboclaw-bot merged commit dac24a3 into main Nov 3, 2026
125 of 130 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/recover-failed-image-messages branch November 3, 2026 15:35
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
* fix(control-ui): edit failed messages before resending

Co-authored-by: jacobtomlinson <[email protected]>

* fix(control-ui): edit failed messages before resending

Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: cb434411-d880-4945-a2b1-51814a1aebb6

* fix(control-ui): keep failed-message recovery lazy

Co-authored-by: jacobtomlinson <[email protected]>

* Publish openclaw/recover-failed-image-messages

Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: ad894fda-026a-4a42-b2ac-b9bd28fc3abb

* fix(control-ui): retain shared recovery translations

Co-authored-by: jacobtomlinson <[email protected]>

* Publish openclaw/recover-failed-image-messages

Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 199d8e1-da6d-4b6a-9179-1de0267e2e0e

* fix(control-ui): defer optional failed-message edit work

Keep cached failure facts and continuation eager. Delegate optional editing to the existing live reader, rewind, and confirmation owners. Consolidate its fixtures and allocate only measured regression growth.

Co-authored-by: jacobtomlinson <[email protected]>

* Publish openclaw/recover-failed-image-messages

Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 0f438d23-c1ac-4100-8393-4e3ad1116ccd

* fix(control-ui): remove failed-edit typed host cycle

Use canonical leaf value types and read-only fields rather than depending on the page host. Runtime JavaScript is unchanged after type erasure.

Co-authored-by: jacobtomlinson <[email protected]>

* Publish openclaw/recover-failed-image-messages

Worked on by:
- @jacobtomlinson

Co-authored-by: jacobtomlinson <[email protected]>
OpenClaw-Publication: 60200a2d-ad81-4cd3-b2eb-7f3855fa6ad3

---------

Co-authored-by: jacobtomlinson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants