Skip to content

feat(plugins): composer tasks can send their result and resume in a returning chat - #202243

Merged
obviyus merged 2 commits into
mainfrom
better-auto-send
Nov 20, 2026
Merged

obviyus merged 2 commits into
mainfrom
better-auto-send

Conversation

@obviyus

@obviyus obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Two gaps in composer tasks (#201695), found while using the Better plugin:

  • No send. An action whose result the user wants sent right away ("rewrite and send") had to insert it and leave the user to press Enter.
  • Work is dropped on a chat switch. Leaving the chat retires the action, so its card disappears while the work it started (a Gateway run) keeps going. Coming back shows nothing, the work is unreachable, and the plugin cannot even stop it because its UI handle has ended. In Better this surfaced as "already running; Cancel stops it" with no card and no Cancel.

User Impact

  • task.propose(text, { title, send: true }) inserts the text and then sends it through the composer's own send, as Enter would: same admission, follow-up queueing, connection, dictation, goal and pending-attachment checks. When the composer cannot send yet, the inserted draft stays unsent with its Undo receipt; a locked editor keeps the proposal for Use, as with insert.
  • A composer action can declare attach. The host calls it, with the same context as run, each time a built-in composer shows the chat (mount, chat switch, return from another page), so the action can start a task again and follow its earlier work. startTask({ startedAt }) keeps the original elapsed clock. Leaving still aborts the action's signal and retires the card; the action keeps its work going and stops it only when the task's signal aborts while signal has not (the user's Cancel).

Both are optional and additive.

Why This Change Was Made

  • Send goes through the existing owner. The mounted composer publishes its send beside its Escape stop policy (state.sendDraft, cleared on unmount), and submitDraft now reports whether it submitted. The task owner calls it after inserting; no second send path.
  • Attach is a presentation event, not a retained handle. Composer handles still retire on chat switch, so a retained handle never touches another chat's draft. attach gets a fresh handle bound to the chat being shown, once per presentation lifetime, after the render settles. The work's own owner (the plugin's Gateway run) decides whether there is anything to show.

Evidence

  • New e2e in native-plugin-composer.e2e.test.ts: send: true produces exactly one chat.send with the rewritten text and clears the composer (red without the send: 0 sends); a running task leaves with its chat and returns with the original clock (1m 0Xs) when the chat is shown again, then inserts its result there.
  • All composer-task and native plugin UI e2e (19) and unit tests pass; tsgo:ui, tsgo:core, oxlint, controller guard, line-cap and test-lines ratchets.
  • Chat boot JS +73 B gzip vs the merge base, within the limit.

SDK impact. Additive: optional send on ControlUiDraftProposal, optional attach on ControlUiAction, optional startedAt on startTask. The only consumer is the Better plugin.

@clawsweeper

clawsweeper Bot commented Nov 20, 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 size: M labels Nov 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR lets plugin composer tasks send their result and reconnect to earlier work when a chat returns.

Example: A Rewrite and send action produces “A rewritten draft.”

  • Before: The plugin inserts the result and the user presses Enter.
  • After: The plugin requests sending through the existing composer submission path.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The feature has clear value and reuses existing owners, but a concrete lifecycle defect and mock-only behavior evidence prevent readiness.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Plugin users must manually send rewritten results and lose access to ongoing work when leaving its chat.
Reason: The collaborator-approved extension serves a concrete Better plugin workflow through reusable host capabilities.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: the collaborator-authored feature addresses concrete plugin needs, but automatic attachment also reaches replacement composers and needs a focused repair.

Priority: P2
Reviewed head: 0fc90afd59ae5764237d835fa77ad099d0efa624

Before merge

  • Restrict automatic attachment to built-in task presenters (P2) - A replacement composer still mounts ChatComposerCompanion, whose ChatFooterContent supplies these contributions with a non-null composer draft handle. Consequently this guard admits attach beside a replacement too. If an action has earlier work and follows the documented attach pattern by calling composer.startTask, createComposerTasks.start throws because taskPresenters is zero, and the catch records a plugin diagnostic merely from presenting the chat. Gate automatic attachment on the existing built-in presenter availability, preserving ordinary setDraft actions beside replacements, and cover switching between replacement and built-in composers.

Findings

  • [P2] Restrict automatic attachment to built-in task presenters — ui/src/plugins/control-ui-contributions.solid.tsx:287-292

Tests

  • Missing end-to-end proof: Provide redacted real-Gateway evidence of rewrite-and-send and leaving/returning to ongoing work, plus a regression covering replacement composers; the body reports a send negative control but no base failure for the return scenario.
Agent review details

How this fits together

Plugin actions receive chat-scoped composer handles; the pane task owner presents progress and proposals, while the existing editor and submission owner handle draft changes and sends.

flowchart LR
  Plugin[Plugin action] --> Handle[Scoped composer handle]
  Handle --> Tasks[Pane task owner]
  Tasks --> Card[Task card]
  Tasks --> Editor[Composer editor]
  Editor --> Submit[Existing submission owner]
  Submit --> Gateway[Gateway]
Loading

Technical review

Best possible solution:

Keep the existing task and submission owners, and admit automatic attachment only when the chat has a built-in task presenter.

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

Source tracing establishes that replacement-composer contributions receive a draft handle, invoke attach, and reject startTask because no presenter exists; no target code was executed.

Is this the best way to solve the issue?

Extending the existing scoped task owner is appropriate, but draft-handle availability must not stand in for built-in task presentation.

Full review comments:

  • [P2] Restrict automatic attachment to built-in task presenters — ui/src/plugins/control-ui-contributions.solid.tsx:287-292
    A replacement composer still mounts ChatComposerCompanion, whose ChatFooterContent supplies these contributions with a non-null composer draft handle. Consequently this guard admits attach beside a replacement too. If an action has earlier work and follows the documented attach pattern by calling composer.startTask, createComposerTasks.start throws because taskPresenters is zero, and the catch records a plugin diagnostic merely from presenting the chat. Gate automatic attachment on the existing built-in presenter availability, preserving ordinary setDraft actions beside replacements, and cover switching between replacement and built-in composers.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Pane task ownership and retirement keeps the original intent (a3d7e40: Host-owned task cards centralize cancellation, proposals, editor history, and presenter availability; attach retains fresh scoped handles.)
  • Immediate draft insertion changes intended behavior with a stated reason (5aed410: Optional insertion removes the extra Use step while retaining editor locks and Undo; optional send deliberately extends that behavior.)
  • Submission and typing lifecycle keeps the original intent (d4d2777: All submission paths stop typing through one owner; the new callback continues through that owner.)
  • Solid contribution rendering keeps the original intent (939f740: The Solid migration preserved registered surfaces, SDK behavior, retained views, and retirement boundaries.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit a3d7e40 adds ui/src/lib/chat/composer-tasks.runtime.ts:61 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a3d7e40f2957; files: ui/src/lib/chat/composer-tasks.runtime.ts)
  • Peter Steinberger: Raw commit 2fc8899 adds ui/src/pages/chat/components/chat-composer.tsx:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2fc8899e8b52; files: ui/src/pages/chat/components/chat-composer.tsx)

PR surface

Source +90, Tests +73, Docs +12. Total +175 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 110 20 +90
Tests 3 73 0 +73
Docs 1 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 195 20 +175

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Public SDK additions 3 optional members Adds proposal.send, action.attach, and startTask.startedAt; the maintainer-authored direction explicitly documents their additive compatibility.

Labels

Label changes:

  • add P2: Useful optional plugin functionality with a localized composer-lifecycle defect.
  • add merge-risk: 🚨 compatibility: The public plugin contract gains sending and attachment behavior; its additive direction is explicitly accepted by the collaborator-authored PR.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Useful optional plugin functionality with a localized composer-lifecycle defect.
  • merge-risk: 🚨 compatibility: The public plugin contract gains sending and attachment behavior; its additive direction is explicitly accepted by the collaborator-authored PR.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 19, 2026, 11:57 PM ET / November 20, 2026, 04:57 UTC.

@obviyus

obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Real run with a real model (Claude Sonnet 5.5) on a source Gateway at 860695f with the Better plugin: started Better, left for Automations while the helper ran (card left with the chat), came back after 10s and the same card was there, still running (2s → 14s, 1 → 4 tools), then the result was inserted. Better and send then sent its result and cleared the composer.

Working before leaving the chat

Same card after coming back, still running

Better and send sent its prompt

@obviyus

obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: the only failing job on 860695f is check-docs.

@obviyus
obviyus merged commit 18c6b79 into main Nov 20, 2026
110 of 113 checks passed
@obviyus
obviyus deleted the better-auto-send branch November 20, 2026 05:17
@obviyus

obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 18c6b79 through the maintainer override above (check-docs fails on unrelated 2026.11.5 release-note lint). Composer tasks can now send their result as Enter would (send: true), and actions can attach to work that outlived the card, so a running task shows again when the user returns to the chat. Proof: new e2e for both, all composer and native plugin UI e2e green, clean local review, and a real model run (screenshots above).

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
…eturning chat (openclaw#202243)

## What Problem This Solves

Two gaps in composer tasks (openclaw#201695), found while using the Better plugin:

- **No send.** An action whose result the user wants sent right away ("rewrite and send") had to insert it and leave the user to press Enter.
- **Work is dropped on a chat switch.** Leaving the chat retires the action, so its card disappears while the work it started (a Gateway run) keeps going. Coming back shows nothing, the work is unreachable, and the plugin cannot even stop it because its UI handle has ended. In Better this surfaced as "already running; Cancel stops it" with no card and no Cancel.

## User Impact

- `task.propose(text, { title, send: true })` inserts the text and then sends it through the composer's own send, as Enter would: same admission, follow-up queueing, connection, dictation, goal and pending-attachment checks. When the composer cannot send yet, the inserted draft stays unsent with its Undo receipt; a locked editor keeps the proposal for Use, as with `insert`.
- A composer action can declare `attach`. The host calls it, with the same context as `run`, each time a built-in composer shows the chat (mount, chat switch, return from another page), so the action can start a task again and follow its earlier work. `startTask({ startedAt })` keeps the original elapsed clock. Leaving still aborts the action's `signal` and retires the card; the action keeps its work going and stops it only when the task's signal aborts while `signal` has not (the user's Cancel).

Both are optional and additive.

## Why This Change Was Made

- **Send goes through the existing owner.** The mounted composer publishes its send beside its Escape stop policy (`state.sendDraft`, cleared on unmount), and `submitDraft` now reports whether it submitted. The task owner calls it after inserting; no second send path.
- **Attach is a presentation event, not a retained handle.** Composer handles still retire on chat switch, so a retained handle never touches another chat's draft. `attach` gets a fresh handle bound to the chat being shown, once per presentation lifetime, after the render settles. The work's own owner (the plugin's Gateway run) decides whether there is anything to show.

## Evidence

- New e2e in `native-plugin-composer.e2e.test.ts`: `send: true` produces exactly one `chat.send` with the rewritten text and clears the composer (red without the send: 0 sends); a running task leaves with its chat and returns with the original clock (`1m 0Xs`) when the chat is shown again, then inserts its result there.
- All composer-task and native plugin UI e2e (19) and unit tests pass; `tsgo:ui`, `tsgo:core`, oxlint, controller guard, line-cap and test-lines ratchets.
- Chat boot JS +73 B gzip vs the merge base, within the limit.

**SDK impact.** Additive: optional `send` on `ControlUiDraftProposal`, optional `attach` on `ControlUiAction`, optional `startedAt` on `startTask`. The only consumer is the Better plugin.

Co-authored-by: Ayaan Zaidi <[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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant