Skip to content

fix(ui): prevent automation draft loss when switching pages - #150325

Closed
vyctorbrzezowski wants to merge 2 commits into
mainfrom
brzezowski/fix-automation-create-draft-150293
Closed

vyctorbrzezowski wants to merge 2 commits into
mainfrom
brzezowski/fix-automation-create-draft-150293

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Fixes #150293. Related: #149361.

What Problem This Solves

Leaving Automations silently discards an unfinished creation draft, including clones, forcing users to re-enter their work.

User Impact

New automation drafts, clones, and starter suggestions survive navigation to another page and back. A creation already submitted remains busy after returning, including Create & run now.

Why This Change Was Made

A scoped in-memory owner retains authoring inputs, the clone source definition, and the accepted submission. Each route mount still creates fresh inventory and request state. Cancel/Back, successful creation, application disposal, and Gateway/account/agent/permission changes retire the appropriate draft; an old completion cannot replace a newer one. Existing-job editing keeps its existing owner.

Evidence

Chromium with a mocked Gateway on Linux, through the actual sidebar and router:

Navigation case Original base after return Candidate after return
New automation, 1280×900 Name/prompt lengths 0/0 25/64
Clone, 1280×900 0/0; clone source lost 25/64; precise source preserved in submitted add
New automation, 390×844 0/0 25/64

All three cases replace the page/input nodes and start one fresh list, status, and history read, with zero mutation calls during navigation. The pending cases dispatch exactly one add; Create & run now dispatches exactly one run after that add.

  • Original base 36dd2271932f95d924358115ba27617c7fe6b994: 6 of 8 router tests fail on draft retention or pending admission; both deep-link controls pass. Candidate: 10/10 pass, including two added regressions for run-failure feedback after job/session deep-link navigation. Both additional regressions failed before the review repair.
  • Creation/component and adjacent scheduler, request-lifecycle, selection, and rendering coverage: 483/483 pass. Tests cover failure feedback, scope A→B→A, discard/new draft versus old completion, hidden-tab submission, cloning, suggestions, and job/session deep-link precedence.
  • Native check-changed passed for the selected core-test, UI and docs lanes, including typechecks, lint, formatting, i18n and export guards. The E2E setup also built the UI. Fresh independent review of the final staged diff: no actionable P0–P3 findings.

The issue separately records real isolated-Gateway original proof at 4ea8cf97fe96cf3c5800e299b9168178983304fb. This candidate evidence is a mock-Gateway harness, not live personal-Gateway proof or a performance benchmark.

Inspected synthetic before/after screenshots

Both images in each pair show the editor after leaving and returning. Before images show placeholder text in empty fields.

New automation, desktop — before / after

New automation desktop before: navigation lost the draft
New automation desktop after: navigation retains the draft

Clone, desktop — before / after

Clone desktop before: navigation lost the creation draft
Clone desktop after: navigation retains the creation draft

New automation, narrow — before / after

New automation narrow before: navigation lost the draft
New automation narrow after: navigation retains the draft

Tested candidate head: 3f959ae662b543e7a7de46565292d20775cb66dd.

Risk and coverage

Draft only; no readiness or completion claim. Live candidate proof against the isolated personal Gateway and physical-mobile validation remain open. The 390px run uses Chromium emulation and actual sidebar expansion controls. Retaining text does not claim cursor/focus restoration.

Drafts remain in memory only and do not survive reload or app closure. This does not add server idempotency or resolve ambiguous transport-disconnect outcomes. Ordinary edit retention is outside the reproduced scope. No persistent storage, dependency policy, deployment, or update guards change.

September 21 final-review preparation

