Skip to content

fix(wework): preserve composer drafts across tasks - #2137

Merged
qdaxb merged 1 commit into
mainfrom
fix/wework-preserve-empty-task-draft
Jul 22, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/wework-preserve-empty-task-draft

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • persist buffered composer text into its conversation scope before a task switch or composer unmount
  • restore the scoped draft when returning to a blank task or runtime task
  • keep per-keystroke input buffering so typing does not rerender the full workbench
  • add desktop E2E coverage for blank-task-to-task and task-to-task draft restoration and isolation

Root cause

Plain composer text lived only in BufferedChatInput local state. Unlike mentions, it was not committed to the existing task-scoped draft store. When a pane changed scope or was evicted, that component-local state disappeared and the task reopened with an empty composer.

User impact

Unsent text now stays with the task where it was entered. Switching between two tasks preserves both drafts independently, and returning to an empty task restores its draft without leaking text across tasks.

Verification

  • pnpm --filter wework test: 200 files, 1996 tests passed
  • targeted BufferedChatInput and WorkbenchProvider tests: 115 tests passed
  • Prettier, ESLint, and TypeScript passed
  • full Wework desktop task-flow E2E passed with real Tauri and executor requests
  • isolated ai:verify flow passed for blank task to runtime task to blank task restoration
  • pre-push Wework ESLint, TypeScript, and unit-test checks passed

Summary by CodeRabbit

  • Bug Fixes

    • Draft messages are now preserved when switching between chats or tasks.
    • Drafts remain isolated to their respective chats, preventing text from appearing in or overwriting another chat.
    • Returning to a new or previously completed task restores any unsent message.
    • Draft handling is more reliable when switching contexts or adding inserted content.
  • Tests

    • Added coverage for draft restoration and task-specific draft isolation.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Scoped composer drafts

Layer / File(s) Summary
Propagate chat scope keys
wework/src/components/chat/ChatInput.tsx, wework/src/features/workbench/WorkbenchProvider.tsx
The project chat contexts expose scopeKey, and ProjectChatControls accepts the optional field.
Buffer drafts by scope
wework/src/components/layout/BufferedChatInput.tsx, wework/src/components/layout/BufferedChatInput.test.tsx
Buffered drafts, insertions, cleanup synchronization, and submission clearing now account for chat scope; unit coverage verifies restoration.
Validate task draft isolation
wework/e2e/desktop/task-flow.e2e.mjs
E2E checks verify blank-chat restoration and separate drafts across task rows.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WorkbenchProvider
  participant ChatInput
  participant BufferedChatInput
  participant TaskFlowE2E
  WorkbenchProvider->>ChatInput: expose project chat scopeKey
  ChatInput->>BufferedChatInput: provide scopeKey and draft value
  BufferedChatInput->>BufferedChatInput: buffer draft for active scope
  TaskFlowE2E->>BufferedChatInput: switch task or chat
  BufferedChatInput-->>TaskFlowE2E: restore matching unsent draft
Loading

Possibly related PRs

Suggested reviewers: icycrystal4

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preserving composer drafts across task switches.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-preserve-empty-task-draft

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb

qdaxb commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@qdaxb
qdaxb marked this pull request as ready for review July 22, 2026 17:34
@qdaxb
qdaxb merged commit aabe7e3 into main Jul 22, 2026
30 of 31 checks passed
@qdaxb
qdaxb deleted the fix/wework-preserve-empty-task-draft branch July 22, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant