Repository navigation
Description
What happened
On the Desktop new-task surface, text typed into the session composer disappears when the target project is switched with the workspace picker below the composer. Switching back to No project restores the text — nothing is destroyed, but the draft silently swaps while the user is typing.
Expected: text already typed for a new task should remain visible when changing the target project before sending.
Root cause (from code inspection): since #3122 (93c65c7) the new-task composer draft slot is keyed by (profileId, hostId, projectId) — see newTaskDraftKey in apps/desktop/src/renderer/app-shell.tsx:245-253, wired as draftKey={activeId ?? newTaskDraftKey} in apps/desktop/src/renderer/chat-composer-region.tsx:154. When the key changes, the draft hook saves the current DOM text under the old key and loads the new key's slot (packages/ui/src/use-composer-draft.ts:102-116), which is empty for a freshly selected project — so the typed text vanishes from view. Before #3122 the key was the constant 'new-session', so project switches preserved the draft.
Per-project draft isolation may be intentional per #3122, so whether to carry text across resolved keys or keep scoped slots is a product decision — but the current behavior reads as data loss from the user's perspective.
How to reproduce
- Open the Desktop app and stay on the new-task (home) surface, no session active.
- Type some text into the composer.
- In the workspace picker below the composer, select any project.
- The typed text disappears from the composer.
- Select No project again — the text reappears.
Happens every time (deterministic renderer logic, not intermittent).
Environment
- Maka version or commit: 57e08d8
- OS and version: not captured by reporter; root cause is platform-independent renderer logic
- Surface: Desktop
Logs, screenshots, or additional context
Code pointers:
- Draft key includes
projectId:apps/desktop/src/renderer/app-shell.tsx:245-253; consumed inapps/desktop/src/renderer/chat-composer-region.tsx:154. - Key-swap effect saves under the old key and loads the (empty) new slot:
packages/ui/src/use-composer-draft.ts:102-116. - Picker callbacks that change only the selection state:
apps/desktop/src/renderer/app-shell.tsx:1962/:1970→selectProject/selectNoProjectinapps/desktop/src/renderer/use-new-task-target.ts. - Only the unresolved→resolved handoff moves text across keys (
apps/desktop/src/renderer/chat-composer-region.tsx:83-107); there is no resolved→resolved carry-over, and no test covers switching between two resolved targets (apps/desktop/src/main/__tests__/chat-composer-region-draft-handoff.test.tscovers only the unresolved case).
Note: the text is retained in memory under the previous project's key, which is why selecting "No project" brings it back.
Disclosure: the reproduction steps were reported by a human user; the root-cause analysis above was prepared with assistance from a generative AI coding agent (code tracing only).
Activity
shaokeyibb commentedon Aug 21, 2026
Reproduce this issue, could you please assign this to me so that i can fix this? @Astro-Han
Astro-Han commentedon Aug 21, 2026
Assigned!
fix(desktop): keep the new-task composer's contents when the target c…