Skip to content

feat(ui): recover unfinished optional-question drafts - #154473

Merged
roboclaw-bot merged 2 commits into
mainfrom
feat/question-draft-recovery-20260921
Sep 21, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
feat/question-draft-recovery-20260921

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Related: #154395

What Problem This Solves

Fixes unfinished answers disappearing after a refresh, reconnect, or session switch, and being hidden when later work finishes.

User Impact

Users can resume an ordinary optional-question answer without retyping it. Editing protects the question from automatic archival; merely reopening it does not permanently pin it.

Recovery is local to the same browser and authenticated Gateway identity. Switching Gateway or authenticated identity retires the old in-memory owner, so returning cannot bypass a deletion tombstone. Same-owner conversation navigation and reconnect retain the draft. It follows the existing draft store's seven-day expiry and shared 20-record budget; Incognito and conversation deletion retire the saved answers. No migration or user action is required.

Why This Change Was Made

Question drafts now reuse the existing authenticated composer storage and conflict protection. Canonical answers in conversation history remain authoritative, and question content/identity checks prevent a draft from moving to another prompt. Storage failures keep the live answer usable and explain that it was not saved.

Evidence

The saved-answer prerequisite, originally contributed by @jb510, has landed in #154312. This candidate replays only this PR's owned change onto canonical main c012df06114a927c8aa3d567884f31a63a408b28, preserving the prerequisite and the landed compact/multiline controls.

  • Main-rebased candidate 7a25c100af2bda0fc5d092bb6d204702205837d3 passed 78 focused unit tests in 8.60 seconds (9.51 seconds whole-command wall), 28 mocked-Gateway/real-IndexedDB browser scenarios in 55.03 seconds, and dependency-cycle inspection with zero cycles. The complete 20-file changed-file check passed at that exact commit in 278.18 seconds with an unchanged clean checkout, including core/UI types, formatting, lint, i18n, ratchets, and dead-export checks. Exact-head hosted CI run35584896136 passed; native completed-evidence preparation accepted that head at 2026-09-21T10:08:13Z.
  • Prior publication head bd554cf9 passed 64 focused tests/4 files in 3.04s, 22 mocked-Gateway/real-IndexedDB browser scenarios/2 files in 38.12s, UI types, and type-aware lint. These support the recovered source; they are not a current-head CI claim.
  • The line-cap repair moves an unchanged envelope writer into its existing queue-serialization owner; 68 existing persistence/reorder tests passed in 4.34s before final type cleanup. Shared presentation types now live in a leaf module, eliminating the CI-reported type-only dependency cycle without changing emitted runtime logic.
  • Fresh independent source review found the Skip non-revival repair and monotonic post-deletion fixture revision correct. A new panel-action/remount regression ensures explicitly skipped answers do not revive as protected drafts; Skip sends no answer.
  • The old hosted worker-lifetime failure is addressed by main's launch-response handoff (5beff9c33cc), verified present in the replay base. The old deletion fixture minted a wall-clock revision that could equal/trail the retirement fence; its replacement edit now advances the observed fence without relaxing assertions or deadlines.

Before / after

Before: unfinished answer is absent after reload

After: unfinished answer remains available and recovers after reload

Review scope

Production LOC: +426/-74 (net +352) | Tests: +611/-12. The growth adds the missing durable question-draft adapter and its typed state while reusing the existing authenticated composer store, CAS, expiry, budget, and deletion owner. A second persistence store or transport owner was rejected because those responsibilities already exist.

