Skip to content

feat(gateway): task-suggestion acceptance modes with compact split-button card - #121173

Merged
steipete merged 2 commits into
mainfrom
steipete/task-suggestion-accept-modes
Aug 9, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/task-suggestion-accept-modes

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Task-suggestion cards (spawn_task) had exactly one acceptance shape: a managed-worktree session. The operator's real question at that moment is not "yes/no" but "yes — and where should this run": an isolated worktree, the project checkout directly, a configured cloud worker, or simply as the next instruction in the session that produced the suggestion. The card also disclosed everything at full size (absolute path, complete prompt), making the tray tall and noisy.

Why This Change Was Made

Owner-directed redesign to match the reference card design: compact card — Suggested task · in <repo> eyebrow (repo basename, full path one click away), clamped summary, instructions behind a "Show instructions" expander, dismiss ✕ — with a split action button: Start with worktree (primary, unchanged default) plus a menu offering Start locally, Send to cloud (one item per configured worker profile; a single disabled item with a "No cloud environment configured" hint when none), and Fix in this session.

Every mode maps onto an existing proven seam rather than new machinery:

  • local → the plain-cwd sessions.create branch (spawnedCwd).
  • cloud → the exact Control-UI cloud sequence: create an empty worktree session, sessions.dispatch {profileId}, then deliver the prompt (create-empty is deliberate for cloud recovery). Profile validity is checked against the same listWorkerProfiles fact environments.list serves, before the chip is claimed or any side effect runs.
  • session → the session.suggestions dispatch precedent: direct handleChatSend, steering the single active run (expectedRunId) or opening a plain turn when idle, refusing when multiple runs are ambiguous. The real operator client is forwarded so the run's task-suggestion delivery-mode handshake holds. A delivery failure cancels the chip back to pending and never touches the operator's source session (invariant commented at the helper).
  • worktree → byte-for-byte the existing path; clients send {taskId} only for it, so the default action stays compatible with older gateways.

All modes ride the existing claim lifecycle (begin/complete/cancel/abandon), the acceptance dedup map, and the catch funnel that guarantees no accepting record can be stranded (all four routes flow through it).

User Impact

  • The card is compact and scannable; the full prompt and path remain one click away, so operators still see exactly what they approve.
  • Operators choose where accepted work runs. Cloud appears per profile when worker profiles are configured and as a disabled, explained hint when not — no dark-shipped menu item, no dead-end.
  • "Fix in this session" turns a suggestion into the next instruction of the current conversation — no new session, no navigation; the turn simply appears in the transcript (steered into the active run when one is running).
  • TUI parity: the same modes appear as selector rows (cloud rows only when profiles exist; older gateways degrade cleanly), keeping the double-Enter arming for every start action.
  • Protocol change is additive (mode, cloudProfileId optional on taskSuggestions.accept); result shape unchanged; operator.admin still gates every acceptance mode.

Known tradeoff (named): in cloud mode, if prompt delivery fails after the dispatch became active, rollback can be placement-fenced; the acceptance then fails loudly with the partial-rollback error and the created session stays visible — never a silent outcome. Improving fenced-cloud rollback is a follow-up, not blocked on this PR.

Evidence

  • Gateway: src/gateway/server-methods/task-suggestions.test.ts 32/32 (per-mode create-params, cloud sequence order, unknown-profile/no-profiles rejected before side effects, dispatch-failure rollback, session-mode idle/steer/ambiguous/missing/archived, delivery-failure cancel-to-pending without session deletion, replay idempotency, schema rejection of invalid modes) — verified independently by the coordinator, not only the implementation run.
  • Control UI: chip component 6/6 (eyebrow basename, expander, per-mode menu events, disabled cloud hint, render-nothing gating, bidi stripping), chat pane 41/41, mocked e2e 11/11 (primary accept still sends {taskId} only; list-only regression intact).
  • TUI: 17/17 unit + targeted PTY smoke.
  • pnpm ui:i18n:verify green after ui:i18n:baseline (new keys are translation-key-only; raw-copy baseline byte-identical).
  • oxlint/oxfmt clean across all touched files; git diff --check clean.
  • Autoreview (codex / gpt-5.6-sol, high): clean on the full delta.
  • Screenshots in this PR: redesigned card collapsed, and with the acceptance menu open showing two mocked cloud profiles.

