Repository navigation
feat(plugins): composer tasks can send their result and resume in a returning chat - #202243
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis 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.”
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete 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 Before merge
Findings
Tests
Agent review detailsHow this fits togetherPlugin 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4639df386419. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +90, Tests +73, Docs +12. Total +175 across 12 files. Added test files: 0. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 11:57 PM ET / November 20, 2026, 04:57 UTC. |
|
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. |
|
Maintainer override: the only failing job on 860695f is
|
|
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 ( |
…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]>



What Problem This Solves
Two gaps in composer tasks (#201695), found while using the Better plugin:
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 withinsert.attach. The host calls it, with the same context asrun, 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'ssignaland retires the card; the action keeps its work going and stops it only when the task's signal aborts whilesignalhas not (the user's Cancel).Both are optional and additive.
Why This Change Was Made
state.sendDraft, cleared on unmount), andsubmitDraftnow reports whether it submitted. The task owner calls it after inserting; no second send path.attachgets 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
native-plugin-composer.e2e.test.ts:send: trueproduces exactly onechat.sendwith 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.tsgo:ui,tsgo:core, oxlint, controller guard, line-cap and test-lines ratchets.SDK impact. Additive: optional
sendonControlUiDraftProposal, optionalattachonControlUiAction, optionalstartedAtonstartTask. The only consumer is the Better plugin.