Provenance: the pane-only scope-reset behavior was carried forward by 764ea2bffa1 (#144664, 2026-09-11; code author, PR author, and merger @steipete). The original saved-answer contributor @jb510 is credited above for the prerequisite, not blamed for draft loss.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Sep 21, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 21, 2026 05:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 6:36 AM ET / 10:36 UTC (Revision 3).

ClawSweeper review

What this changes

The Control UI saves unfinished optional-question answers in its existing browser draft store and restores them across reloads, reconnects, and conversation navigation.

Merge readiness

✅ Ready for maintainer review

This remains useful work absent from current main. The earlier Skip finding is resolved, and the pinned diff has no remaining blocking correctness finding.

Priority: P2
Reviewed head: 7a25c100af2bda0fc5d092bb6d204702205837d3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-aligned implementation with the prior finding repaired, useful browser evidence, and no blocking defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show recovered text, and reported browser scenarios exercise the changed adapter through real IndexedDB with a mocked Gateway; no independent runtime execution occurred here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show recovered text, and reported browser scenarios exercise the changed adapter through real IndexedDB with a mocked Gateway; no independent runtime execution occurred here.
Evidence reviewed 8 items Current main still lacks unfinished-answer recovery: Current main replaces the draft map when session, agent, or connection scope changes and has no asyncQuestionStorage or questionDrafts integration. The merged saved-answer prerequisite addresses canonical submitted answers, a distinct behavior.
Prior Skip finding resolved: Snapshots now exclude skipped and canonically resolved questions. The new panel-action/remount regression verifies that Skip sends no answer and does not restore the skipped text as a protected draft after later completion.
Existing persistence owner and upgrade compatibility: The new question payload is optional, so existing composer records remain readable. The database stays at version 2; question rows use a separate scope within the existing store, revision/write-ID comparisons, expiry, pruning, and retirement operations. The member-authored PR explicitly describes the shared seven-day lifetime and 20-record budget.
Findings None None.
Security None None.

How this fits together

Optional questions arrive in conversation history and appear above the chat composer. This change connects their unfinished answers to authenticated browser draft storage while keeping submitted answers authoritative in conversation history.

flowchart TD
  A[Conversation history] --> B[Optional question panel]
  B --> C[User edits answer]
  C --> D[Scoped draft adapter]
  D --> E[Existing browser draft store]
  E --> B
  A --> F[Saved answer reconciliation]
  F --> D
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +352, Tests +599. Total +951 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 14 426 74 +352
Tests 6 611 12 +599
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 1037 86 +951

Review metrics

Metric Value Why it matters
Production and test growth Production +426/-74; tests +611/-12 The stated production-growth justification is a question-draft adapter reusing existing storage, conflict protection, and retirement owners.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #154395
Summary: This PR implements the unfinished-draft portion of the broader optional-question improvement request.

Members:

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

Technical review

Best possible solution:

Keep unfinished-answer recovery with the existing authenticated draft owner and preserve canonical history as the authority for completed answers.

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

Yes, from source: enter an optional answer and change the conversation or connection scope; current main replaces its draft map. This review did not execute that flow.

Is this the best way to solve the issue?

Yes. Reusing the authenticated composer store avoids a competing persistence owner, and the additive payload preserves existing records without a database migration.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show recovered text, and reported browser scenarios exercise the changed adapter through real IndexedDB with a mocked Gateway; no independent runtime execution occurred here.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 session-state: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Recovering unfinished optional answers improves a bounded chat workflow without an urgent core-runtime regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show recovered text, and reported browser scenarios exercise the changed adapter through real IndexedDB with a mocked Gateway; no independent runtime execution occurred here.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected screenshots show recovered text, and reported browser scenarios exercise the changed adapter through real IndexedDB with a mocked Gateway; no independent runtime execution occurred here.

Evidence

What I checked:

Likely related people:

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

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 (2 earlier review cycles)
  • reviewed 2026-09-21T05:51:06.523Z sha bd554cf :: blocked before merge. :: [P2] Retire saved drafts when the user skips a question
  • reviewed 2026-09-21T09:51:37.410Z sha 7a25c10 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc changed the base branch from stack/async-question-saved-base-20260921 to main September 21, 2026 09:43
@vincentkoc
vincentkoc force-pushed the feat/question-draft-recovery-20260921 branch from bd554cf to 7a25c10 Compare September 21, 2026 09:43
@vincentkoc vincentkoc self-assigned this Sep 21, 2026
@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@roboclaw-bot
roboclaw-bot merged commit 109d1fa into main Sep 21, 2026
164 checks passed
@roboclaw-bot
roboclaw-bot deleted the feat/question-draft-recovery-20260921 branch September 21, 2026 13:41
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

@VACInc

VACInc commented Sep 21, 2026

Copy link
Copy Markdown
Member

Umbrella coordination for #154395: this already-merged PR provides unfinished optional-question draft recovery in the same browser for the authenticated Gateway identity, with seven-day expiry, shared 20-record capacity, and Incognito/deletion privacy. It recovers unfinished drafts only; saved-answer reconstruction is #154312, reversible dismissal is #154692, and outbox delivery/retry remains open in #154486. No state change is needed here.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
Recover unfinished optional-question answers across reloads, reconnects, and conversation navigation using the existing authenticated composer draft store. Keep submitted answers authoritative and preserve deletion, Incognito, and owner-change fences.

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: VACInc <[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 maintainer Maintainer-authored PR 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. size: XL 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.

3 participants