Screenshots

Before

Task suggestion card before

After — collapsed

Compact task suggestion card

After — acceptance menu

Task suggestion acceptance mode menu

Owner decision

Multi-destination acceptance is approved as a negotiated public Gateway capability by the repository owner, who directed this feature and the reference design interactively (operator instruction in-session, 2026-08-09); non-worktree modes are capability-gated ("taskSuggestions.acceptModes") so older gateways keep graceful worktree-only behavior.

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 9, 2026 17:25
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Aug 9, 2026
@steipete
steipete force-pushed the steipete/task-suggestion-accept-modes branch 2 times, most recently from 962102f to 311302c Compare August 9, 2026 17:41
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 9, 2026, 1:46 PM ET / 17:46 UTC.

ClawSweeper review

What this changes

Adds local, cloud-worker, and source-session destinations for accepted task suggestions, plus compact Control UI and TUI controls for choosing them.

Merge readiness

⛔ Blocked by patch quality or review findings - 7 items remain

Keep this protected maintainer feature PR open: two P1 source-proven defects can respectively send unsupported parameters to older Gateways and create an unsteered turn during an active source-session run.

Priority: P1
Reviewed head: 311302c2560dc02396951e35d055ca622fbe0bb4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The feature has substantial route coverage, but two P1 boundary defects make the current patch unsafe to merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This repository-member PR is not subject to the external-contributor proof gate; supplied screenshots and mocked coverage are supplemental and do not exercise mixed-version compatibility.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-member PR is not subject to the external-contributor proof gate; supplied screenshots and mocked coverage are supplemental and do not exercise mixed-version compatibility.
Evidence reviewed 5 items Older Gateway contract: Current main accepts a closed task-suggestion request containing only taskId, so a client must not send new mode fields until the server advertises support.
Ungated alternate actions: The branch exposes alternate acceptance actions based on the existing RPC method, without a negotiated capability for the widened request shape.
Established active-run invariant: The sibling session-suggestion flow requires exactly one active run identifier before steering, including rejecting an active state with zero identifiers.
Findings 2 actionable findings [P1] Gate non-worktree actions on negotiated server support
[P1] Reject active sessions without one steerable run ID
Security None None.

How this fits together

Agents propose follow-up tasks, while the Gateway claims a suggestion and creates or steers the selected session. The Control UI and TUI negotiate Gateway features, submit the acceptance request, and display the resulting session outcome.

flowchart LR
  Agent[Agent suggestion] --> Clients[Control UI and TUI]
  Clients --> Gateway[Gateway acceptance]
  Gateway --> Mode{Execution mode}
  Mode --> Worktree[Worktree or local session]
  Mode --> Cloud[Cloud worker session]
  Mode --> Source[Source-session turn]
Loading

Decision needed

Question Recommendation
Should OpenClaw permanently expose local, cloud-worker, and source-session task-suggestion destinations as a negotiated public Gateway capability, rather than retaining worktree-only acceptance? Approve negotiated multi-destination acceptance: Keep the feature after capability-gating non-worktree modes and enforcing the existing exact-run steering invariant.

Why: This is a new cross-client Gateway workflow, so the final supported capability and compatibility promise require maintainer intent beyond the mechanical repairs.