Published candidate: 93f442b26355d5b5e9695d85b147ad2cdaa14692. Original contributor ancestry is preserved. Main was merged only because the added editor-clearance import conflicted; both owners remain intact. The E2E test now uses the shared shipped production bundle rather than cold source Vite; assertions and deadlines are unchanged.

  • Focused production-bundle router proof: 10/10 passed on Blacksmith Testbox; retained-media run 35551168083, 23.52 seconds.
  • Exact-candidate changed checks passed: core-test/UI typechecks, lint, formatting, i18n, export and ratchet guards.
  • Independent review found no actionable P0–P2 issue in the PR scope.
  • Inspected before/after screenshots and capture provenance. Before is the retained original-base capture; After is a fresh candidate production-bundle capture.
  • Exact-head CI is not green: QA Smoke profiles 2/6 and 3/6 fail their subagent terminal-completion fixtures. The diagnostic records one initial mock-provider response, zero spawned tasks, and no planned spawn arguments; the planner admits direct sessions_spawn or Code Mode, while the runtime advertises deferred tool_search/tool_call. No timeout or test was weakened. Owner-level QA repair remains required.

Still draft and unmerged. Real isolated-Gateway candidate acceptance and physical-mobile validation remain unproven; do not treat mocked Gateway/browser emulation as those proofs.

Credit: @vyctorbrzezowski.

Work sessions

@vyctorbrzezowski vyctorbrzezowski self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 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: L maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 5, 2026, 11:56 PM ET / October 6, 2026, 03:56 UTC (Revision 6).

ClawSweeper review

What this changes

The PR retains new automation drafts, clone definitions, and pending creation submissions across Control UI navigation, with browser coverage and documentation.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: current main still lacks creation-draft retention across page navigation, and this maintainer-owned PR remains a useful implementation candidate. The previously reported P3 test-settlement concern remains unresolved.

Priority: P2
Reviewed head: 93f442b26355d5b5e9695d85b147ad2cdaa14692

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused ownership repair with useful inspected visual proof and broad reported coverage; one test-settlement issue remains.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser screenshots show the creation owner's visible result: new and clone name/prompt inputs survive sidebar navigation in Chromium with a mocked Gateway. The body additionally records final-head production-bundle router coverage. Live isolated-Gateway and physical-mobile acceptance remain explicitly unclaimed; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected browser screenshots show the creation owner's visible result: new and clone name/prompt inputs survive sidebar navigation in Chromium with a mocked Gateway. The body additionally records final-head production-bundle router coverage. Live isolated-Gateway and physical-mobile acceptance remain explicitly unclaimed; no stored-data contract changes.
Evidence reviewed 9 items Pinned introduced changes: Reviewed the merge-base-to-head delta and the creation owner, page integration, suggestion rendering, browser scenarios, component regressions, and documentation. The checkout is the original PR head, not a synthetic test merge.
Current main still needs the behavior: Current main keeps creation form state on the page and has no creation-draft module. Its editor-hydration repair preserves mounted editors during implicit scope hydration; it does not retain creation drafts across route unmounting.
Prior finding remains: The four stale-completion cases still use setTimeout(resolve, 0). Comparing the earlier reviewed contributor head with this head produced no changes to this test file, confirming continuity and the earlier late discovery.
Findings 1 actionable finding [P3] Wait for the submitted operation instead of an event-loop timer
Security None None.

How this fits together

The Control UI Automations page turns authored forms into Gateway scheduler requests. The new in-memory owner preserves creation inputs and accepted submissions while each mounted page refreshes its own inventory and request state.

flowchart TD
  A[New automation or clone] --> B[Scoped creation draft]
  C[Page navigation] --> D[Fresh automation page]
  B --> D
  E[Scope change or explicit discard] --> B
  D --> F[Submit creation]
  F --> G[Gateway scheduler]
  G --> B
Loading

Before merge

  • Wait for the submitted operation instead of an event-loop timer (P3) - The stale-completion cases await the transport deferred and then one zero-delay timer, which does not establish that the creation owner's entire submission has settled. The assertions already hold for the replacement draft, so they can run before the stale continuation they are intended to test. Capture and await the existing submission promise before checking the replacement draft, without adding a production-only test seam. This previously reported concern was discovered late on unchanged code; comparison with the earlier reviewed head confirms it remains unchanged.
  • Resolve merge risk (P1) - The current head conflicts with main; integration with main's editor-hydration and recipient-directory lifecycle has not been validated.
  • Complete next step (P2) - Replace the timer with actual submission settlement, resolve current-main conflicts, and validate the integrated router scenarios while honoring the author's draft acceptance hold.

