Persist task markdown across devices in cross-device sync#22
Merged
Conversation
The tasks panel was empty after signing in on a new device because the conversations table only stored chat messages — the task markdown lived only in localStorage. mergeServerConversations also hardcoded todoMarkdown: '' for any chat pulled from the server, so even if the column had existed, the new device wouldn't have read it. Add a todo_markdown column (migration 003), pass it through saveConversation / getConversation / listConversationsByUser, and persist the post-turn task state on every /api/chat — either the freshly extracted sections from the response or, when the response is task-free, the currentTasks the client just sent. On the client, adopt the server's tasks for chats arriving via mergeServerConversations and refresh the visible chat's tasks panel when the server's copy changes. Leave a non-empty local todoMarkdown alone when the server's copy is empty, so in-progress local edits aren't wiped by the sync.
|
🚅 Deployed to the padtask-pr-22 environment in padtask
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a cross-device sync regression where task markdown (todo lists) was not being persisted to the database or restored when signing in on a new device. Previously, tasks were hardcoded to empty strings when pulling chats from the server, causing the tasks panel to appear blank after cross-device sync.
Key Changes
todo_markdowncolumn toconversationstable via migration to store task state alongside message history/api/chatendpoint to extract and persist task markdown from assistant responses, with fallback to client-suppliedcurrentTaskswhen the response contains no taskssaveConversation()to accept and persisttodoMarkdownparameter; updatedgetConversation()andlistConversationsByUser()to retrieve stored task markdowntodoMarkdownfor new chats instead of defaulting to empty stringImplementation Details
The solution uses a "server is source of truth, but only when present" approach:
saveConversation()function usesCOALESCE()in the SQL upsert to preserve existing task markdown when a request doesn't include new taskshttps://claude.ai/code/session_01CvAyUuVJ3eJLdHaUjXXoqx