Before merge

  • Gate non-worktree actions on negotiated server support (P1) - An older Gateway can advertise taskSuggestions.accept while still validating the closed {taskId} request shape. This gate enables local/session/cloud actions anyway, so current clients send mode and receive a validation failure; advertise a capability and keep only the worktree action until it is present.
  • Reject active sessions without one steerable run ID (P1) - Active projected or embedded work can report no visible run IDs. This branch only rejects multiple IDs, then delivers an unsteered turn; match the sibling flow's active && runIds.length !== 1 guard and restore the suggestion claim without sending a turn.
  • Resolve merge risk (P1) - Updated clients can offer local, cloud, or source-session actions to an older Gateway that rejects the added request fields, leaving operators with a failed action instead of graceful worktree-only behavior.
  • Resolve merge risk (P1) - An active projected or embedded source session without one concrete run ID can receive a new ordinary turn rather than being steered or rejected, changing the intended session state.
  • Improve patch quality - Add a server capability and old-Gateway UI/TUI regression coverage.
  • Improve patch quality - Reject active source sessions unless exactly one run ID is available and cover the zero-ID case.

Findings

  • [P1] Gate non-worktree actions on negotiated server support — ui/src/pages/chat/chat-pane-render.ts:448-459
  • [P1] Reject active sessions without one steerable run ID — src/gateway/server-methods/task-suggestions.ts:396-421
Agent review details

Security

None.

PR surface

Source +553, Tests +644, Docs 0, Generated 0, Other +8. Total +1205 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 19 714 161 +553
Tests 7 727 83 +644
Docs 1 1 1 0
Config 0 0 0 0
Generated 1 37 37 0
Other 1 9 1 +8
Total 29 1488 283 +1205

Review metrics

Metric Value Why it matters
Protocol request surface 2 optional parameters added; result shape unchanged Clients need negotiated support before sending the new fields to mixed-version Gateways.
Production versus test delta production +761/-200; tests +727/-83 The production growth implements a new cross-surface placement capability and is accompanied by substantial route and client coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: ui/src/e2e/chat-flow.follow-ups.e2e.test.ts, serialized state: ui/src/lib/session-display.ts, vector/embedding metadata: ui/src/e2e/chat-flow.follow-ups.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair negotiation and steering before merge (recommended)
    Advertise and consume a dedicated acceptance-modes capability, then reject active source sessions unless exactly one steerable run ID is available.
  2. Narrow the feature to worktrees
    Retain the existing worktree-only acceptance behavior if maintainers do not want to support version-negotiated alternate destinations.

Technical review

Best possible solution:

Negotiate a server capability for non-worktree acceptance modes, hide those modes until it is present, and require exactly one active run ID before source-session steering.

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

Yes, from source: an old Gateway advertising the existing method rejects the new mode field, and an active source session with zero visible run IDs bypasses steering safeguards.

Is this the best way to solve the issue?

No. Reusing the existing destination seams is sound, but the feature must negotiate the widened protocol and preserve the sibling flow's exactly-one-run steering rule.

Full review comments:

  • [P1] Gate non-worktree actions on negotiated server support — ui/src/pages/chat/chat-pane-render.ts:448-459
    An older Gateway can advertise taskSuggestions.accept while still validating the closed {taskId} request shape. This gate enables local/session/cloud actions anyway, so current clients send mode and receive a validation failure; advertise a capability and keep only the worktree action until it is present.
    Confidence: 0.96
  • [P1] Reject active sessions without one steerable run ID — src/gateway/server-methods/task-suggestions.ts:396-421
    Active projected or embedded work can report no visible run IDs. This branch only rejects multiple IDs, then delivers an unsteered turn; match the sibling flow's active && runIds.length !== 1 guard and restore the suggestion claim without sending a turn.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: Both defects affect normal task acceptance: one fails on supported mixed-version deployments and one can misdirect an active session.
  • add merge-risk: 🚨 compatibility: Existing clients connected to an older Gateway can send a request shape that its closed schema rejects.
  • add merge-risk: 🚨 session-state: Source-session acceptance can create an unsteered turn while an active run has no concrete steer identity.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This repository-member PR is not subject to the external-contributor proof gate; supplied screenshots and mocked coverage are supplemental and do not exercise mixed-version compatibility.

Label justifications:

  • P1: Both defects affect normal task acceptance: one fails on supported mixed-version deployments and one can misdirect an active session.
  • merge-risk: 🚨 compatibility: Existing clients connected to an older Gateway can send a request shape that its closed schema rejects.
  • merge-risk: 🚨 session-state: Source-session acceptance can create an unsteered turn while an active run has no concrete steer identity.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This repository-member PR is not subject to the external-contributor proof gate; supplied screenshots and mocked coverage are supplemental and do not exercise mixed-version compatibility.

Evidence

What I checked:

Likely related people:

  • steipete: History attributes the original task-suggestion implementation and the reviewed Gateway/UI/TUI extension to this author. (role: introduced and recently extended task-suggestion behavior; confidence: high; commits: e9250be4bbaa, 311302c2560d; files: src/gateway/server-methods/task-suggestions.ts, ui/src/pages/chat/components/chat-task-suggestions.ts, src/tui/tui-task-suggestions.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete force-pushed the steipete/task-suggestion-accept-modes branch from 311302c to 453a08b Compare August 9, 2026 17:49
…tton card

- taskSuggestions.accept gains additive mode (worktree default | local | cloud | session) + cloudProfileId; operator.admin unchanged; worktree requests stay {taskId}-only for older gateways
- local reuses the plain-cwd create; cloud mirrors the Control UI create-empty -> sessions.dispatch -> send sequence with pre-claim profile validation and full rollback; session delivers the prompt into the source session (steer single active run, plain turn when idle, ambiguous refused) and can only cancel the chip on failure, never touch the source session
- Control UI card redesigned per owner reference: repo-basename eyebrow, clamped summary, instructions expander, split button with per-profile cloud items or a disabled "No cloud environment configured" hint
- TUI gains the same modes as selector rows with capability gating and double-Enter arming

Release-note context: operators now choose where an accepted follow-up runs — isolated worktree (default), the project checkout, a configured cloud worker, or as the next instruction in the current session — from a compact suggestion card.
…steerable-run invariant

- Gate non-worktree task-suggestion actions on the negotiated Gateway capability.
- Require exactly one steerable run ID before delivering into an active source session.
@steipete
steipete force-pushed the steipete/task-suggestion-accept-modes branch from 453a08b to 6292896 Compare August 9, 2026 18:50
@steipete
steipete requested a review from a team as a code owner August 9, 2026 18:50
@steipete
steipete merged commit d3c8467 into main Aug 9, 2026
123 checks passed
@steipete
steipete deleted the steipete/task-suggestion-accept-modes branch August 9, 2026 19:21
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
…tton card (openclaw#121173)

* feat(gateway): task-suggestion acceptance modes with compact split-button card

- taskSuggestions.accept gains additive mode (worktree default | local | cloud | session) + cloudProfileId; operator.admin unchanged; worktree requests stay {taskId}-only for older gateways
- local reuses the plain-cwd create; cloud mirrors the Control UI create-empty -> sessions.dispatch -> send sequence with pre-claim profile validation and full rollback; session delivers the prompt into the source session (steer single active run, plain turn when idle, ambiguous refused) and can only cancel the chip on failure, never touch the source session
- Control UI card redesigned per owner reference: repo-basename eyebrow, clamped summary, instructions expander, split button with per-profile cloud items or a disabled "No cloud environment configured" hint
- TUI gains the same modes as selector rows with capability gating and double-Enter arming

Release-note context: operators now choose where an accepted follow-up runs — isolated worktree (default), the project checkout, a configured cloud worker, or as the next instruction in the current session — from a compact suggestion card.

* fix(gateway): negotiate task-suggestion acceptance modes and enforce steerable-run invariant

- Gate non-worktree task-suggestion actions on the negotiated Gateway capability.
- Require exactly one steerable run ID before delivering into an active source session.
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL 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