Findings

  • [P3] Wait for the submitted operation instead of an event-loop timer — ui/src/pages/cron/cron-page.creation.test.ts:167-171
Agent review details

Security

None.

PR surface

Source +246, Tests +524, Docs +1. Total +771 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 312 66 +246
Tests 4 533 9 +524
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 846 75 +771

Review metrics

Metric Value Why it matters
Production versus test growth production +246 net lines; tests +524 net lines Production growth has a stated ownership purpose: retaining creation state separately from page inventory and requests.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #150293
Summary: This PR is the explicit candidate fix for creation-draft navigation loss; existing-detail reconnect behavior remains separate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep creation inputs and accepted submissions under one scoped in-memory owner, while preserving current-main editor and recipient-discovery lifecycles.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep creation inputs and accepted submissions under one scoped in-memory owner, while preserving current-main editor and recipient-discovery lifecycles.

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

Yes, source supports the navigation path: current main initializes creation state on each page instance, while the linked issue records real original-Gateway reproduction. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes, separating creation lifetime from page inventory is a focused repair that preserves clone precision and pending admission; current-main integration still needs validation.

Full review comments:

  • [P3] Wait for the submitted operation instead of an event-loop timer — ui/src/pages/cron/cron-page.creation.test.ts:167-171
    The stale-completion cases await the transport deferred and then one zero-delay timer, which does not establish that the creation owner's entire submission has settled. The assertions already hold for the replacement draft, so they can run before the stale continuation they are intended to test. Capture and await the existing submission promise before checking the replacement draft, without adding a production-only test seam. This previously reported concern was discovered late on unchanged code; comparison with the earlier reviewed head confirms it remains unchanged.
    Confidence: 0.97
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove merge-risk: 🚨 session-state: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: The PR addresses bounded silent loss of unsaved automation input during ordinary navigation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected browser screenshots show the creation owner's visible result: new and clone name/prompt inputs survive sidebar navigation in Chromium with a mocked Gateway. The body additionally records final-head production-bundle router coverage. Live isolated-Gateway and physical-mobile acceptance remain explicitly unclaimed; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected browser screenshots show the creation owner's visible result: new and clone name/prompt inputs survive sidebar navigation in Chromium with a mocked Gateway. The body additionally records final-head production-bundle router coverage. Live isolated-Gateway and physical-mobile acceptance remain explicitly unclaimed; no stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected browser screenshots show the creation owner's visible result: new and clone name/prompt inputs survive sidebar navigation in Chromium with a mocked Gateway. The body additionally records final-head production-bundle router coverage. Live isolated-Gateway and physical-mobile acceptance remain explicitly unclaimed; no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head delta and the creation owner, page integration, suggestion rendering, browser scenarios, component regressions, and documentation. The checkout is the original PR head, not a synthetic test merge. (ui/src/pages/cron/creation-draft.ts:29, 93f442b26355)
  • Current main still needs the behavior: Current main keeps creation form state on the page and has no creation-draft module. Its editor-hydration repair preserves mounted editors during implicit scope hydration; it does not retain creation drafts across route unmounting. (ui/src/pages/cron/cron-page.ts, 4308a8fb8d92)
  • Prior finding remains: The four stale-completion cases still use setTimeout(resolve, 0). Comparing the earlier reviewed contributor head with this head produced no changes to this test file, confirming continuity and the earlier late discovery. (ui/src/pages/cron/cron-page.creation.test.ts:168, 93f442b26355)
  • Inspected visual proof: Inspected all four prepared images: desktop new-automation and clone before/after pairs show empty placeholder fields before and retained synthetic name/prompt afterward. The captured body identifies Chromium with a mocked Gateway and candidate 3f959ae; the September 21 comment separately records production-bundle proof at the final head. These observations support visible retention, without claiming live-Gateway or physical-mobile acceptance. (3f959ae662b5)
  • Submission authority and stale completion: Creation admission checks current scope before sending cron.add. The continuation requires retained scope currency, the same connected client, and current administrator access before cron.run; scope subscriptions invalidate pending submissions on permission, account, agent, or lifecycle changes. Old completions cannot replace a newer draft. No concrete authority violation was found. (ui/src/pages/cron/creation-draft.ts:105, 93f442b26355)
  • Live PR state: REST confirms the PR remains open and draft at the pinned head, with mergeable=false and mergeable_state=dirty. No verified test-merge result is available, so this review does not claim that merging would remove current-main behavior. (93f442b26355)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • zeroaltitude: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Await the actual submission completion in the stale-result regression and record the changed test file's wall and CI costs.
  • Resolve current-main conflicts while preserving editor hydration and recipient discovery, then rerun the integrated navigation scenarios.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-16T21:58:57.418Z sha 3f959ae :: blocked before merge. :: none
  • reviewed 2026-09-21T01:37:49.765Z sha 93f442b :: needs changes before merge. :: none
  • reviewed 2026-09-21T01:46:43.813Z sha 93f442b :: needs changes before merge. :: none
  • reviewed September 25, 2026, 3:56 PM ET / 19:56 UTC (Revision 4) sha unknown :: blocked before merge. :: [P3] Wait for draft settlement without a real timer
  • reviewed September 27, 2026, 7:50 PM ET / 23:50 UTC (Revision 5) sha unknown :: blocked before merge. :: [P3] Wait for draft settlement without a real timer

Refresh main to resolve the independent automation editor-clearance import conflict while retaining published contributor ancestry. Use the existing shared production-bundle E2E owner instead of a redundant cold Vite server; assertions and deadlines are unchanged.

Co-authored-by: vyctorbrzezowski <[email protected]>
@roboclaw-bot

roboclaw-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

September 21 final-review preparation — still draft, no land

Refreshed candidate: 93f442b26355d5b5e9695d85b147ad2cdaa14692 (original author commit preserved; main merged only to resolve the actual CronEditorClearance import conflict). The router test now uses the shared shipped bundle rather than an unnecessary cold source Vite server. Assertions, deadlines and coverage are unchanged.

Actual Chromium production-UI capture with a mocked Gateway, light theme, 1280 × 900. Both images show the editor after Automations → Usage → Automations.

Before — reused inspected original-base capture at 36dd2271932f95d924358115ba27617c7fe6b994; empty fields display placeholders. This is historical baseline evidence, not a newly captured current-main image.

Before: navigation loses automation name and prompt

After — fresh September 21 production-bundle capture of candidate 93f442b26355d5b5e9695d85b147ad2cdaa14692; name and prompt retained.

After: navigation retains automation name and prompt

Remote Blacksmith Testbox router proof: 10/10 passed, including desktop/new, desktop/clone, 390 × 844 narrow navigation, pending create/run admission, cancel/suggestion behavior and deep-link feedback. Retained-media run: https://github.com/openclaw/openclaw/actions/runs/35551168083 (test execution 23.52 seconds; no retries or extended test timeouts). This is mocked-Gateway proof, not live isolated-Gateway acceptance.

Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/35551040878 — still running; QA Smoke failures are being diagnosed, so no green-CI/readiness claim. Existing live isolated-Gateway and physical-mobile coverage gaps remain explicit.

Credit: @vyctorbrzezowski.

Work sessions

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Sep 28, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Oct 6, 2026
@RomneyDa
RomneyDa deleted the brzezowski/fix-automation-create-draft-150293 branch October 22, 2026 05:26
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 maintainer Maintainer-authored PR 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. 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.

Control UI: leaving Automations silently loses creation drafts

2 participants